From 6f5507be2501048f9290c1f3d358262c9b2eed91 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Mon, 24 Jul 2023 19:49:39 +0100 Subject: [PATCH 01/25] unify scripts --- .../a2t_whisper.sh => a2t-whisper/build.sh | 8 ++++---- scripts/cdr_replit.sh => cdr-replit/build.sh | 2 +- scripts/cdr_t5.sh => cdr-t5/build.sh | 2 +- .../cht_dolly_v2.sh => cht-dolly-v2/build.sh | 4 ++-- scripts/cht_falcon.sh => cht-falcon/build.sh | 4 ++-- .../cht_gorilla.sh => cht-gorilla/build.sh | 8 ++++---- .../build.sh | 8 ++++---- scripts/cht_mpt.sh => cht-mpt/build.sh | 12 +++++------ scripts/cht_xgen.sh => cht-xgen/build.sh | 4 ++-- scripts/dfs_dalle.sh => dfs-dalle/build.sh | 4 ++-- .../build.sh | 20 +++++++++---------- .../build.sh | 8 ++++---- scripts/t2a_bark.sh => t2a-bark/build.sh | 8 ++++---- 13 files changed, 46 insertions(+), 46 deletions(-) rename scripts/a2t_whisper.sh => a2t-whisper/build.sh (82%) rename scripts/cdr_replit.sh => cdr-replit/build.sh (96%) rename scripts/cdr_t5.sh => cdr-t5/build.sh (92%) rename scripts/cht_dolly_v2.sh => cht-dolly-v2/build.sh (84%) rename scripts/cht_falcon.sh => cht-falcon/build.sh (86%) rename scripts/cht_gorilla.sh => cht-gorilla/build.sh (87%) rename scripts/cht_llama_cpp.sh => cht-llama-cpp/build.sh (75%) rename scripts/cht_mpt.sh => cht-mpt/build.sh (82%) rename scripts/cht_xgen.sh => cht-xgen/build.sh (86%) rename scripts/dfs_dalle.sh => dfs-dalle/build.sh (90%) rename scripts/dfs_diffusers.sh => dfs-diffusers/build.sh (83%) rename scripts/ebd_all_minilm.sh => ebd-all-minilm/build.sh (81%) rename scripts/t2a_bark.sh => t2a-bark/build.sh (80%) diff --git a/scripts/a2t_whisper.sh b/a2t-whisper/build.sh similarity index 82% rename from scripts/a2t_whisper.sh rename to a2t-whisper/build.sh index be9030b..7f669f8 100755 --- a/scripts/a2t_whisper.sh +++ b/a2t-whisper/build.sh @@ -6,20 +6,20 @@ export VERSION=1.0.1 docker buildx build --push \ --cache-from ghcr.io/premai-io/audio-to-text-whisper-tiny-cpu:latest \ - --file ./a2t-whisper/docker/cpu/Dockerfile \ + --file ./docker/cpu/Dockerfile \ --build-arg="MODEL_ID=tiny" \ --tag ghcr.io/premai-io/audio-to-text-whisper-tiny-cpu:latest \ --tag ghcr.io/premai-io/audio-to-text-whisper-tiny-cpu:$VERSION \ - --platform linux/arm64,linux/amd64 ./a2t-whisper + --platform linux/arm64,linux/amd64 . docker run --rm ghcr.io/premai-io/audio-to-text-whisper-tiny-cpu:$VERSION pytest docker buildx build --push \ --cache-from ghcr.io/premai-io/audio-to-text-whisper-large-v2-gpu:latest \ - --file ./a2t-whisper/docker/gpu/Dockerfile \ + --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=large-v2" \ --tag ghcr.io/premai-io/audio-to-text-whisper-large-v2-gpu:latest \ --tag ghcr.io/premai-io/audio-to-text-whisper-large-v2-gpu:$VERSION \ - ./a2t-whisper + . docker run --rm ghcr.io/premai-io/audio-to-text-whisper-large-v2-gpu:$VERSION pytest diff --git a/scripts/cdr_replit.sh b/cdr-replit/build.sh similarity index 96% rename from scripts/cdr_replit.sh rename to cdr-replit/build.sh index ea8dbc0..6dfcf11 100755 --- a/scripts/cdr_replit.sh +++ b/cdr-replit/build.sh @@ -10,6 +10,6 @@ docker buildx build --push \ --build-arg="MODEL_ID=replit/replit-code-v1-3b" \ --tag ghcr.io/premai-io/coder-replit-code-v1-3b-gpu:latest \ --tag ghcr.io/premai-io/coder-replit-code-v1-3b-gpu:$VERSION \ - ./cdr-replit + . docker run --rm --gpus all ghcr.io/premai-io/coder-replit-code-v1-3b-gpu:$VERSION pytest diff --git a/scripts/cdr_t5.sh b/cdr-t5/build.sh similarity index 92% rename from scripts/cdr_t5.sh rename to cdr-t5/build.sh index f2f8243..3eb536e 100755 --- a/scripts/cdr_t5.sh +++ b/cdr-t5/build.sh @@ -10,6 +10,6 @@ docker buildx build --push \ --build-arg="MODEL_ID=Salesforce/codet5p-220m-py" \ --tag ghcr.io/premai-io/coder-codet5p-220m-py-cpu:latest \ --tag ghcr.io/premai-io/coder-codet5p-220m-py-cpu:$VERSION \ - --platform linux/amd64 ./cdr-t5 + --platform linux/amd64 . docker run --rm ghcr.io/premai-io/coder-codet5p-220m-py-cpu:$VERSION pytest diff --git a/scripts/cht_dolly_v2.sh b/cht-dolly-v2/build.sh similarity index 84% rename from scripts/cht_dolly_v2.sh rename to cht-dolly-v2/build.sh index b425f14..37882cb 100755 --- a/scripts/cht_dolly_v2.sh +++ b/cht-dolly-v2/build.sh @@ -6,10 +6,10 @@ export VERSION=1.0.3 docker buildx build --push \ --cache-from ghcr.io/premai-io/chat-dolly-v2-12b-gpu:latest \ - --file ./cht-dolly-v2/docker/gpu/Dockerfile \ + --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=databricks/dolly-v2-12b" \ --tag ghcr.io/premai-io/chat-dolly-v2-12b-gpu:latest \ --tag ghcr.io/premai-io/chat-dolly-v2-12b-gpu:$VERSION \ - ./cht-dolly-v2 + . docker run --gpus all ghcr.io/premai-io/chat-dolly-v2-12b-gpu:$VERSION pytest diff --git a/scripts/cht_falcon.sh b/cht-falcon/build.sh similarity index 86% rename from scripts/cht_falcon.sh rename to cht-falcon/build.sh index 8dcf2d1..f774ca8 100755 --- a/scripts/cht_falcon.sh +++ b/cht-falcon/build.sh @@ -6,9 +6,9 @@ export VERSION=1.0.0 docker buildx build --push \ --cache-from ghcr.io/premai-io/chat-falcon-7b-instruct-gpu:latest \ - --file ./cht-falcon/docker/gpu/Dockerfile \ + --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=tiiuae/falcon-7b-instruct" \ --tag ghcr.io/premai-io/chat-falcon-7b-instruct-gpu:latest \ --tag ghcr.io/premai-io/chat-falcon-7b-instruct-gpu:$VERSION \ - ./cht-falcon + . docker run --gpus all ghcr.io/premai-io/chat-falcon-7b-instruct-gpu:latest pytest diff --git a/scripts/cht_gorilla.sh b/cht-gorilla/build.sh similarity index 87% rename from scripts/cht_gorilla.sh rename to cht-gorilla/build.sh index 61d9103..f59a773 100755 --- a/scripts/cht_gorilla.sh +++ b/cht-gorilla/build.sh @@ -8,11 +8,11 @@ echo "Build, push and test gorilla falcon" docker buildx build --push \ --cache-from ghcr.io/premai-io/chat-gorilla-falcon-7b-gpu:latest \ - --file ./cht-gorilla/docker/gpu/Dockerfile \ + --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=gorilla-llm/gorilla-falcon-7b-hf-v0" \ --tag ghcr.io/premai-io/chat-gorilla-falcon-7b-gpu:latest \ --tag ghcr.io/premai-io/chat-gorilla-falcon-7b-gpu:$VERSION \ - ./cht-gorilla + . docker run -e MODEL_ID=gorilla-llm/gorilla-falcon-7b-hf-v0 --gpus all ghcr.io/premai-io/chat-gorilla-falcon-7b-gpu:latest pytest @@ -20,10 +20,10 @@ echo "Build, push and test gorilla mpt" docker buildx build --push \ --cache-from ghcr.io/premai-io/chat-gorilla-mpt-7b-gpu:latest \ - --file ./cht-gorilla/docker/gpu/Dockerfile \ + --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=gorilla-llm/gorilla-mpt-7b-hf-v0" \ --tag ghcr.io/premai-io/chat-gorilla-mpt-7b-gpu:latest \ --tag ghcr.io/premai-io/chat-gorilla-mpt-7b-gpu:$VERSION \ - ./cht-gorilla + . docker run -e MODEL_ID=gorilla-llm/gorilla-mpt-7b-hf-v0 --gpus all ghcr.io/premai-io/chat-gorilla-mpt-7b-gpu:latest pytest diff --git a/scripts/cht_llama_cpp.sh b/cht-llama-cpp/build.sh similarity index 75% rename from scripts/cht_llama_cpp.sh rename to cht-llama-cpp/build.sh index 5cb9383..98ff2a5 100755 --- a/scripts/cht_llama_cpp.sh +++ b/cht-llama-cpp/build.sh @@ -6,18 +6,18 @@ export VERSION=1.0.4 docker buildx build --push \ --cache-from ghcr.io/premai-io/chat-gpt4all-lora-q4-cpu:latest \ - --file ./cht-llama-cpp/docker/cpu/Dockerfile \ + --file ./docker/cpu/Dockerfile \ --build-arg="MODEL_ID=gpt4all-lora-q4" \ --tag ghcr.io/premai-io/chat-gpt4all-lora-q4-cpu:latest \ --tag ghcr.io/premai-io/chat-gpt4all-lora-q4-cpu:$VERSION \ - --platform linux/arm64,linux/amd64 ./cht-llama-cpp + --platform linux/arm64,linux/amd64 . docker buildx build --push \ --cache-from ghcr.io/premai-io/chat-vicuna-7b-q4-cpu:latest \ - --file ./cht-llama-cpp/docker/cpu/Dockerfile \ + --file ./docker/cpu/Dockerfile \ --build-arg="MODEL_ID=vicuna-7b-q4" \ --tag ghcr.io/premai-io/chat-vicuna-7b-q4-cpu:latest \ --tag ghcr.io/premai-io/chat-vicuna-7b-q4-cpu:$VERSION \ - --platform linux/arm64,linux/amd64 ./cht-llama-cpp + --platform linux/arm64,linux/amd64 . docker run --rm ghcr.io/premai-io/chat-vicuna-7b-q4-cpu:$VERSION pytest diff --git a/scripts/cht_mpt.sh b/cht-mpt/build.sh similarity index 82% rename from scripts/cht_mpt.sh rename to cht-mpt/build.sh index bc9d9a8..5f7d7d7 100755 --- a/scripts/cht_mpt.sh +++ b/cht-mpt/build.sh @@ -6,26 +6,26 @@ export VERSION=1.0.0 docker buildx build --push \ --cache-from ghcr.io/premai-io/chat-mpt-7b-gpu:latest \ - --file ./cht-mpt/docker/gpu/Dockerfile \ + --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=mosaicml/mpt-7b-chat" \ --tag ghcr.io/premai-io/chat-mpt-7b-gpu:latest \ --tag ghcr.io/premai-io/chat-mpt-7b-gpu:$VERSION \ - ./cht-mpt + . docker buildx build --push \ --cache-from ghcr.io/premai-io/mpt-7b-gpu:latest \ - --file ./cht-mpt/docker/gpu/Dockerfile \ + --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=mosaicml/mpt-7b" \ --tag ghcr.io/premai-io/mpt-7b-gpu:latest \ --tag ghcr.io/premai-io/mpt-7b-gpu:$VERSION \ - ./cht-mpt + . docker buildx build --push \ --cache-from ghcr.io/premai-io/mpt-7b-instruct-gpu:latest \ - --file ./cht-mpt/docker/gpu/Dockerfile \ + --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=mosaicml/mpt-7b-instruct" \ --tag ghcr.io/premai-io/mpt-7b-instruct-gpu:latest \ --tag ghcr.io/premai-io/mpt-7b-instruct-gpu:$VERSION \ - ./cht-mpt + . docker run --gpus all ghcr.io/premai-io/chat-mpt-7b-gpu:latest pytest diff --git a/scripts/cht_xgen.sh b/cht-xgen/build.sh similarity index 86% rename from scripts/cht_xgen.sh rename to cht-xgen/build.sh index c7d2022..2e1fbb8 100755 --- a/scripts/cht_xgen.sh +++ b/cht-xgen/build.sh @@ -6,9 +6,9 @@ export VERSION=1.0.0 docker buildx build --push \ --cache-from ghcr.io/premai-io/chat-xgen-7b-8k-inst-gpu:latest \ - --file ./cht-xgen/docker/gpu/Dockerfile \ + --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=Salesforce/xgen-7b-8k-inst" \ --tag ghcr.io/premai-io/chat-xgen-7b-8k-inst-gpu:latest \ --tag ghcr.io/premai-io/chat-xgen-7b-8k-inst-gpu:$VERSION \ - ./cht-xgen + . docker run --gpus all ghcr.io/premai-io/chat-xgen-7b-8k-inst-gpu:latest pytest diff --git a/scripts/dfs_dalle.sh b/dfs-dalle/build.sh similarity index 90% rename from scripts/dfs_dalle.sh rename to dfs-dalle/build.sh index 893cf64..9c6255e 100755 --- a/scripts/dfs_dalle.sh +++ b/dfs-dalle/build.sh @@ -6,13 +6,13 @@ export VERSION=1.0.0 docker buildx build --push \ --cache-from=ghcr.io/premai-io/diffuser-dalle-mini-gpu:latest \ - --file ./dfs-dalle/docker/gpu/Dockerfile \ + --file ./docker/gpu/Dockerfile \ --build-arg="DALLE_MODEL_ID=dalle-mini/dalle-mini" \ --build-arg="DALLE_REVISION_ID=''" \ --build-arg="VQGAN_MODEL_ID=dalle-mini/vqgan_imagenet_f16_16384" \ --build-arg="VQGAN_REVISION_ID=e93a26e7707683d349bf5d5c41c5b0ef69b677a9" \ --tag ghcr.io/premai-io/diffuser-dalle-mini-gpu:latest \ --tag ghcr.io/premai-io/diffuser-dalle-mini-gpu:$VERSION \ - ./dfs-dalle + . docker run --rm --gpus all ghcr.io/premai-io/diffuser-dalle-mini-gpu:latest pytest diff --git a/scripts/dfs_diffusers.sh b/dfs-diffusers/build.sh similarity index 83% rename from scripts/dfs_diffusers.sh rename to dfs-diffusers/build.sh index 9caceff..c2e1feb 100755 --- a/scripts/dfs_diffusers.sh +++ b/dfs-diffusers/build.sh @@ -6,44 +6,44 @@ export VERSION=1.0.3 docker buildx build --push \ --cache-from=ghcr.io/premai-io/diffuser-stable-diffusion-2-1-gpu:latest \ - --file ./dfs-diffusers/docker/gpu/Dockerfile \ + --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=stabilityai/stable-diffusion-2-1" \ --tag ghcr.io/premai-io/diffuser-stable-diffusion-2-1-gpu:latest \ --tag ghcr.io/premai-io/diffuser-stable-diffusion-2-1-gpu:$VERSION \ - ./dfs-diffusers + . docker buildx build --push \ --cache-from=ghcr.io/premai-io/diffuser-stable-diffusion-1-5-gpu:latest \ - --file ./dfs-diffusers/docker/gpu/Dockerfile \ + --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=runwayml/stable-diffusion-v1-5" \ --tag ghcr.io/premai-io/diffuser-stable-diffusion-1-5-gpu:latest \ --tag ghcr.io/premai-io/diffuser-stable-diffusion-1-5-gpu:$VERSION \ - ./dfs-diffusers + . docker buildx build --push \ --cache-from=ghcr.io/premai-io/diffuser-stable-diffusion-2-base-gpu:latest \ - --file ./dfs-diffusers/docker/gpu/Dockerfile \ + --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=stabilityai/stable-diffusion-2" \ --tag ghcr.io/premai-io/diffuser-stable-diffusion-2-gpu:latest \ --tag ghcr.io/premai-io/diffuser-stable-diffusion-2-gpu:$VERSION \ - ./dfs-diffusers + . # docker system prune --all --force --volumes docker buildx build --push \ --cache-from=ghcr.io/premai-io/upscaler-stable-diffusion-x4-gpu:latest \ - --file ./dfs-diffusers/docker/gpu/Dockerfile \ + --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=stabilityai/stable-diffusion-x4-upscaler" \ --tag ghcr.io/premai-io/upscaler-stable-diffusion-x4-gpu:latest \ --tag ghcr.io/premai-io/upscaler-stable-diffusion-x4-gpu:$VERSION \ - ./dfs-diffusers + . docker buildx build --push \ --cache-from=ghcr.io/premai-io/upscaler-stable-diffusion-x2-latent-gpu:latest \ - --file ./dfs-diffusers/docker/gpu/Dockerfile \ + --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=stabilityai/sd-x2-latent-upscaler" \ --tag ghcr.io/premai-io/upscaler-stable-diffusion-x2-latent-gpu:latest \ --tag ghcr.io/premai-io/upscaler-stable-diffusion-x2-latent-gpu:$VERSION \ - ./dfs-diffusers + . # docker run --rm --gpus all ghcr.io/premai-io/diffuser-stable-diffusion-2-gpu:$VERSION pytest diff --git a/scripts/ebd_all_minilm.sh b/ebd-all-minilm/build.sh similarity index 81% rename from scripts/ebd_all_minilm.sh rename to ebd-all-minilm/build.sh index e09c39e..d15c54c 100755 --- a/scripts/ebd_all_minilm.sh +++ b/ebd-all-minilm/build.sh @@ -6,19 +6,19 @@ export VERSION=1.0.2 docker buildx build --push \ --cache-from ghcr.io/premai-io/embeddings-all-minilm-l6-v2-cpu:latest \ - --file ./ebd-all-minilm/docker/cpu/Dockerfile \ + --file ./docker/cpu/Dockerfile \ --build-arg="MODEL_ID=all-MiniLM-L6-v2" \ --tag ghcr.io/premai-io/embeddings-all-minilm-l6-v2-cpu:latest \ --tag ghcr.io/premai-io/embeddings-all-minilm-l6-v2-cpu:$VERSION \ - --platform linux/arm64,linux/amd64 ./ebd-all-minilm + --platform linux/arm64,linux/amd64 . docker buildx build --push \ --cache-from ghcr.io/premai-io/embeddings-all-minilm-l6-v2-gpu:latest \ - --file ./ebd-all-minilm/docker/gpu/Dockerfile \ + --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=all-MiniLM-L6-v2" \ --tag ghcr.io/premai-io/embeddings-all-minilm-l6-v2-gpu:latest \ --tag ghcr.io/premai-io/embeddings-all-minilm-l6-v2-gpu:$VERSION \ - ./ebd-all-minilm + . docker run --rm ghcr.io/premai-io/embeddings-all-minilm-l6-v2-cpu:$VERSION pytest docker run --rm --gpus all ghcr.io/premai-io/embeddings-all-minilm-l6-v2-gpu:$VERSION pytest diff --git a/scripts/t2a_bark.sh b/t2a-bark/build.sh similarity index 80% rename from scripts/t2a_bark.sh rename to t2a-bark/build.sh index c051117..c80b457 100755 --- a/scripts/t2a_bark.sh +++ b/t2a-bark/build.sh @@ -6,18 +6,18 @@ export VERSION=1.0.0 docker buildx build --push \ --cache-from=ghcr.io/premai-io/text-to-audio-bark-gpu:latest \ - --file ./t2a-bark/docker/gpu/Dockerfile \ + --file ./docker/gpu/Dockerfile \ --tag ghcr.io/premai-io/text-to-audio-bark-gpu:latest \ --tag ghcr.io/premai-io/text-to-audio-bark-gpu:$VERSION \ - ./t2a-bark + . docker run --rm --gpus all ghcr.io/premai-io/text-to-audio-bark-gpu:$VERSION pytest docker buildx build --push \ --cache-from=ghcr.io/premai-io/text-to-audio-bark-cpu:latest \ - --file ./t2a-bark/docker/cpu/Dockerfile \ + --file ./docker/cpu/Dockerfile \ --tag ghcr.io/premai-io/text-to-audio-bark-cpu:latest \ --tag ghcr.io/premai-io/text-to-audio-bark-cpu:$VERSION \ - --platform linux/arm64,linux/amd64 ./t2a-bark + --platform linux/arm64,linux/amd64 . docker run --rm ghcr.io/premai-io/text-to-audio-bark-cpu:$VERSION pytest From 2cb9bc7bcb2775135b67ce3f6c75326b492d4b02 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Mon, 24 Jul 2023 19:50:27 +0100 Subject: [PATCH 02/25] fix pre-existing bugs --- cdr-replit/build.sh | 2 +- cdr-t5/build.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cdr-replit/build.sh b/cdr-replit/build.sh index 6dfcf11..aebe19f 100755 --- a/cdr-replit/build.sh +++ b/cdr-replit/build.sh @@ -6,7 +6,7 @@ export VERSION=1.0.0 docker buildx build --push \ --cache-from ghcr.io/premai-io/coder-replit-code-v1-3b-gpu:latest \ - --file ./cpl-replit/docker/gpu/Dockerfile \ + --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=replit/replit-code-v1-3b" \ --tag ghcr.io/premai-io/coder-replit-code-v1-3b-gpu:latest \ --tag ghcr.io/premai-io/coder-replit-code-v1-3b-gpu:$VERSION \ diff --git a/cdr-t5/build.sh b/cdr-t5/build.sh index 3eb536e..1d18585 100755 --- a/cdr-t5/build.sh +++ b/cdr-t5/build.sh @@ -6,7 +6,7 @@ export VERSION=1.0.0 docker buildx build --push \ --cache-from ghcr.io/premai-io/coder-codet5p-220m-py-cpu:latest \ - --file ./cpl-t5/docker/cpu/Dockerfile \ + --file ./docker/cpu/Dockerfile \ --build-arg="MODEL_ID=Salesforce/codet5p-220m-py" \ --tag ghcr.io/premai-io/coder-codet5p-220m-py-cpu:latest \ --tag ghcr.io/premai-io/coder-codet5p-220m-py-cpu:$VERSION \ From 4db2a2ee62b2af5b2e8e441d28efe80efe3cd737 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Mon, 24 Jul 2023 19:53:32 +0100 Subject: [PATCH 03/25] fast-fail build/tests --- ebd-all-minilm/build.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ebd-all-minilm/build.sh b/ebd-all-minilm/build.sh index d15c54c..b8e43b5 100755 --- a/ebd-all-minilm/build.sh +++ b/ebd-all-minilm/build.sh @@ -11,6 +11,7 @@ docker buildx build --push \ --tag ghcr.io/premai-io/embeddings-all-minilm-l6-v2-cpu:latest \ --tag ghcr.io/premai-io/embeddings-all-minilm-l6-v2-cpu:$VERSION \ --platform linux/arm64,linux/amd64 . +docker run --rm ghcr.io/premai-io/embeddings-all-minilm-l6-v2-cpu:$VERSION pytest docker buildx build --push \ --cache-from ghcr.io/premai-io/embeddings-all-minilm-l6-v2-gpu:latest \ @@ -19,6 +20,4 @@ docker buildx build --push \ --tag ghcr.io/premai-io/embeddings-all-minilm-l6-v2-gpu:latest \ --tag ghcr.io/premai-io/embeddings-all-minilm-l6-v2-gpu:$VERSION \ . - -docker run --rm ghcr.io/premai-io/embeddings-all-minilm-l6-v2-cpu:$VERSION pytest docker run --rm --gpus all ghcr.io/premai-io/embeddings-all-minilm-l6-v2-gpu:$VERSION pytest From 1347c0b3bef574c4e3445ecf681c3ef68a479ca5 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Mon, 24 Jul 2023 19:55:47 +0100 Subject: [PATCH 04/25] remove unused filename --- pytest.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytest.ini b/pytest.ini index 3af9058..0ee949b 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,2 +1,2 @@ [pytest] -python_files = tests.py test_*.py +python_files = test_*.py From d57b5a77fb0b37be7e0d01b6f1b34feae978b014 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Mon, 24 Jul 2023 20:38:27 +0100 Subject: [PATCH 05/25] build.sh --flags support --- a2t-whisper/build.sh | 4 ++-- cdr-replit/build.sh | 2 +- cdr-t5/build.sh | 2 +- cht-dolly-v2/build.sh | 2 +- cht-falcon/build.sh | 2 +- cht-gorilla/build.sh | 4 ++-- cht-llama-cpp/build.sh | 4 ++-- cht-mpt/build.sh | 6 +++--- cht-xgen/build.sh | 2 +- dfs-dalle/build.sh | 2 +- dfs-diffusers/build.sh | 10 +++++----- ebd-all-minilm/build.sh | 4 ++-- t2a-bark/build.sh | 4 ++-- 13 files changed, 24 insertions(+), 24 deletions(-) diff --git a/a2t-whisper/build.sh b/a2t-whisper/build.sh index 7f669f8..53e7e55 100755 --- a/a2t-whisper/build.sh +++ b/a2t-whisper/build.sh @@ -4,7 +4,7 @@ set -e export VERSION=1.0.1 -docker buildx build --push \ +docker buildx build ${@:1} \ --cache-from ghcr.io/premai-io/audio-to-text-whisper-tiny-cpu:latest \ --file ./docker/cpu/Dockerfile \ --build-arg="MODEL_ID=tiny" \ @@ -14,7 +14,7 @@ docker buildx build --push \ docker run --rm ghcr.io/premai-io/audio-to-text-whisper-tiny-cpu:$VERSION pytest -docker buildx build --push \ +docker buildx build ${@:1} \ --cache-from ghcr.io/premai-io/audio-to-text-whisper-large-v2-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=large-v2" \ diff --git a/cdr-replit/build.sh b/cdr-replit/build.sh index aebe19f..272b8fc 100755 --- a/cdr-replit/build.sh +++ b/cdr-replit/build.sh @@ -4,7 +4,7 @@ set -e export VERSION=1.0.0 -docker buildx build --push \ +docker buildx build ${@:1} \ --cache-from ghcr.io/premai-io/coder-replit-code-v1-3b-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=replit/replit-code-v1-3b" \ diff --git a/cdr-t5/build.sh b/cdr-t5/build.sh index 1d18585..c70740a 100755 --- a/cdr-t5/build.sh +++ b/cdr-t5/build.sh @@ -4,7 +4,7 @@ set -e export VERSION=1.0.0 -docker buildx build --push \ +docker buildx build ${@:1} \ --cache-from ghcr.io/premai-io/coder-codet5p-220m-py-cpu:latest \ --file ./docker/cpu/Dockerfile \ --build-arg="MODEL_ID=Salesforce/codet5p-220m-py" \ diff --git a/cht-dolly-v2/build.sh b/cht-dolly-v2/build.sh index 37882cb..03e33c6 100755 --- a/cht-dolly-v2/build.sh +++ b/cht-dolly-v2/build.sh @@ -4,7 +4,7 @@ set -e export VERSION=1.0.3 -docker buildx build --push \ +docker buildx build ${@:1} \ --cache-from ghcr.io/premai-io/chat-dolly-v2-12b-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=databricks/dolly-v2-12b" \ diff --git a/cht-falcon/build.sh b/cht-falcon/build.sh index f774ca8..ef64db6 100755 --- a/cht-falcon/build.sh +++ b/cht-falcon/build.sh @@ -4,7 +4,7 @@ set -e export VERSION=1.0.0 -docker buildx build --push \ +docker buildx build ${@:1} \ --cache-from ghcr.io/premai-io/chat-falcon-7b-instruct-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=tiiuae/falcon-7b-instruct" \ diff --git a/cht-gorilla/build.sh b/cht-gorilla/build.sh index f59a773..597ed7e 100755 --- a/cht-gorilla/build.sh +++ b/cht-gorilla/build.sh @@ -6,7 +6,7 @@ export VERSION=1.0.0 echo "Build, push and test gorilla falcon" -docker buildx build --push \ +docker buildx build ${@:1} \ --cache-from ghcr.io/premai-io/chat-gorilla-falcon-7b-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=gorilla-llm/gorilla-falcon-7b-hf-v0" \ @@ -18,7 +18,7 @@ docker run -e MODEL_ID=gorilla-llm/gorilla-falcon-7b-hf-v0 --gpus all ghcr.io/pr echo "Build, push and test gorilla mpt" -docker buildx build --push \ +docker buildx build ${@:1} \ --cache-from ghcr.io/premai-io/chat-gorilla-mpt-7b-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=gorilla-llm/gorilla-mpt-7b-hf-v0" \ diff --git a/cht-llama-cpp/build.sh b/cht-llama-cpp/build.sh index 98ff2a5..79b6952 100755 --- a/cht-llama-cpp/build.sh +++ b/cht-llama-cpp/build.sh @@ -4,7 +4,7 @@ set -e export VERSION=1.0.4 -docker buildx build --push \ +docker buildx build ${@:1} \ --cache-from ghcr.io/premai-io/chat-gpt4all-lora-q4-cpu:latest \ --file ./docker/cpu/Dockerfile \ --build-arg="MODEL_ID=gpt4all-lora-q4" \ @@ -12,7 +12,7 @@ docker buildx build --push \ --tag ghcr.io/premai-io/chat-gpt4all-lora-q4-cpu:$VERSION \ --platform linux/arm64,linux/amd64 . -docker buildx build --push \ +docker buildx build ${@:1} \ --cache-from ghcr.io/premai-io/chat-vicuna-7b-q4-cpu:latest \ --file ./docker/cpu/Dockerfile \ --build-arg="MODEL_ID=vicuna-7b-q4" \ diff --git a/cht-mpt/build.sh b/cht-mpt/build.sh index 5f7d7d7..3a3b346 100755 --- a/cht-mpt/build.sh +++ b/cht-mpt/build.sh @@ -4,7 +4,7 @@ set -e export VERSION=1.0.0 -docker buildx build --push \ +docker buildx build ${@:1} \ --cache-from ghcr.io/premai-io/chat-mpt-7b-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=mosaicml/mpt-7b-chat" \ @@ -12,7 +12,7 @@ docker buildx build --push \ --tag ghcr.io/premai-io/chat-mpt-7b-gpu:$VERSION \ . -docker buildx build --push \ +docker buildx build ${@:1} \ --cache-from ghcr.io/premai-io/mpt-7b-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=mosaicml/mpt-7b" \ @@ -20,7 +20,7 @@ docker buildx build --push \ --tag ghcr.io/premai-io/mpt-7b-gpu:$VERSION \ . -docker buildx build --push \ +docker buildx build ${@:1} \ --cache-from ghcr.io/premai-io/mpt-7b-instruct-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=mosaicml/mpt-7b-instruct" \ diff --git a/cht-xgen/build.sh b/cht-xgen/build.sh index 2e1fbb8..db7bb9b 100755 --- a/cht-xgen/build.sh +++ b/cht-xgen/build.sh @@ -4,7 +4,7 @@ set -e export VERSION=1.0.0 -docker buildx build --push \ +docker buildx build ${@:1} \ --cache-from ghcr.io/premai-io/chat-xgen-7b-8k-inst-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=Salesforce/xgen-7b-8k-inst" \ diff --git a/dfs-dalle/build.sh b/dfs-dalle/build.sh index 9c6255e..f7e238c 100755 --- a/dfs-dalle/build.sh +++ b/dfs-dalle/build.sh @@ -4,7 +4,7 @@ set -e export VERSION=1.0.0 -docker buildx build --push \ +docker buildx build ${@:1} \ --cache-from=ghcr.io/premai-io/diffuser-dalle-mini-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="DALLE_MODEL_ID=dalle-mini/dalle-mini" \ diff --git a/dfs-diffusers/build.sh b/dfs-diffusers/build.sh index c2e1feb..85e5e51 100755 --- a/dfs-diffusers/build.sh +++ b/dfs-diffusers/build.sh @@ -4,7 +4,7 @@ set -e export VERSION=1.0.3 -docker buildx build --push \ +docker buildx build ${@:1} \ --cache-from=ghcr.io/premai-io/diffuser-stable-diffusion-2-1-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=stabilityai/stable-diffusion-2-1" \ @@ -12,7 +12,7 @@ docker buildx build --push \ --tag ghcr.io/premai-io/diffuser-stable-diffusion-2-1-gpu:$VERSION \ . -docker buildx build --push \ +docker buildx build ${@:1} \ --cache-from=ghcr.io/premai-io/diffuser-stable-diffusion-1-5-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=runwayml/stable-diffusion-v1-5" \ @@ -20,7 +20,7 @@ docker buildx build --push \ --tag ghcr.io/premai-io/diffuser-stable-diffusion-1-5-gpu:$VERSION \ . -docker buildx build --push \ +docker buildx build ${@:1} \ --cache-from=ghcr.io/premai-io/diffuser-stable-diffusion-2-base-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=stabilityai/stable-diffusion-2" \ @@ -30,7 +30,7 @@ docker buildx build --push \ # docker system prune --all --force --volumes -docker buildx build --push \ +docker buildx build ${@:1} \ --cache-from=ghcr.io/premai-io/upscaler-stable-diffusion-x4-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=stabilityai/stable-diffusion-x4-upscaler" \ @@ -38,7 +38,7 @@ docker buildx build --push \ --tag ghcr.io/premai-io/upscaler-stable-diffusion-x4-gpu:$VERSION \ . -docker buildx build --push \ +docker buildx build ${@:1} \ --cache-from=ghcr.io/premai-io/upscaler-stable-diffusion-x2-latent-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=stabilityai/sd-x2-latent-upscaler" \ diff --git a/ebd-all-minilm/build.sh b/ebd-all-minilm/build.sh index b8e43b5..cc539cf 100755 --- a/ebd-all-minilm/build.sh +++ b/ebd-all-minilm/build.sh @@ -4,7 +4,7 @@ set -e export VERSION=1.0.2 -docker buildx build --push \ +docker buildx build ${@:1} \ --cache-from ghcr.io/premai-io/embeddings-all-minilm-l6-v2-cpu:latest \ --file ./docker/cpu/Dockerfile \ --build-arg="MODEL_ID=all-MiniLM-L6-v2" \ @@ -13,7 +13,7 @@ docker buildx build --push \ --platform linux/arm64,linux/amd64 . docker run --rm ghcr.io/premai-io/embeddings-all-minilm-l6-v2-cpu:$VERSION pytest -docker buildx build --push \ +docker buildx build ${@:1} \ --cache-from ghcr.io/premai-io/embeddings-all-minilm-l6-v2-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=all-MiniLM-L6-v2" \ diff --git a/t2a-bark/build.sh b/t2a-bark/build.sh index c80b457..80906b7 100755 --- a/t2a-bark/build.sh +++ b/t2a-bark/build.sh @@ -4,7 +4,7 @@ set -e export VERSION=1.0.0 -docker buildx build --push \ +docker buildx build ${@:1} \ --cache-from=ghcr.io/premai-io/text-to-audio-bark-gpu:latest \ --file ./docker/gpu/Dockerfile \ --tag ghcr.io/premai-io/text-to-audio-bark-gpu:latest \ @@ -13,7 +13,7 @@ docker buildx build --push \ docker run --rm --gpus all ghcr.io/premai-io/text-to-audio-bark-gpu:$VERSION pytest -docker buildx build --push \ +docker buildx build ${@:1} \ --cache-from=ghcr.io/premai-io/text-to-audio-bark-cpu:latest \ --file ./docker/cpu/Dockerfile \ --tag ghcr.io/premai-io/text-to-audio-bark-cpu:latest \ From 3853021e2c95887155c1dd54cf814880e05643df Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Mon, 24 Jul 2023 21:26:32 +0100 Subject: [PATCH 06/25] purge blank READMEs --- a2t-whisper/README.md | 0 cdr-replit/README.md | 1 - cdr-t5/README.md | 0 cht-dolly-v2/README.md | 1 - cht-falcon/README.md | 1 - cht-gorilla/README.md | 1 - cht-llama-cpp/README.md | 1 - cht-mpt/README.md | 1 - cht-xgen/README.md | 1 - dfs-dalle/README.md | 0 dfs-diffusers/README.md | 0 ebd-all-minilm/README.md | 0 t2a-bark/README.md | 0 13 files changed, 7 deletions(-) delete mode 100644 a2t-whisper/README.md delete mode 100644 cdr-replit/README.md delete mode 100644 cdr-t5/README.md delete mode 100644 cht-dolly-v2/README.md delete mode 100644 cht-falcon/README.md delete mode 100644 cht-gorilla/README.md delete mode 100644 cht-llama-cpp/README.md delete mode 100644 cht-mpt/README.md delete mode 100644 cht-xgen/README.md delete mode 100644 dfs-dalle/README.md delete mode 100644 dfs-diffusers/README.md delete mode 100644 ebd-all-minilm/README.md delete mode 100644 t2a-bark/README.md diff --git a/a2t-whisper/README.md b/a2t-whisper/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/cdr-replit/README.md b/cdr-replit/README.md deleted file mode 100644 index fec5601..0000000 --- a/cdr-replit/README.md +++ /dev/null @@ -1 +0,0 @@ -# Hello diff --git a/cdr-t5/README.md b/cdr-t5/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/cht-dolly-v2/README.md b/cht-dolly-v2/README.md deleted file mode 100644 index fec5601..0000000 --- a/cht-dolly-v2/README.md +++ /dev/null @@ -1 +0,0 @@ -# Hello diff --git a/cht-falcon/README.md b/cht-falcon/README.md deleted file mode 100644 index fec5601..0000000 --- a/cht-falcon/README.md +++ /dev/null @@ -1 +0,0 @@ -# Hello diff --git a/cht-gorilla/README.md b/cht-gorilla/README.md deleted file mode 100644 index fec5601..0000000 --- a/cht-gorilla/README.md +++ /dev/null @@ -1 +0,0 @@ -# Hello diff --git a/cht-llama-cpp/README.md b/cht-llama-cpp/README.md deleted file mode 100644 index fec5601..0000000 --- a/cht-llama-cpp/README.md +++ /dev/null @@ -1 +0,0 @@ -# Hello diff --git a/cht-mpt/README.md b/cht-mpt/README.md deleted file mode 100644 index fec5601..0000000 --- a/cht-mpt/README.md +++ /dev/null @@ -1 +0,0 @@ -# Hello diff --git a/cht-xgen/README.md b/cht-xgen/README.md deleted file mode 100644 index fec5601..0000000 --- a/cht-xgen/README.md +++ /dev/null @@ -1 +0,0 @@ -# Hello diff --git a/dfs-dalle/README.md b/dfs-dalle/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/dfs-diffusers/README.md b/dfs-diffusers/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/ebd-all-minilm/README.md b/ebd-all-minilm/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/t2a-bark/README.md b/t2a-bark/README.md deleted file mode 100644 index e69de29..0000000 From d5d72121f38a09ae1937893eed960f3f83cca14d Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Mon, 24 Jul 2023 21:26:51 +0100 Subject: [PATCH 07/25] tests: bump pre-commit --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7a7b377..bef1f9a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,7 +16,7 @@ repos: - id: check-case-conflict - repo: https://github.com/psf/black - rev: 23.1.0 + rev: 23.7.0 hooks: - id: black From a8842af7c26794219e846531f80f0fc942572c84 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Mon, 24 Jul 2023 21:30:38 +0100 Subject: [PATCH 08/25] tests: add more pre-commit hooks --- .pre-commit-config.yaml | 63 ++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bef1f9a..7a96c72 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,37 +1,36 @@ -exclude: "^docs/|/migrations/" default_stages: [commit] - repos: - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 - hooks: - - id: trailing-whitespace - - id: end-of-file-fixer - - id: check-yaml - - id: end-of-file-fixer - - id: check-toml - - id: check-xml - - id: debug-statements - - id: check-builtin-literals - - id: check-case-conflict - - - repo: https://github.com/psf/black - rev: 23.7.0 - hooks: - - id: black - - - repo: https://github.com/PyCQA/isort - rev: 5.12.0 - hooks: - - id: isort - - - repo: https://github.com/PyCQA/flake8 - rev: 6.0.0 - hooks: - - id: flake8 - args: ["--config=setup.cfg"] - additional_dependencies: [flake8-isort] - +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: check-added-large-files + - id: check-builtin-literals + - id: check-case-conflict + - id: check-docstring-first + - id: check-executables-have-shebangs + - id: check-merge-conflict + - id: check-toml + - id: check-xml + - id: check-yaml + - id: debug-statements + - id: end-of-file-fixer + - id: mixed-line-ending + - id: sort-simple-yaml + - id: trailing-whitespace +- repo: https://github.com/psf/black + rev: 23.7.0 + hooks: + - id: black +- repo: https://github.com/PyCQA/isort + rev: 5.12.0 + hooks: + - id: isort +- repo: https://github.com/PyCQA/flake8 + rev: 6.0.0 + hooks: + - id: flake8 + args: ["--config=setup.cfg"] + additional_dependencies: [flake8-isort] ci: autoupdate_schedule: weekly skip: [] From 3df6a53c2b76a892561eac172a6de51d056f3e02 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Mon, 24 Jul 2023 21:39:18 +0100 Subject: [PATCH 09/25] flake8: add more checks, fix some errors --- .pre-commit-config.yaml | 8 +++++++- cht-llama-cpp/models.py | 7 +++++-- dfs-diffusers/routes.py | 12 ++++++------ 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7a96c72..a4592d1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,7 +30,13 @@ repos: hooks: - id: flake8 args: ["--config=setup.cfg"] - additional_dependencies: [flake8-isort] + additional_dependencies: + - flake8-broken-line + - flake8-bugbear + - flake8-comprehensions + - flake8-debugger + - flake8-isort + - flake8-string-format ci: autoupdate_schedule: weekly skip: [] diff --git a/cht-llama-cpp/models.py b/cht-llama-cpp/models.py index 53a5be1..b355ea1 100644 --- a/cht-llama-cpp/models.py +++ b/cht-llama-cpp/models.py @@ -7,6 +7,7 @@ "gpt4all-lora-q4": {"modelWeightsName": "gpt4all-lora-q4.bin", "ctxMaxTokens": 512}, "vicuna-7b-q4": {"modelWeightsName": "vicuna-7b-q4.bin", "ctxMaxTokens": 512}, } +DEFAULT_N_THREADS = max(multiprocessing.cpu_count() // 2, 1) def get_model_info() -> dict: @@ -43,10 +44,12 @@ def generate( n: int = 1, stream: bool = False, max_tokens: int = 256, - stop: list = [], - n_threads: int = max(multiprocessing.cpu_count() // 2, 1), + stop: list = None, + n_threads: int = DEFAULT_N_THREADS, **kwargs, ): + if stop is None: + stop = [] messages = cls.reduce_number_of_messages(messages[::-1], max_tokens)[::-1] cls.model.n_threads = n_threads return cls.model.create_chat_completion( diff --git a/dfs-diffusers/routes.py b/dfs-diffusers/routes.py index e8f0a57..f2fcb95 100644 --- a/dfs-diffusers/routes.py +++ b/dfs-diffusers/routes.py @@ -15,7 +15,7 @@ def as_form(cls: Type[BaseModel]): """ new_parameters = [] - for field_name, model_field in cls.__fields__.items(): + for model_field in cls.__fields__.values(): model_field: ModelField # type: ignore new_parameters.append( @@ -35,7 +35,7 @@ async def as_form_func(**data): sig = inspect.signature(as_form_func) sig = sig.replace(parameters=new_parameters) as_form_func.__signature__ = sig # type: ignore - setattr(cls, "as_form", as_form_func) + cls.as_form = as_form_func return cls @@ -98,8 +98,8 @@ async def images_generations(body: ImageGenerationInput): @router.post("/images/edits", response_model=ImageGenerationResponse) async def images_edits( - image: UploadFile = File(...), - body: ImageEditInput = Depends(ImageEditInput.as_form), + image: UploadFile = File(...), # noqa:B008 + body: ImageEditInput = Depends(ImageEditInput.as_form), # noqa:B008 ): images = model.generate( prompt=body.prompt, @@ -117,8 +117,8 @@ async def images_edits( @router.post("/images/upscale", response_model=ImageGenerationResponse) async def images_upscale( - image: UploadFile = File(...), - body: ImageEditInput = Depends(ImageEditInput.as_form), + image: UploadFile = File(...), # noqa:B008 + body: ImageEditInput = Depends(ImageEditInput.as_form), # noqa:B008 ): images = model.upscale( prompt=body.prompt, From 798a45d46fefb4934cc9b7037f15a99fc20d4f70 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Mon, 24 Jul 2023 21:52:50 +0100 Subject: [PATCH 10/25] unify & sanitise config migrate to pyproject.toml from setup.cfg & pytest.ini --- .pre-commit-config.yaml | 2 +- pyproject.toml | 17 +++++++++++++++++ pytest.ini | 2 -- setup.cfg | 30 ------------------------------ 4 files changed, 18 insertions(+), 33 deletions(-) create mode 100644 pyproject.toml delete mode 100644 pytest.ini delete mode 100644 setup.cfg diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a4592d1..ef73da5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,13 +29,13 @@ repos: rev: 6.0.0 hooks: - id: flake8 - args: ["--config=setup.cfg"] additional_dependencies: - flake8-broken-line - flake8-bugbear - flake8-comprehensions - flake8-debugger - flake8-isort + - flake8-pyproject - flake8-string-format ci: autoupdate_schedule: weekly diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..b62b8cf --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,17 @@ +[tool.flake8] +max_line_length = 99 + +[tool.isort] +profile = "black" + +[tool.mypy] +check_untyped_defs = true +ignore_missing_imports = true +warn_unused_ignores = true +warn_redundant_casts = true +warn_unused_configs = true +show_error_codes = true + +[tool.pytest.ini_options] +minversion = "6.0" +python_files = ["test_*.py"] diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index 0ee949b..0000000 --- a/pytest.ini +++ /dev/null @@ -1,2 +0,0 @@ -[pytest] -python_files = test_*.py diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index c150542..0000000 --- a/setup.cfg +++ /dev/null @@ -1,30 +0,0 @@ -[flake8] -max-line-length = 120 -exclude = .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules,venv - -[pycodestyle] -max-line-length = 120 -exclude = .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules,venv - -[isort] -line_length = 88 -known_first_party = app -multi_line_output = 3 -default_section = THIRDPARTY -skip = venv/ -skip_glob = **/migrations/*.py -include_trailing_comma = true -force_grid_wrap = 0 -use_parentheses = true - -[mypy] -python_version = 3.9 -check_untyped_defs = True -ignore_missing_imports = True -warn_unused_ignores = True -warn_redundant_casts = True -warn_unused_configs = True - -[coverage:run] -include = app/* -omit = *migrations*, *tests* From f717e766057640cbf22d500706ad6dcc1c288784 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Mon, 24 Jul 2023 21:57:37 +0100 Subject: [PATCH 11/25] ci: add docker builds - drop pre-commit action - add path-based docker rebuilds --- .github/workflows/ci.yml | 60 +++++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 986c939..43b4488 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,28 +1,44 @@ name: CI - -env: - DOCKER_BUILDKIT: 1 - DOCKER_CLI_EXPERIMENTAL: "enabled" - COMPOSE_DOCKER_CLI_BUILD: 1 - on: - pull_request: - branches: ["main"] - push: - branches: ["main"] - + pull_request: jobs: - linter: + models: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - id: list + name: List modified models + run: | + echo "modified=$( + for model in $(ls -d *-*); do + git diff --quiet HEAD~1 -- $model || echo $model + done | jq -Rsc 'split("\n")[:-1]' + )" >> $GITHUB_OUTPUT + outputs: + modified: ${{ steps.list.outputs.modified }} + build-test-push: + needs: [models] runs-on: ubuntu-latest + strategy: + matrix: + model: ${{ fromJson(needs.models.outputs.modified) }} + env: + VERSION: '1.0.0' + DOCKER_BUILDKIT: 1 + DOCKER_CLI_EXPERIMENTAL: enabled + COMPOSE_DOCKER_CLI_BUILD: 1 steps: - - name: Checkout Code Repository - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.10" - - - name: Run pre-commit - uses: pre-commit/action@v3.0.0 + - uses: actions/checkout@v3 + - uses: docker/setup-qemu-action@v2 + - uses: docker/setup-buildx-action@v2 + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - run: ./build.sh ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && '--push' || '--load' }} + working-directory: ${{ matrix.model }} From 5f4620e187deb2747e7065c6285059e9a3e067a6 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Tue, 25 Jul 2023 00:14:41 +0100 Subject: [PATCH 12/25] build: drop --cache-from --- a2t-whisper/build.sh | 9 ++------- cdr-replit/build.sh | 4 ---- cdr-t5/build.sh | 7 ++----- cht-dolly-v2/build.sh | 4 ---- cht-falcon/build.sh | 5 +---- cht-gorilla/build.sh | 14 ++------------ cht-llama-cpp/build.sh | 11 ++++------- cht-mpt/build.sh | 8 +------- cht-xgen/build.sh | 5 +---- dfs-dalle/build.sh | 6 +----- dfs-diffusers/build.sh | 7 ------- ebd-all-minilm/build.sh | 7 ++----- t2a-bark/build.sh | 9 ++------- 13 files changed, 18 insertions(+), 78 deletions(-) diff --git a/a2t-whisper/build.sh b/a2t-whisper/build.sh index 53e7e55..19b3ef9 100755 --- a/a2t-whisper/build.sh +++ b/a2t-whisper/build.sh @@ -1,25 +1,20 @@ #!/bin/bash - set -e - export VERSION=1.0.1 docker buildx build ${@:1} \ - --cache-from ghcr.io/premai-io/audio-to-text-whisper-tiny-cpu:latest \ --file ./docker/cpu/Dockerfile \ --build-arg="MODEL_ID=tiny" \ --tag ghcr.io/premai-io/audio-to-text-whisper-tiny-cpu:latest \ --tag ghcr.io/premai-io/audio-to-text-whisper-tiny-cpu:$VERSION \ - --platform linux/arm64,linux/amd64 . - + --platform linux/arm64,linux/amd64 \ + . docker run --rm ghcr.io/premai-io/audio-to-text-whisper-tiny-cpu:$VERSION pytest docker buildx build ${@:1} \ - --cache-from ghcr.io/premai-io/audio-to-text-whisper-large-v2-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=large-v2" \ --tag ghcr.io/premai-io/audio-to-text-whisper-large-v2-gpu:latest \ --tag ghcr.io/premai-io/audio-to-text-whisper-large-v2-gpu:$VERSION \ . - docker run --rm ghcr.io/premai-io/audio-to-text-whisper-large-v2-gpu:$VERSION pytest diff --git a/cdr-replit/build.sh b/cdr-replit/build.sh index 272b8fc..7330cfd 100755 --- a/cdr-replit/build.sh +++ b/cdr-replit/build.sh @@ -1,15 +1,11 @@ #!/bin/bash - set -e - export VERSION=1.0.0 docker buildx build ${@:1} \ - --cache-from ghcr.io/premai-io/coder-replit-code-v1-3b-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=replit/replit-code-v1-3b" \ --tag ghcr.io/premai-io/coder-replit-code-v1-3b-gpu:latest \ --tag ghcr.io/premai-io/coder-replit-code-v1-3b-gpu:$VERSION \ . - docker run --rm --gpus all ghcr.io/premai-io/coder-replit-code-v1-3b-gpu:$VERSION pytest diff --git a/cdr-t5/build.sh b/cdr-t5/build.sh index c70740a..c12d881 100755 --- a/cdr-t5/build.sh +++ b/cdr-t5/build.sh @@ -1,15 +1,12 @@ #!/bin/bash - set -e - export VERSION=1.0.0 docker buildx build ${@:1} \ - --cache-from ghcr.io/premai-io/coder-codet5p-220m-py-cpu:latest \ --file ./docker/cpu/Dockerfile \ --build-arg="MODEL_ID=Salesforce/codet5p-220m-py" \ --tag ghcr.io/premai-io/coder-codet5p-220m-py-cpu:latest \ --tag ghcr.io/premai-io/coder-codet5p-220m-py-cpu:$VERSION \ - --platform linux/amd64 . - + --platform linux/amd64 \ + . docker run --rm ghcr.io/premai-io/coder-codet5p-220m-py-cpu:$VERSION pytest diff --git a/cht-dolly-v2/build.sh b/cht-dolly-v2/build.sh index 03e33c6..0b49925 100755 --- a/cht-dolly-v2/build.sh +++ b/cht-dolly-v2/build.sh @@ -1,15 +1,11 @@ #!/bin/bash - set -e - export VERSION=1.0.3 docker buildx build ${@:1} \ - --cache-from ghcr.io/premai-io/chat-dolly-v2-12b-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=databricks/dolly-v2-12b" \ --tag ghcr.io/premai-io/chat-dolly-v2-12b-gpu:latest \ --tag ghcr.io/premai-io/chat-dolly-v2-12b-gpu:$VERSION \ . - docker run --gpus all ghcr.io/premai-io/chat-dolly-v2-12b-gpu:$VERSION pytest diff --git a/cht-falcon/build.sh b/cht-falcon/build.sh index ef64db6..2561c3b 100755 --- a/cht-falcon/build.sh +++ b/cht-falcon/build.sh @@ -1,14 +1,11 @@ #!/bin/bash - set -e - export VERSION=1.0.0 docker buildx build ${@:1} \ - --cache-from ghcr.io/premai-io/chat-falcon-7b-instruct-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=tiiuae/falcon-7b-instruct" \ --tag ghcr.io/premai-io/chat-falcon-7b-instruct-gpu:latest \ --tag ghcr.io/premai-io/chat-falcon-7b-instruct-gpu:$VERSION \ . -docker run --gpus all ghcr.io/premai-io/chat-falcon-7b-instruct-gpu:latest pytest +docker run --gpus all ghcr.io/premai-io/chat-falcon-7b-instruct-gpu:$VERSION pytest diff --git a/cht-gorilla/build.sh b/cht-gorilla/build.sh index 597ed7e..0527f35 100755 --- a/cht-gorilla/build.sh +++ b/cht-gorilla/build.sh @@ -1,29 +1,19 @@ #!/bin/bash - set -e - export VERSION=1.0.0 -echo "Build, push and test gorilla falcon" - docker buildx build ${@:1} \ - --cache-from ghcr.io/premai-io/chat-gorilla-falcon-7b-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=gorilla-llm/gorilla-falcon-7b-hf-v0" \ --tag ghcr.io/premai-io/chat-gorilla-falcon-7b-gpu:latest \ --tag ghcr.io/premai-io/chat-gorilla-falcon-7b-gpu:$VERSION \ . - -docker run -e MODEL_ID=gorilla-llm/gorilla-falcon-7b-hf-v0 --gpus all ghcr.io/premai-io/chat-gorilla-falcon-7b-gpu:latest pytest - -echo "Build, push and test gorilla mpt" +docker run --gpus all ghcr.io/premai-io/chat-gorilla-falcon-7b-gpu:$VERSION pytest docker buildx build ${@:1} \ - --cache-from ghcr.io/premai-io/chat-gorilla-mpt-7b-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=gorilla-llm/gorilla-mpt-7b-hf-v0" \ --tag ghcr.io/premai-io/chat-gorilla-mpt-7b-gpu:latest \ --tag ghcr.io/premai-io/chat-gorilla-mpt-7b-gpu:$VERSION \ . - -docker run -e MODEL_ID=gorilla-llm/gorilla-mpt-7b-hf-v0 --gpus all ghcr.io/premai-io/chat-gorilla-mpt-7b-gpu:latest pytest +docker run --gpus all ghcr.io/premai-io/chat-gorilla-mpt-7b-gpu:$VERSION pytest diff --git a/cht-llama-cpp/build.sh b/cht-llama-cpp/build.sh index 79b6952..647f5ac 100755 --- a/cht-llama-cpp/build.sh +++ b/cht-llama-cpp/build.sh @@ -1,23 +1,20 @@ #!/bin/bash - set -e - export VERSION=1.0.4 docker buildx build ${@:1} \ - --cache-from ghcr.io/premai-io/chat-gpt4all-lora-q4-cpu:latest \ --file ./docker/cpu/Dockerfile \ --build-arg="MODEL_ID=gpt4all-lora-q4" \ --tag ghcr.io/premai-io/chat-gpt4all-lora-q4-cpu:latest \ --tag ghcr.io/premai-io/chat-gpt4all-lora-q4-cpu:$VERSION \ - --platform linux/arm64,linux/amd64 . + --platform linux/arm64,linux/amd64 \ + . docker buildx build ${@:1} \ - --cache-from ghcr.io/premai-io/chat-vicuna-7b-q4-cpu:latest \ --file ./docker/cpu/Dockerfile \ --build-arg="MODEL_ID=vicuna-7b-q4" \ --tag ghcr.io/premai-io/chat-vicuna-7b-q4-cpu:latest \ --tag ghcr.io/premai-io/chat-vicuna-7b-q4-cpu:$VERSION \ - --platform linux/arm64,linux/amd64 . - + --platform linux/arm64,linux/amd64 \ + . docker run --rm ghcr.io/premai-io/chat-vicuna-7b-q4-cpu:$VERSION pytest diff --git a/cht-mpt/build.sh b/cht-mpt/build.sh index 3a3b346..5ed709a 100755 --- a/cht-mpt/build.sh +++ b/cht-mpt/build.sh @@ -1,19 +1,16 @@ #!/bin/bash - set -e - export VERSION=1.0.0 docker buildx build ${@:1} \ - --cache-from ghcr.io/premai-io/chat-mpt-7b-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=mosaicml/mpt-7b-chat" \ --tag ghcr.io/premai-io/chat-mpt-7b-gpu:latest \ --tag ghcr.io/premai-io/chat-mpt-7b-gpu:$VERSION \ . +docker run --gpus all ghcr.io/premai-io/chat-mpt-7b-gpu:$VERSION pytest docker buildx build ${@:1} \ - --cache-from ghcr.io/premai-io/mpt-7b-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=mosaicml/mpt-7b" \ --tag ghcr.io/premai-io/mpt-7b-gpu:latest \ @@ -21,11 +18,8 @@ docker buildx build ${@:1} \ . docker buildx build ${@:1} \ - --cache-from ghcr.io/premai-io/mpt-7b-instruct-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=mosaicml/mpt-7b-instruct" \ --tag ghcr.io/premai-io/mpt-7b-instruct-gpu:latest \ --tag ghcr.io/premai-io/mpt-7b-instruct-gpu:$VERSION \ . - -docker run --gpus all ghcr.io/premai-io/chat-mpt-7b-gpu:latest pytest diff --git a/cht-xgen/build.sh b/cht-xgen/build.sh index db7bb9b..36da2db 100755 --- a/cht-xgen/build.sh +++ b/cht-xgen/build.sh @@ -1,14 +1,11 @@ #!/bin/bash - set -e - export VERSION=1.0.0 docker buildx build ${@:1} \ - --cache-from ghcr.io/premai-io/chat-xgen-7b-8k-inst-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=Salesforce/xgen-7b-8k-inst" \ --tag ghcr.io/premai-io/chat-xgen-7b-8k-inst-gpu:latest \ --tag ghcr.io/premai-io/chat-xgen-7b-8k-inst-gpu:$VERSION \ . -docker run --gpus all ghcr.io/premai-io/chat-xgen-7b-8k-inst-gpu:latest pytest +docker run --gpus all ghcr.io/premai-io/chat-xgen-7b-8k-inst-gpu:$VERSION pytest diff --git a/dfs-dalle/build.sh b/dfs-dalle/build.sh index f7e238c..8dd8697 100755 --- a/dfs-dalle/build.sh +++ b/dfs-dalle/build.sh @@ -1,11 +1,8 @@ #!/bin/bash - set -e - export VERSION=1.0.0 docker buildx build ${@:1} \ - --cache-from=ghcr.io/premai-io/diffuser-dalle-mini-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="DALLE_MODEL_ID=dalle-mini/dalle-mini" \ --build-arg="DALLE_REVISION_ID=''" \ @@ -14,5 +11,4 @@ docker buildx build ${@:1} \ --tag ghcr.io/premai-io/diffuser-dalle-mini-gpu:latest \ --tag ghcr.io/premai-io/diffuser-dalle-mini-gpu:$VERSION \ . - -docker run --rm --gpus all ghcr.io/premai-io/diffuser-dalle-mini-gpu:latest pytest +docker run --rm --gpus all ghcr.io/premai-io/diffuser-dalle-mini-gpu:$VERSION pytest diff --git a/dfs-diffusers/build.sh b/dfs-diffusers/build.sh index 85e5e51..32b2249 100755 --- a/dfs-diffusers/build.sh +++ b/dfs-diffusers/build.sh @@ -1,11 +1,8 @@ #!/bin/bash - set -e - export VERSION=1.0.3 docker buildx build ${@:1} \ - --cache-from=ghcr.io/premai-io/diffuser-stable-diffusion-2-1-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=stabilityai/stable-diffusion-2-1" \ --tag ghcr.io/premai-io/diffuser-stable-diffusion-2-1-gpu:latest \ @@ -13,7 +10,6 @@ docker buildx build ${@:1} \ . docker buildx build ${@:1} \ - --cache-from=ghcr.io/premai-io/diffuser-stable-diffusion-1-5-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=runwayml/stable-diffusion-v1-5" \ --tag ghcr.io/premai-io/diffuser-stable-diffusion-1-5-gpu:latest \ @@ -21,7 +17,6 @@ docker buildx build ${@:1} \ . docker buildx build ${@:1} \ - --cache-from=ghcr.io/premai-io/diffuser-stable-diffusion-2-base-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=stabilityai/stable-diffusion-2" \ --tag ghcr.io/premai-io/diffuser-stable-diffusion-2-gpu:latest \ @@ -31,7 +26,6 @@ docker buildx build ${@:1} \ # docker system prune --all --force --volumes docker buildx build ${@:1} \ - --cache-from=ghcr.io/premai-io/upscaler-stable-diffusion-x4-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=stabilityai/stable-diffusion-x4-upscaler" \ --tag ghcr.io/premai-io/upscaler-stable-diffusion-x4-gpu:latest \ @@ -39,7 +33,6 @@ docker buildx build ${@:1} \ . docker buildx build ${@:1} \ - --cache-from=ghcr.io/premai-io/upscaler-stable-diffusion-x2-latent-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=stabilityai/sd-x2-latent-upscaler" \ --tag ghcr.io/premai-io/upscaler-stable-diffusion-x2-latent-gpu:latest \ diff --git a/ebd-all-minilm/build.sh b/ebd-all-minilm/build.sh index cc539cf..2e3eb5d 100755 --- a/ebd-all-minilm/build.sh +++ b/ebd-all-minilm/build.sh @@ -1,20 +1,17 @@ #!/bin/bash - set -e - export VERSION=1.0.2 docker buildx build ${@:1} \ - --cache-from ghcr.io/premai-io/embeddings-all-minilm-l6-v2-cpu:latest \ --file ./docker/cpu/Dockerfile \ --build-arg="MODEL_ID=all-MiniLM-L6-v2" \ --tag ghcr.io/premai-io/embeddings-all-minilm-l6-v2-cpu:latest \ --tag ghcr.io/premai-io/embeddings-all-minilm-l6-v2-cpu:$VERSION \ - --platform linux/arm64,linux/amd64 . + --platform linux/arm64,linux/amd64 \ + . docker run --rm ghcr.io/premai-io/embeddings-all-minilm-l6-v2-cpu:$VERSION pytest docker buildx build ${@:1} \ - --cache-from ghcr.io/premai-io/embeddings-all-minilm-l6-v2-gpu:latest \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=all-MiniLM-L6-v2" \ --tag ghcr.io/premai-io/embeddings-all-minilm-l6-v2-gpu:latest \ diff --git a/t2a-bark/build.sh b/t2a-bark/build.sh index 80906b7..9f73d57 100755 --- a/t2a-bark/build.sh +++ b/t2a-bark/build.sh @@ -1,23 +1,18 @@ #!/bin/bash - set -e - export VERSION=1.0.0 docker buildx build ${@:1} \ - --cache-from=ghcr.io/premai-io/text-to-audio-bark-gpu:latest \ --file ./docker/gpu/Dockerfile \ --tag ghcr.io/premai-io/text-to-audio-bark-gpu:latest \ --tag ghcr.io/premai-io/text-to-audio-bark-gpu:$VERSION \ . - docker run --rm --gpus all ghcr.io/premai-io/text-to-audio-bark-gpu:$VERSION pytest docker buildx build ${@:1} \ - --cache-from=ghcr.io/premai-io/text-to-audio-bark-cpu:latest \ --file ./docker/cpu/Dockerfile \ --tag ghcr.io/premai-io/text-to-audio-bark-cpu:latest \ --tag ghcr.io/premai-io/text-to-audio-bark-cpu:$VERSION \ - --platform linux/arm64,linux/amd64 . - + --platform linux/arm64,linux/amd64 \ + . docker run --rm ghcr.io/premai-io/text-to-audio-bark-cpu:$VERSION pytest From 3877414492cc5b112e0b1ec6c9fd64e4ef9a1a44 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Tue, 25 Jul 2023 00:34:51 +0100 Subject: [PATCH 13/25] DRY variables --- a2t-whisper/build.sh | 14 ++++++++------ cdr-replit/build.sh | 7 ++++--- cdr-t5/build.sh | 7 ++++--- cht-dolly-v2/build.sh | 7 ++++--- cht-falcon/build.sh | 7 ++++--- cht-gorilla/build.sh | 14 ++++++++------ cht-llama-cpp/build.sh | 12 +++++++----- cht-mpt/build.sh | 17 ++++++++++------- cht-xgen/build.sh | 7 ++++--- dfs-dalle/build.sh | 7 ++++--- dfs-diffusers/build.sh | 25 +++++++++++++++---------- ebd-all-minilm/build.sh | 14 ++++++++------ t2a-bark/build.sh | 16 ++++++++++------ 13 files changed, 90 insertions(+), 64 deletions(-) diff --git a/a2t-whisper/build.sh b/a2t-whisper/build.sh index 19b3ef9..64c5cd3 100755 --- a/a2t-whisper/build.sh +++ b/a2t-whisper/build.sh @@ -2,19 +2,21 @@ set -e export VERSION=1.0.1 +IMAGE=ghcr.io/premai-io/audio-to-text-whisper-tiny-cpu docker buildx build ${@:1} \ --file ./docker/cpu/Dockerfile \ --build-arg="MODEL_ID=tiny" \ - --tag ghcr.io/premai-io/audio-to-text-whisper-tiny-cpu:latest \ - --tag ghcr.io/premai-io/audio-to-text-whisper-tiny-cpu:$VERSION \ + --tag $IMAGE:latest \ + --tag $IMAGE:$VERSION \ --platform linux/arm64,linux/amd64 \ . -docker run --rm ghcr.io/premai-io/audio-to-text-whisper-tiny-cpu:$VERSION pytest +docker run --rm $IMAGE:$VERSION pytest +IMAGE=ghcr.io/premai-io/audio-to-text-whisper-large-v2-gpu docker buildx build ${@:1} \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=large-v2" \ - --tag ghcr.io/premai-io/audio-to-text-whisper-large-v2-gpu:latest \ - --tag ghcr.io/premai-io/audio-to-text-whisper-large-v2-gpu:$VERSION \ + --tag $IMAGE:latest \ + --tag $IMAGE:$VERSION \ . -docker run --rm ghcr.io/premai-io/audio-to-text-whisper-large-v2-gpu:$VERSION pytest +docker run --rm $IMAGE:$VERSION pytest diff --git a/cdr-replit/build.sh b/cdr-replit/build.sh index 7330cfd..712cdc8 100755 --- a/cdr-replit/build.sh +++ b/cdr-replit/build.sh @@ -2,10 +2,11 @@ set -e export VERSION=1.0.0 +IMAGE=ghcr.io/premai-io/coder-replit-code-v1-3b-gpu docker buildx build ${@:1} \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=replit/replit-code-v1-3b" \ - --tag ghcr.io/premai-io/coder-replit-code-v1-3b-gpu:latest \ - --tag ghcr.io/premai-io/coder-replit-code-v1-3b-gpu:$VERSION \ + --tag $IMAGE:latest \ + --tag $IMAGE:$VERSION \ . -docker run --rm --gpus all ghcr.io/premai-io/coder-replit-code-v1-3b-gpu:$VERSION pytest +docker run --rm --gpus all $IMAGE:$VERSION pytest diff --git a/cdr-t5/build.sh b/cdr-t5/build.sh index c12d881..0f7ac47 100755 --- a/cdr-t5/build.sh +++ b/cdr-t5/build.sh @@ -2,11 +2,12 @@ set -e export VERSION=1.0.0 +IMAGE=ghcr.io/premai-io/coder-codet5p-220m-py-cpu docker buildx build ${@:1} \ --file ./docker/cpu/Dockerfile \ --build-arg="MODEL_ID=Salesforce/codet5p-220m-py" \ - --tag ghcr.io/premai-io/coder-codet5p-220m-py-cpu:latest \ - --tag ghcr.io/premai-io/coder-codet5p-220m-py-cpu:$VERSION \ + --tag $IMAGE:latest \ + --tag $IMAGE:$VERSION \ --platform linux/amd64 \ . -docker run --rm ghcr.io/premai-io/coder-codet5p-220m-py-cpu:$VERSION pytest +docker run --rm $IMAGE:$VERSION pytest diff --git a/cht-dolly-v2/build.sh b/cht-dolly-v2/build.sh index 0b49925..ccf0af5 100755 --- a/cht-dolly-v2/build.sh +++ b/cht-dolly-v2/build.sh @@ -2,10 +2,11 @@ set -e export VERSION=1.0.3 +IMAGE=ghcr.io/premai-io/chat-dolly-v2-12b-gpu docker buildx build ${@:1} \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=databricks/dolly-v2-12b" \ - --tag ghcr.io/premai-io/chat-dolly-v2-12b-gpu:latest \ - --tag ghcr.io/premai-io/chat-dolly-v2-12b-gpu:$VERSION \ + --tag $IMAGE:latest \ + --tag $IMAGE:$VERSION \ . -docker run --gpus all ghcr.io/premai-io/chat-dolly-v2-12b-gpu:$VERSION pytest +docker run --gpus all $IMAGE:$VERSION pytest diff --git a/cht-falcon/build.sh b/cht-falcon/build.sh index 2561c3b..a805df5 100755 --- a/cht-falcon/build.sh +++ b/cht-falcon/build.sh @@ -2,10 +2,11 @@ set -e export VERSION=1.0.0 +IMAGE=ghcr.io/premai-io/chat-falcon-7b-instruct-gpu docker buildx build ${@:1} \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=tiiuae/falcon-7b-instruct" \ - --tag ghcr.io/premai-io/chat-falcon-7b-instruct-gpu:latest \ - --tag ghcr.io/premai-io/chat-falcon-7b-instruct-gpu:$VERSION \ + --tag $IMAGE:latest \ + --tag $IMAGE:$VERSION \ . -docker run --gpus all ghcr.io/premai-io/chat-falcon-7b-instruct-gpu:$VERSION pytest +docker run --gpus all $IMAGE:$VERSION pytest diff --git a/cht-gorilla/build.sh b/cht-gorilla/build.sh index 0527f35..41b4da4 100755 --- a/cht-gorilla/build.sh +++ b/cht-gorilla/build.sh @@ -2,18 +2,20 @@ set -e export VERSION=1.0.0 +IMAGE=ghcr.io/premai-io/chat-gorilla-falcon-7b-gpu docker buildx build ${@:1} \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=gorilla-llm/gorilla-falcon-7b-hf-v0" \ - --tag ghcr.io/premai-io/chat-gorilla-falcon-7b-gpu:latest \ - --tag ghcr.io/premai-io/chat-gorilla-falcon-7b-gpu:$VERSION \ + --tag $IMAGE:latest \ + --tag $IMAGE:$VERSION \ . -docker run --gpus all ghcr.io/premai-io/chat-gorilla-falcon-7b-gpu:$VERSION pytest +docker run --gpus all $IMAGE:$VERSION pytest +IMAGE=ghcr.io/premai-io/chat-gorilla-mpt-7b-gpu docker buildx build ${@:1} \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=gorilla-llm/gorilla-mpt-7b-hf-v0" \ - --tag ghcr.io/premai-io/chat-gorilla-mpt-7b-gpu:latest \ - --tag ghcr.io/premai-io/chat-gorilla-mpt-7b-gpu:$VERSION \ + --tag $IMAGE:latest \ + --tag $IMAGE:$VERSION \ . -docker run --gpus all ghcr.io/premai-io/chat-gorilla-mpt-7b-gpu:$VERSION pytest +docker run --gpus all $IMAGE:$VERSION pytest diff --git a/cht-llama-cpp/build.sh b/cht-llama-cpp/build.sh index 647f5ac..778ad5d 100755 --- a/cht-llama-cpp/build.sh +++ b/cht-llama-cpp/build.sh @@ -2,19 +2,21 @@ set -e export VERSION=1.0.4 +IMAGE=ghcr.io/premai-io/chat-gpt4all-lora-q4-cpu docker buildx build ${@:1} \ --file ./docker/cpu/Dockerfile \ --build-arg="MODEL_ID=gpt4all-lora-q4" \ - --tag ghcr.io/premai-io/chat-gpt4all-lora-q4-cpu:latest \ - --tag ghcr.io/premai-io/chat-gpt4all-lora-q4-cpu:$VERSION \ + --tag $IMAGE:latest \ + --tag $IMAGE:$VERSION \ --platform linux/arm64,linux/amd64 \ . +IMAGE=ghcr.io/premai-io/chat-vicuna-7b-q4-cpu docker buildx build ${@:1} \ --file ./docker/cpu/Dockerfile \ --build-arg="MODEL_ID=vicuna-7b-q4" \ - --tag ghcr.io/premai-io/chat-vicuna-7b-q4-cpu:latest \ - --tag ghcr.io/premai-io/chat-vicuna-7b-q4-cpu:$VERSION \ + --tag $IMAGE:latest \ + --tag $IMAGE:$VERSION \ --platform linux/arm64,linux/amd64 \ . -docker run --rm ghcr.io/premai-io/chat-vicuna-7b-q4-cpu:$VERSION pytest +docker run --rm $IMAGE:$VERSION pytest diff --git a/cht-mpt/build.sh b/cht-mpt/build.sh index 5ed709a..c37afd6 100755 --- a/cht-mpt/build.sh +++ b/cht-mpt/build.sh @@ -2,24 +2,27 @@ set -e export VERSION=1.0.0 +IMAGE=ghcr.io/premai-io/chat-mpt-7b-gpu docker buildx build ${@:1} \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=mosaicml/mpt-7b-chat" \ - --tag ghcr.io/premai-io/chat-mpt-7b-gpu:latest \ - --tag ghcr.io/premai-io/chat-mpt-7b-gpu:$VERSION \ + --tag $IMAGE:latest \ + --tag $IMAGE:$VERSION \ . -docker run --gpus all ghcr.io/premai-io/chat-mpt-7b-gpu:$VERSION pytest +docker run --gpus all $IMAGE:$VERSION pytest +IMAGE=ghcr.io/premai-io/mpt-7b-gpu docker buildx build ${@:1} \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=mosaicml/mpt-7b" \ - --tag ghcr.io/premai-io/mpt-7b-gpu:latest \ - --tag ghcr.io/premai-io/mpt-7b-gpu:$VERSION \ + --tag $IMAGE:latest \ + --tag $IMAGE:$VERSION \ . +IMAGE=ghcr.io/premai-io/mpt-7b-instruct-gpu docker buildx build ${@:1} \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=mosaicml/mpt-7b-instruct" \ - --tag ghcr.io/premai-io/mpt-7b-instruct-gpu:latest \ - --tag ghcr.io/premai-io/mpt-7b-instruct-gpu:$VERSION \ + --tag $IMAGE:latest \ + --tag $IMAGE:$VERSION \ . diff --git a/cht-xgen/build.sh b/cht-xgen/build.sh index 36da2db..b087496 100755 --- a/cht-xgen/build.sh +++ b/cht-xgen/build.sh @@ -2,10 +2,11 @@ set -e export VERSION=1.0.0 +IMAGE=ghcr.io/premai-io/chat-xgen-7b-8k-inst-gpu docker buildx build ${@:1} \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=Salesforce/xgen-7b-8k-inst" \ - --tag ghcr.io/premai-io/chat-xgen-7b-8k-inst-gpu:latest \ - --tag ghcr.io/premai-io/chat-xgen-7b-8k-inst-gpu:$VERSION \ + --tag $IMAGE:latest \ + --tag $IMAGE:$VERSION \ . -docker run --gpus all ghcr.io/premai-io/chat-xgen-7b-8k-inst-gpu:$VERSION pytest +docker run --gpus all $IMAGE:$VERSION pytest diff --git a/dfs-dalle/build.sh b/dfs-dalle/build.sh index 8dd8697..ad8d442 100755 --- a/dfs-dalle/build.sh +++ b/dfs-dalle/build.sh @@ -2,13 +2,14 @@ set -e export VERSION=1.0.0 +IMAGE=ghcr.io/premai-io/diffuser-dalle-mini-gpu docker buildx build ${@:1} \ --file ./docker/gpu/Dockerfile \ --build-arg="DALLE_MODEL_ID=dalle-mini/dalle-mini" \ --build-arg="DALLE_REVISION_ID=''" \ --build-arg="VQGAN_MODEL_ID=dalle-mini/vqgan_imagenet_f16_16384" \ --build-arg="VQGAN_REVISION_ID=e93a26e7707683d349bf5d5c41c5b0ef69b677a9" \ - --tag ghcr.io/premai-io/diffuser-dalle-mini-gpu:latest \ - --tag ghcr.io/premai-io/diffuser-dalle-mini-gpu:$VERSION \ + --tag $IMAGE:latest \ + --tag $IMAGE:$VERSION \ . -docker run --rm --gpus all ghcr.io/premai-io/diffuser-dalle-mini-gpu:$VERSION pytest +docker run --rm --gpus all $IMAGE:$VERSION pytest diff --git a/dfs-diffusers/build.sh b/dfs-diffusers/build.sh index 32b2249..f26505e 100755 --- a/dfs-diffusers/build.sh +++ b/dfs-diffusers/build.sh @@ -2,41 +2,46 @@ set -e export VERSION=1.0.3 +IMAGE=ghcr.io/premai-io/diffuser-stable-diffusion-2-1-gpu docker buildx build ${@:1} \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=stabilityai/stable-diffusion-2-1" \ - --tag ghcr.io/premai-io/diffuser-stable-diffusion-2-1-gpu:latest \ - --tag ghcr.io/premai-io/diffuser-stable-diffusion-2-1-gpu:$VERSION \ + --tag $IMAGE:latest \ + --tag $IMAGE:$VERSION \ . +IMAGE=ghcr.io/premai-io/diffuser-stable-diffusion-1-5-gpu docker buildx build ${@:1} \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=runwayml/stable-diffusion-v1-5" \ - --tag ghcr.io/premai-io/diffuser-stable-diffusion-1-5-gpu:latest \ - --tag ghcr.io/premai-io/diffuser-stable-diffusion-1-5-gpu:$VERSION \ + --tag $IMAGE:latest \ + --tag $IMAGE:$VERSION \ . +IMAGE=ghcr.io/premai-io/diffuser-stable-diffusion-2-gpu docker buildx build ${@:1} \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=stabilityai/stable-diffusion-2" \ - --tag ghcr.io/premai-io/diffuser-stable-diffusion-2-gpu:latest \ - --tag ghcr.io/premai-io/diffuser-stable-diffusion-2-gpu:$VERSION \ + --tag $IMAGE:latest \ + --tag $IMAGE:$VERSION \ . # docker system prune --all --force --volumes +IMAGE=ghcr.io/premai-io/upscaler-stable-diffusion-x4-gpu docker buildx build ${@:1} \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=stabilityai/stable-diffusion-x4-upscaler" \ - --tag ghcr.io/premai-io/upscaler-stable-diffusion-x4-gpu:latest \ - --tag ghcr.io/premai-io/upscaler-stable-diffusion-x4-gpu:$VERSION \ + --tag $IMAGE:latest \ + --tag $IMAGE:$VERSION \ . +IMAGE=ghcr.io/premai-io/upscaler-stable-diffusion-x2-latent-gpu docker buildx build ${@:1} \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=stabilityai/sd-x2-latent-upscaler" \ - --tag ghcr.io/premai-io/upscaler-stable-diffusion-x2-latent-gpu:latest \ - --tag ghcr.io/premai-io/upscaler-stable-diffusion-x2-latent-gpu:$VERSION \ + --tag $IMAGE:latest \ + --tag $IMAGE:$VERSION \ . # docker run --rm --gpus all ghcr.io/premai-io/diffuser-stable-diffusion-2-gpu:$VERSION pytest diff --git a/ebd-all-minilm/build.sh b/ebd-all-minilm/build.sh index 2e3eb5d..6b41793 100755 --- a/ebd-all-minilm/build.sh +++ b/ebd-all-minilm/build.sh @@ -2,19 +2,21 @@ set -e export VERSION=1.0.2 +IMAGE=ghcr.io/premai-io/embeddings-all-minilm-l6-v2-cpu docker buildx build ${@:1} \ --file ./docker/cpu/Dockerfile \ --build-arg="MODEL_ID=all-MiniLM-L6-v2" \ - --tag ghcr.io/premai-io/embeddings-all-minilm-l6-v2-cpu:latest \ - --tag ghcr.io/premai-io/embeddings-all-minilm-l6-v2-cpu:$VERSION \ + --tag $IMAGE:latest \ + --tag $IMAGE:$VERSION \ --platform linux/arm64,linux/amd64 \ . -docker run --rm ghcr.io/premai-io/embeddings-all-minilm-l6-v2-cpu:$VERSION pytest +docker run --rm $IMAGE:$VERSION pytest +IMAGE=ghcr.io/premai-io/embeddings-all-minilm-l6-v2-gpu docker buildx build ${@:1} \ --file ./docker/gpu/Dockerfile \ --build-arg="MODEL_ID=all-MiniLM-L6-v2" \ - --tag ghcr.io/premai-io/embeddings-all-minilm-l6-v2-gpu:latest \ - --tag ghcr.io/premai-io/embeddings-all-minilm-l6-v2-gpu:$VERSION \ + --tag $IMAGE:latest \ + --tag $IMAGE:$VERSION \ . -docker run --rm --gpus all ghcr.io/premai-io/embeddings-all-minilm-l6-v2-gpu:$VERSION pytest +docker run --rm --gpus all $IMAGE:$VERSION pytest diff --git a/t2a-bark/build.sh b/t2a-bark/build.sh index 9f73d57..1a19ce2 100755 --- a/t2a-bark/build.sh +++ b/t2a-bark/build.sh @@ -2,17 +2,21 @@ set -e export VERSION=1.0.0 +IMAGE=ghcr.io/premai-io/text-to-audio-bark-gpu docker buildx build ${@:1} \ --file ./docker/gpu/Dockerfile \ - --tag ghcr.io/premai-io/text-to-audio-bark-gpu:latest \ - --tag ghcr.io/premai-io/text-to-audio-bark-gpu:$VERSION \ + --build-arg="MODEL_ID=bark/t2a-bark" \ + --tag $IMAGE:latest \ + --tag $IMAGE:$VERSION \ . -docker run --rm --gpus all ghcr.io/premai-io/text-to-audio-bark-gpu:$VERSION pytest +docker run --rm --gpus all $IMAGE:$VERSION pytest +IMAGE=ghcr.io/premai-io/text-to-audio-bark-cpu docker buildx build ${@:1} \ --file ./docker/cpu/Dockerfile \ - --tag ghcr.io/premai-io/text-to-audio-bark-cpu:latest \ - --tag ghcr.io/premai-io/text-to-audio-bark-cpu:$VERSION \ + --build-arg="MODEL_ID=bark/t2a-bark" \ + --tag $IMAGE:latest \ + --tag $IMAGE:$VERSION \ --platform linux/arm64,linux/amd64 \ . -docker run --rm ghcr.io/premai-io/text-to-audio-bark-cpu:$VERSION pytest +docker run --rm $IMAGE:$VERSION pytest From 692d3fd44db08c01ef701e11a19efd114f78f817 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Tue, 25 Jul 2023 00:48:06 +0100 Subject: [PATCH 14/25] build: add TESTS_SKIP_GPU flag --- .github/workflows/ci.yml | 2 ++ a2t-whisper/build.sh | 4 +++- cdr-replit/build.sh | 4 +++- cht-dolly-v2/build.sh | 4 +++- cht-falcon/build.sh | 4 +++- cht-gorilla/build.sh | 8 ++++++-- cht-mpt/build.sh | 4 +++- cht-xgen/build.sh | 4 +++- dfs-dalle/build.sh | 4 +++- ebd-all-minilm/build.sh | 4 +++- t2a-bark/build.sh | 4 +++- 11 files changed, 35 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43b4488..91cc95a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,3 +42,5 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - run: ./build.sh ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && '--push' || '--load' }} working-directory: ${{ matrix.model }} + env: + TESTS_SKIP_GPU: 1 diff --git a/a2t-whisper/build.sh b/a2t-whisper/build.sh index 64c5cd3..d99ab2f 100755 --- a/a2t-whisper/build.sh +++ b/a2t-whisper/build.sh @@ -19,4 +19,6 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . -docker run --rm $IMAGE:$VERSION pytest +if test -z ${TESTS_SKIP_GPU+x}; then + docker run --rm $IMAGE:$VERSION pytest +fi diff --git a/cdr-replit/build.sh b/cdr-replit/build.sh index 712cdc8..390abd1 100755 --- a/cdr-replit/build.sh +++ b/cdr-replit/build.sh @@ -9,4 +9,6 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . -docker run --rm --gpus all $IMAGE:$VERSION pytest +if test -z ${TESTS_SKIP_GPU+x}; then + docker run --rm --gpus all $IMAGE:$VERSION pytest +fi diff --git a/cht-dolly-v2/build.sh b/cht-dolly-v2/build.sh index ccf0af5..c86811e 100755 --- a/cht-dolly-v2/build.sh +++ b/cht-dolly-v2/build.sh @@ -9,4 +9,6 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . -docker run --gpus all $IMAGE:$VERSION pytest +if test -z ${TESTS_SKIP_GPU+x}; then + docker run --gpus all $IMAGE:$VERSION pytest +fi diff --git a/cht-falcon/build.sh b/cht-falcon/build.sh index a805df5..136e2dd 100755 --- a/cht-falcon/build.sh +++ b/cht-falcon/build.sh @@ -9,4 +9,6 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . -docker run --gpus all $IMAGE:$VERSION pytest +if test -z ${TESTS_SKIP_GPU+x}; then + docker run --gpus all $IMAGE:$VERSION pytest +fi diff --git a/cht-gorilla/build.sh b/cht-gorilla/build.sh index 41b4da4..42aeafe 100755 --- a/cht-gorilla/build.sh +++ b/cht-gorilla/build.sh @@ -9,7 +9,9 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . -docker run --gpus all $IMAGE:$VERSION pytest +if test -z ${TESTS_SKIP_GPU+x}; then + docker run --gpus all $IMAGE:$VERSION pytest +fi IMAGE=ghcr.io/premai-io/chat-gorilla-mpt-7b-gpu docker buildx build ${@:1} \ @@ -18,4 +20,6 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . -docker run --gpus all $IMAGE:$VERSION pytest +if test -z ${TESTS_SKIP_GPU+x}; then + docker run --gpus all $IMAGE:$VERSION pytest +fi diff --git a/cht-mpt/build.sh b/cht-mpt/build.sh index c37afd6..b79fc6c 100755 --- a/cht-mpt/build.sh +++ b/cht-mpt/build.sh @@ -9,7 +9,9 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . -docker run --gpus all $IMAGE:$VERSION pytest +if test -z ${TESTS_SKIP_GPU+x}; then + docker run --gpus all $IMAGE:$VERSION pytest +fi IMAGE=ghcr.io/premai-io/mpt-7b-gpu docker buildx build ${@:1} \ diff --git a/cht-xgen/build.sh b/cht-xgen/build.sh index b087496..62a0abc 100755 --- a/cht-xgen/build.sh +++ b/cht-xgen/build.sh @@ -9,4 +9,6 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . -docker run --gpus all $IMAGE:$VERSION pytest +if test -z ${TESTS_SKIP_GPU+x}; then + docker run --gpus all $IMAGE:$VERSION pytest +fi diff --git a/dfs-dalle/build.sh b/dfs-dalle/build.sh index ad8d442..46267bf 100755 --- a/dfs-dalle/build.sh +++ b/dfs-dalle/build.sh @@ -12,4 +12,6 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . -docker run --rm --gpus all $IMAGE:$VERSION pytest +if test -z ${TESTS_SKIP_GPU+x}; then + docker run --rm --gpus all $IMAGE:$VERSION pytest +fi diff --git a/ebd-all-minilm/build.sh b/ebd-all-minilm/build.sh index 6b41793..bb6ad97 100755 --- a/ebd-all-minilm/build.sh +++ b/ebd-all-minilm/build.sh @@ -19,4 +19,6 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . -docker run --rm --gpus all $IMAGE:$VERSION pytest +if test -z ${TESTS_SKIP_GPU+x}; then + docker run --rm --gpus all $IMAGE:$VERSION pytest +fi diff --git a/t2a-bark/build.sh b/t2a-bark/build.sh index 1a19ce2..29cb7c3 100755 --- a/t2a-bark/build.sh +++ b/t2a-bark/build.sh @@ -9,7 +9,9 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . -docker run --rm --gpus all $IMAGE:$VERSION pytest +if test -z ${TESTS_SKIP_GPU+x}; then + docker run --rm --gpus all $IMAGE:$VERSION pytest +fi IMAGE=ghcr.io/premai-io/text-to-audio-bark-cpu docker buildx build ${@:1} \ From 13653e00a8c99cc2ba0009c8c5ab8bd49826c56d Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Tue, 25 Jul 2023 00:48:42 +0100 Subject: [PATCH 15/25] fix missing `--rm --gpus all` flags --- a2t-whisper/build.sh | 2 +- cht-dolly-v2/build.sh | 2 +- cht-falcon/build.sh | 2 +- cht-gorilla/build.sh | 4 ++-- cht-mpt/build.sh | 2 +- cht-xgen/build.sh | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/a2t-whisper/build.sh b/a2t-whisper/build.sh index d99ab2f..ff43e5f 100755 --- a/a2t-whisper/build.sh +++ b/a2t-whisper/build.sh @@ -20,5 +20,5 @@ docker buildx build ${@:1} \ --tag $IMAGE:$VERSION \ . if test -z ${TESTS_SKIP_GPU+x}; then - docker run --rm $IMAGE:$VERSION pytest + docker run --rm --gpus all $IMAGE:$VERSION pytest fi diff --git a/cht-dolly-v2/build.sh b/cht-dolly-v2/build.sh index c86811e..b93c8a6 100755 --- a/cht-dolly-v2/build.sh +++ b/cht-dolly-v2/build.sh @@ -10,5 +10,5 @@ docker buildx build ${@:1} \ --tag $IMAGE:$VERSION \ . if test -z ${TESTS_SKIP_GPU+x}; then - docker run --gpus all $IMAGE:$VERSION pytest + docker run --rm --gpus all $IMAGE:$VERSION pytest fi diff --git a/cht-falcon/build.sh b/cht-falcon/build.sh index 136e2dd..52ab371 100755 --- a/cht-falcon/build.sh +++ b/cht-falcon/build.sh @@ -10,5 +10,5 @@ docker buildx build ${@:1} \ --tag $IMAGE:$VERSION \ . if test -z ${TESTS_SKIP_GPU+x}; then - docker run --gpus all $IMAGE:$VERSION pytest + docker run --rm --gpus all $IMAGE:$VERSION pytest fi diff --git a/cht-gorilla/build.sh b/cht-gorilla/build.sh index 42aeafe..4d8edb2 100755 --- a/cht-gorilla/build.sh +++ b/cht-gorilla/build.sh @@ -10,7 +10,7 @@ docker buildx build ${@:1} \ --tag $IMAGE:$VERSION \ . if test -z ${TESTS_SKIP_GPU+x}; then - docker run --gpus all $IMAGE:$VERSION pytest + docker run --rm --gpus all $IMAGE:$VERSION pytest fi IMAGE=ghcr.io/premai-io/chat-gorilla-mpt-7b-gpu @@ -21,5 +21,5 @@ docker buildx build ${@:1} \ --tag $IMAGE:$VERSION \ . if test -z ${TESTS_SKIP_GPU+x}; then - docker run --gpus all $IMAGE:$VERSION pytest + docker run --rm --gpus all $IMAGE:$VERSION pytest fi diff --git a/cht-mpt/build.sh b/cht-mpt/build.sh index b79fc6c..0ce883d 100755 --- a/cht-mpt/build.sh +++ b/cht-mpt/build.sh @@ -10,7 +10,7 @@ docker buildx build ${@:1} \ --tag $IMAGE:$VERSION \ . if test -z ${TESTS_SKIP_GPU+x}; then - docker run --gpus all $IMAGE:$VERSION pytest + docker run --rm --gpus all $IMAGE:$VERSION pytest fi IMAGE=ghcr.io/premai-io/mpt-7b-gpu diff --git a/cht-xgen/build.sh b/cht-xgen/build.sh index 62a0abc..c438a3d 100755 --- a/cht-xgen/build.sh +++ b/cht-xgen/build.sh @@ -10,5 +10,5 @@ docker buildx build ${@:1} \ --tag $IMAGE:$VERSION \ . if test -z ${TESTS_SKIP_GPU+x}; then - docker run --gpus all $IMAGE:$VERSION pytest + docker run --rm --gpus all $IMAGE:$VERSION pytest fi From 9037ad78b231eb81870713ef14f1f4b6c7499805 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Tue, 25 Jul 2023 00:57:26 +0100 Subject: [PATCH 16/25] add missing platforms & tests --- cdr-t5/build.sh | 2 +- cht-llama-cpp/build.sh | 1 + cht-mpt/build.sh | 6 ++++++ dfs-diffusers/build.sh | 19 +++++++++++++++---- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/cdr-t5/build.sh b/cdr-t5/build.sh index 0f7ac47..92ffc9e 100755 --- a/cdr-t5/build.sh +++ b/cdr-t5/build.sh @@ -8,6 +8,6 @@ docker buildx build ${@:1} \ --build-arg="MODEL_ID=Salesforce/codet5p-220m-py" \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ - --platform linux/amd64 \ + --platform linux/arm64,linux/amd64 \ . docker run --rm $IMAGE:$VERSION pytest diff --git a/cht-llama-cpp/build.sh b/cht-llama-cpp/build.sh index 778ad5d..54666d8 100755 --- a/cht-llama-cpp/build.sh +++ b/cht-llama-cpp/build.sh @@ -10,6 +10,7 @@ docker buildx build ${@:1} \ --tag $IMAGE:$VERSION \ --platform linux/arm64,linux/amd64 \ . +docker run --rm $IMAGE:$VERSION pytest IMAGE=ghcr.io/premai-io/chat-vicuna-7b-q4-cpu docker buildx build ${@:1} \ diff --git a/cht-mpt/build.sh b/cht-mpt/build.sh index 0ce883d..bc1e138 100755 --- a/cht-mpt/build.sh +++ b/cht-mpt/build.sh @@ -20,6 +20,9 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . +if test -z ${TESTS_SKIP_GPU+x}; then + docker run --rm --gpus all ghcr.io/premai-io/mpt-7b-gpu:$VERSION pytest +fi IMAGE=ghcr.io/premai-io/mpt-7b-instruct-gpu docker buildx build ${@:1} \ @@ -28,3 +31,6 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . +if test -z ${TESTS_SKIP_GPU+x}; then + docker run --rm --gpus all ghcr.io/premai-io/mpt-7b-instruct-gpu:$VERSION pytest +fi diff --git a/dfs-diffusers/build.sh b/dfs-diffusers/build.sh index f26505e..63c06d0 100755 --- a/dfs-diffusers/build.sh +++ b/dfs-diffusers/build.sh @@ -9,6 +9,9 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . +if test -z ${TESTS_SKIP_GPU+x}; then + docker run --rm --gpus all $IMAGE:$VERSION pytest +fi IMAGE=ghcr.io/premai-io/diffuser-stable-diffusion-1-5-gpu docker buildx build ${@:1} \ @@ -17,6 +20,9 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . +if test -z ${TESTS_SKIP_GPU+x}; then + docker run --rm --gpus all $IMAGE:$VERSION pytest +fi IMAGE=ghcr.io/premai-io/diffuser-stable-diffusion-2-gpu docker buildx build ${@:1} \ @@ -25,8 +31,9 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . - -# docker system prune --all --force --volumes +if test -z ${TESTS_SKIP_GPU+x}; then + docker run --rm --gpus all $IMAGE:$VERSION pytest +fi IMAGE=ghcr.io/premai-io/upscaler-stable-diffusion-x4-gpu docker buildx build ${@:1} \ @@ -35,6 +42,9 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . +if test -z ${TESTS_SKIP_GPU+x}; then + docker run --rm --gpus all $IMAGE:$VERSION pytest +fi IMAGE=ghcr.io/premai-io/upscaler-stable-diffusion-x2-latent-gpu docker buildx build ${@:1} \ @@ -43,5 +53,6 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . - -# docker run --rm --gpus all ghcr.io/premai-io/diffuser-stable-diffusion-2-gpu:$VERSION pytest +if test -z ${TESTS_SKIP_GPU+x}; then + docker run --rm --gpus all $IMAGE:$VERSION pytest +fi From f6e97382021ac15b09eafbb80be4ad4a3982b4bb Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Tue, 25 Jul 2023 01:05:49 +0100 Subject: [PATCH 17/25] drop --load --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 91cc95a..efa106b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,6 +23,7 @@ jobs: needs: [models] runs-on: ubuntu-latest strategy: + fail-fast: false # TODO: remove matrix: model: ${{ fromJson(needs.models.outputs.modified) }} env: @@ -40,7 +41,7 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - run: ./build.sh ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && '--push' || '--load' }} + - run: ./build.sh ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && '--push' || '' }} working-directory: ${{ matrix.model }} env: TESTS_SKIP_GPU: 1 From 54f0018f8113618c87127358bf77a27f419f0cd7 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Tue, 25 Jul 2023 17:22:24 +0100 Subject: [PATCH 18/25] build: fix --load on multi ---platform --- .github/workflows/ci.yml | 4 +++- a2t-whisper/build.sh | 2 +- cdr-t5/build.sh | 2 +- cht-llama-cpp/build.sh | 4 ++-- ebd-all-minilm/build.sh | 2 +- t2a-bark/build.sh | 2 +- 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index efa106b..149883a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,7 +41,9 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - run: ./build.sh ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && '--push' || '' }} + - run: ./build.sh $BUILDX_ARGS working-directory: ${{ matrix.model }} env: TESTS_SKIP_GPU: 1 + BUILDX_ARGS: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && '--push' || '--load' }} + BUILDX_PLATFORM: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && 'linux/arm64,linux/amd64' || 'linux/amd64' }} diff --git a/a2t-whisper/build.sh b/a2t-whisper/build.sh index ff43e5f..438542c 100755 --- a/a2t-whisper/build.sh +++ b/a2t-whisper/build.sh @@ -8,7 +8,7 @@ docker buildx build ${@:1} \ --build-arg="MODEL_ID=tiny" \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ - --platform linux/arm64,linux/amd64 \ + --platform ${BUILDX_PLATFORM:-linux/arm64,linux/amd64} \ . docker run --rm $IMAGE:$VERSION pytest diff --git a/cdr-t5/build.sh b/cdr-t5/build.sh index 92ffc9e..f55b762 100755 --- a/cdr-t5/build.sh +++ b/cdr-t5/build.sh @@ -8,6 +8,6 @@ docker buildx build ${@:1} \ --build-arg="MODEL_ID=Salesforce/codet5p-220m-py" \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ - --platform linux/arm64,linux/amd64 \ + --platform ${BUILDX_PLATFORM:-linux/arm64,linux/amd64} \ . docker run --rm $IMAGE:$VERSION pytest diff --git a/cht-llama-cpp/build.sh b/cht-llama-cpp/build.sh index 54666d8..820503e 100755 --- a/cht-llama-cpp/build.sh +++ b/cht-llama-cpp/build.sh @@ -8,7 +8,7 @@ docker buildx build ${@:1} \ --build-arg="MODEL_ID=gpt4all-lora-q4" \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ - --platform linux/arm64,linux/amd64 \ + --platform ${BUILDX_PLATFORM:-linux/arm64,linux/amd64} \ . docker run --rm $IMAGE:$VERSION pytest @@ -18,6 +18,6 @@ docker buildx build ${@:1} \ --build-arg="MODEL_ID=vicuna-7b-q4" \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ - --platform linux/arm64,linux/amd64 \ + --platform ${BUILDX_PLATFORM:-linux/arm64,linux/amd64} \ . docker run --rm $IMAGE:$VERSION pytest diff --git a/ebd-all-minilm/build.sh b/ebd-all-minilm/build.sh index bb6ad97..b06004f 100755 --- a/ebd-all-minilm/build.sh +++ b/ebd-all-minilm/build.sh @@ -8,7 +8,7 @@ docker buildx build ${@:1} \ --build-arg="MODEL_ID=all-MiniLM-L6-v2" \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ - --platform linux/arm64,linux/amd64 \ + --platform ${BUILDX_PLATFORM:-linux/arm64,linux/amd64} \ . docker run --rm $IMAGE:$VERSION pytest diff --git a/t2a-bark/build.sh b/t2a-bark/build.sh index 29cb7c3..50e8c14 100755 --- a/t2a-bark/build.sh +++ b/t2a-bark/build.sh @@ -19,6 +19,6 @@ docker buildx build ${@:1} \ --build-arg="MODEL_ID=bark/t2a-bark" \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ - --platform linux/arm64,linux/amd64 \ + --platform ${BUILDX_PLATFORM:-linux/arm64,linux/amd64} \ . docker run --rm $IMAGE:$VERSION pytest From b9fa4f231a84965d556996e126fb2d83adcfdce4 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Tue, 25 Jul 2023 17:26:42 +0100 Subject: [PATCH 19/25] tests: treat empty string as falsey --- a2t-whisper/build.sh | 6 ++++-- cdr-replit/build.sh | 2 +- cdr-t5/build.sh | 4 +++- cht-dolly-v2/build.sh | 2 +- cht-falcon/build.sh | 2 +- cht-gorilla/build.sh | 4 ++-- cht-llama-cpp/build.sh | 8 ++++++-- cht-mpt/build.sh | 6 +++--- cht-xgen/build.sh | 2 +- dfs-dalle/build.sh | 2 +- dfs-diffusers/build.sh | 10 +++++----- ebd-all-minilm/build.sh | 6 ++++-- t2a-bark/build.sh | 6 ++++-- 13 files changed, 36 insertions(+), 24 deletions(-) diff --git a/a2t-whisper/build.sh b/a2t-whisper/build.sh index 438542c..ca13ec1 100755 --- a/a2t-whisper/build.sh +++ b/a2t-whisper/build.sh @@ -10,7 +10,9 @@ docker buildx build ${@:1} \ --tag $IMAGE:$VERSION \ --platform ${BUILDX_PLATFORM:-linux/arm64,linux/amd64} \ . -docker run --rm $IMAGE:$VERSION pytest +if test -z $TESTS_SKIP_CPU; then + docker run --rm $IMAGE:$VERSION pytest +fi IMAGE=ghcr.io/premai-io/audio-to-text-whisper-large-v2-gpu docker buildx build ${@:1} \ @@ -19,6 +21,6 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . -if test -z ${TESTS_SKIP_GPU+x}; then +if test -z $TESTS_SKIP_GPU; then docker run --rm --gpus all $IMAGE:$VERSION pytest fi diff --git a/cdr-replit/build.sh b/cdr-replit/build.sh index 390abd1..7e02bd2 100755 --- a/cdr-replit/build.sh +++ b/cdr-replit/build.sh @@ -9,6 +9,6 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . -if test -z ${TESTS_SKIP_GPU+x}; then +if test -z $TESTS_SKIP_GPU; then docker run --rm --gpus all $IMAGE:$VERSION pytest fi diff --git a/cdr-t5/build.sh b/cdr-t5/build.sh index f55b762..d95c854 100755 --- a/cdr-t5/build.sh +++ b/cdr-t5/build.sh @@ -10,4 +10,6 @@ docker buildx build ${@:1} \ --tag $IMAGE:$VERSION \ --platform ${BUILDX_PLATFORM:-linux/arm64,linux/amd64} \ . -docker run --rm $IMAGE:$VERSION pytest +if test -z $TESTS_SKIP_CPU; then + docker run --rm $IMAGE:$VERSION pytest +fi diff --git a/cht-dolly-v2/build.sh b/cht-dolly-v2/build.sh index b93c8a6..d57d433 100755 --- a/cht-dolly-v2/build.sh +++ b/cht-dolly-v2/build.sh @@ -9,6 +9,6 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . -if test -z ${TESTS_SKIP_GPU+x}; then +if test -z $TESTS_SKIP_GPU; then docker run --rm --gpus all $IMAGE:$VERSION pytest fi diff --git a/cht-falcon/build.sh b/cht-falcon/build.sh index 52ab371..e1127ea 100755 --- a/cht-falcon/build.sh +++ b/cht-falcon/build.sh @@ -9,6 +9,6 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . -if test -z ${TESTS_SKIP_GPU+x}; then +if test -z $TESTS_SKIP_GPU; then docker run --rm --gpus all $IMAGE:$VERSION pytest fi diff --git a/cht-gorilla/build.sh b/cht-gorilla/build.sh index 4d8edb2..207e7c9 100755 --- a/cht-gorilla/build.sh +++ b/cht-gorilla/build.sh @@ -9,7 +9,7 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . -if test -z ${TESTS_SKIP_GPU+x}; then +if test -z $TESTS_SKIP_GPU; then docker run --rm --gpus all $IMAGE:$VERSION pytest fi @@ -20,6 +20,6 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . -if test -z ${TESTS_SKIP_GPU+x}; then +if test -z $TESTS_SKIP_GPU; then docker run --rm --gpus all $IMAGE:$VERSION pytest fi diff --git a/cht-llama-cpp/build.sh b/cht-llama-cpp/build.sh index 820503e..df252d8 100755 --- a/cht-llama-cpp/build.sh +++ b/cht-llama-cpp/build.sh @@ -10,7 +10,9 @@ docker buildx build ${@:1} \ --tag $IMAGE:$VERSION \ --platform ${BUILDX_PLATFORM:-linux/arm64,linux/amd64} \ . -docker run --rm $IMAGE:$VERSION pytest +if test -z $TESTS_SKIP_CPU; then + docker run --rm $IMAGE:$VERSION pytest +fi IMAGE=ghcr.io/premai-io/chat-vicuna-7b-q4-cpu docker buildx build ${@:1} \ @@ -20,4 +22,6 @@ docker buildx build ${@:1} \ --tag $IMAGE:$VERSION \ --platform ${BUILDX_PLATFORM:-linux/arm64,linux/amd64} \ . -docker run --rm $IMAGE:$VERSION pytest +if test -z $TESTS_SKIP_CPU; then + docker run --rm $IMAGE:$VERSION pytest +fi diff --git a/cht-mpt/build.sh b/cht-mpt/build.sh index bc1e138..5a79492 100755 --- a/cht-mpt/build.sh +++ b/cht-mpt/build.sh @@ -9,7 +9,7 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . -if test -z ${TESTS_SKIP_GPU+x}; then +if test -z $TESTS_SKIP_GPU; then docker run --rm --gpus all $IMAGE:$VERSION pytest fi @@ -20,7 +20,7 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . -if test -z ${TESTS_SKIP_GPU+x}; then +if test -z $TESTS_SKIP_GPU; then docker run --rm --gpus all ghcr.io/premai-io/mpt-7b-gpu:$VERSION pytest fi @@ -31,6 +31,6 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . -if test -z ${TESTS_SKIP_GPU+x}; then +if test -z $TESTS_SKIP_GPU; then docker run --rm --gpus all ghcr.io/premai-io/mpt-7b-instruct-gpu:$VERSION pytest fi diff --git a/cht-xgen/build.sh b/cht-xgen/build.sh index c438a3d..fab88cf 100755 --- a/cht-xgen/build.sh +++ b/cht-xgen/build.sh @@ -9,6 +9,6 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . -if test -z ${TESTS_SKIP_GPU+x}; then +if test -z $TESTS_SKIP_GPU; then docker run --rm --gpus all $IMAGE:$VERSION pytest fi diff --git a/dfs-dalle/build.sh b/dfs-dalle/build.sh index 46267bf..b534cc5 100755 --- a/dfs-dalle/build.sh +++ b/dfs-dalle/build.sh @@ -12,6 +12,6 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . -if test -z ${TESTS_SKIP_GPU+x}; then +if test -z $TESTS_SKIP_GPU; then docker run --rm --gpus all $IMAGE:$VERSION pytest fi diff --git a/dfs-diffusers/build.sh b/dfs-diffusers/build.sh index 63c06d0..9358981 100755 --- a/dfs-diffusers/build.sh +++ b/dfs-diffusers/build.sh @@ -9,7 +9,7 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . -if test -z ${TESTS_SKIP_GPU+x}; then +if test -z $TESTS_SKIP_GPU; then docker run --rm --gpus all $IMAGE:$VERSION pytest fi @@ -20,7 +20,7 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . -if test -z ${TESTS_SKIP_GPU+x}; then +if test -z $TESTS_SKIP_GPU; then docker run --rm --gpus all $IMAGE:$VERSION pytest fi @@ -31,7 +31,7 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . -if test -z ${TESTS_SKIP_GPU+x}; then +if test -z $TESTS_SKIP_GPU; then docker run --rm --gpus all $IMAGE:$VERSION pytest fi @@ -42,7 +42,7 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . -if test -z ${TESTS_SKIP_GPU+x}; then +if test -z $TESTS_SKIP_GPU; then docker run --rm --gpus all $IMAGE:$VERSION pytest fi @@ -53,6 +53,6 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . -if test -z ${TESTS_SKIP_GPU+x}; then +if test -z $TESTS_SKIP_GPU; then docker run --rm --gpus all $IMAGE:$VERSION pytest fi diff --git a/ebd-all-minilm/build.sh b/ebd-all-minilm/build.sh index b06004f..1387a02 100755 --- a/ebd-all-minilm/build.sh +++ b/ebd-all-minilm/build.sh @@ -10,7 +10,9 @@ docker buildx build ${@:1} \ --tag $IMAGE:$VERSION \ --platform ${BUILDX_PLATFORM:-linux/arm64,linux/amd64} \ . -docker run --rm $IMAGE:$VERSION pytest +if test -z $TESTS_SKIP_CPU; then + docker run --rm $IMAGE:$VERSION pytest +fi IMAGE=ghcr.io/premai-io/embeddings-all-minilm-l6-v2-gpu docker buildx build ${@:1} \ @@ -19,6 +21,6 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . -if test -z ${TESTS_SKIP_GPU+x}; then +if test -z $TESTS_SKIP_GPU; then docker run --rm --gpus all $IMAGE:$VERSION pytest fi diff --git a/t2a-bark/build.sh b/t2a-bark/build.sh index 50e8c14..8554a5c 100755 --- a/t2a-bark/build.sh +++ b/t2a-bark/build.sh @@ -9,7 +9,7 @@ docker buildx build ${@:1} \ --tag $IMAGE:latest \ --tag $IMAGE:$VERSION \ . -if test -z ${TESTS_SKIP_GPU+x}; then +if test -z $TESTS_SKIP_GPU; then docker run --rm --gpus all $IMAGE:$VERSION pytest fi @@ -21,4 +21,6 @@ docker buildx build ${@:1} \ --tag $IMAGE:$VERSION \ --platform ${BUILDX_PLATFORM:-linux/arm64,linux/amd64} \ . -docker run --rm $IMAGE:$VERSION pytest +if test -z $TESTS_SKIP_CPU; then + docker run --rm $IMAGE:$VERSION pytest +fi From d4f297dfe3ae4879a36d24e9ae9d35f26185cf25 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Tue, 25 Jul 2023 17:34:56 +0100 Subject: [PATCH 20/25] ci: use self-hosted paperspace runners --- .github/workflows/ci.yml | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 149883a..1fbf1f5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,7 @@ on: push: pull_request: jobs: - models: + setup: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -17,15 +17,24 @@ jobs: git diff --quiet HEAD~1 -- $model || echo $model done | jq -Rsc 'split("\n")[:-1]' )" >> $GITHUB_OUTPUT + - name: Launch self-hosted runners + run: | + curl -sSL -X POST -H "X-Api-Key: $API_KEY" https://api.paperspace.io/machines/$MACHINE/start + while test $(curl -fsSL -X GET -H "X-Api-Key: $API_KEY" https://api.paperspace.io/machines/getMachinePublic?machineId=$MACHINE | jq -r .state) != ready; do + sleep 5 + done + env: + API_KEY: ${{ secrets.PAPERSPACE_API_KEY }} + MACHINE: ${{ secrets.PAPERSPACE_MACHINE }} outputs: - modified: ${{ steps.list.outputs.modified }} + models: ${{ steps.list.outputs.modified }} build-test-push: - needs: [models] - runs-on: ubuntu-latest + needs: setup + runs-on: [self-hosted, gpu] strategy: fail-fast: false # TODO: remove matrix: - model: ${{ fromJson(needs.models.outputs.modified) }} + model: ${{ fromJson(needs.setup.outputs.models) }} env: VERSION: '1.0.0' DOCKER_BUILDKIT: 1 @@ -33,8 +42,6 @@ jobs: COMPOSE_DOCKER_CLI_BUILD: 1 steps: - uses: actions/checkout@v3 - - uses: docker/setup-qemu-action@v2 - - uses: docker/setup-buildx-action@v2 - name: Login to GitHub Container Registry uses: docker/login-action@v2 with: @@ -44,6 +51,17 @@ jobs: - run: ./build.sh $BUILDX_ARGS working-directory: ${{ matrix.model }} env: - TESTS_SKIP_GPU: 1 BUILDX_ARGS: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && '--push' || '--load' }} BUILDX_PLATFORM: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && 'linux/arm64,linux/amd64' || 'linux/amd64' }} + TESTS_SKIP_CPU: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && '1' || '' }} + teardown: + needs: build-test-push + if: ${{ always() }} + runs-on: ubuntu-latest + steps: + - name: Terminate self-hosted runners + run: | + curl -sSL -X POST -H "X-Api-Key: $API_KEY" https://api.paperspace.io/machines/$MACHINE/stop + env: + API_KEY: ${{ secrets.PAPERSPACE_API_KEY }} + MACHINE: ${{ secrets.PAPERSPACE_MACHINE }} From f672e560bca5640f53aafe9a8c1cb821795659b4 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Tue, 25 Jul 2023 18:51:22 +0100 Subject: [PATCH 21/25] ci: manual self-hosted runners --- .github/workflows/ci.yml | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1fbf1f5..c98d762 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,15 +17,6 @@ jobs: git diff --quiet HEAD~1 -- $model || echo $model done | jq -Rsc 'split("\n")[:-1]' )" >> $GITHUB_OUTPUT - - name: Launch self-hosted runners - run: | - curl -sSL -X POST -H "X-Api-Key: $API_KEY" https://api.paperspace.io/machines/$MACHINE/start - while test $(curl -fsSL -X GET -H "X-Api-Key: $API_KEY" https://api.paperspace.io/machines/getMachinePublic?machineId=$MACHINE | jq -r .state) != ready; do - sleep 5 - done - env: - API_KEY: ${{ secrets.PAPERSPACE_API_KEY }} - MACHINE: ${{ secrets.PAPERSPACE_MACHINE }} outputs: models: ${{ steps.list.outputs.modified }} build-test-push: @@ -51,17 +42,7 @@ jobs: - run: ./build.sh $BUILDX_ARGS working-directory: ${{ matrix.model }} env: + # can't load/test cross-CPU-platform, hence the mess below BUILDX_ARGS: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && '--push' || '--load' }} BUILDX_PLATFORM: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && 'linux/arm64,linux/amd64' || 'linux/amd64' }} TESTS_SKIP_CPU: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && '1' || '' }} - teardown: - needs: build-test-push - if: ${{ always() }} - runs-on: ubuntu-latest - steps: - - name: Terminate self-hosted runners - run: | - curl -sSL -X POST -H "X-Api-Key: $API_KEY" https://api.paperspace.io/machines/$MACHINE/stop - env: - API_KEY: ${{ secrets.PAPERSPACE_API_KEY }} - MACHINE: ${{ secrets.PAPERSPACE_MACHINE }} From dd5db7d2012f71480214636d477bd9cfcba70c0e Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Tue, 25 Jul 2023 23:43:43 +0100 Subject: [PATCH 22/25] ci: skip testing larger models --- .github/workflows/ci.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c98d762..6a349e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: echo "modified=$( for model in $(ls -d *-*); do git diff --quiet HEAD~1 -- $model || echo $model - done | jq -Rsc 'split("\n")[:-1]' + done | sort | jq -Rsc 'split("\n")[:-1]' )" >> $GITHUB_OUTPUT outputs: models: ${{ steps.list.outputs.modified }} @@ -46,3 +46,10 @@ jobs: BUILDX_ARGS: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && '--push' || '--load' }} BUILDX_PLATFORM: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && 'linux/arm64,linux/amd64' || 'linux/amd64' }} TESTS_SKIP_CPU: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && '1' || '' }} + # avoid OoM errors (TODO: remove when using larger GPU) + TESTS_SKIP_GPU: ${{ contains('a2t-whisper,cht-dolly-v2,cht-gorilla,cht-llama-v2,cht-mpt,cht-xgen,dfs-dalle,dfs-diffusers', matrix.model) && '1' || '' }} + pass: + needs: build-test-push + runs-on: ubuntu-latest + steps: + - run: echo success From 729f937e2d9f44d2c63564962c83a7e26011754e Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Wed, 26 Jul 2023 09:34:34 +0100 Subject: [PATCH 23/25] ci: minor debugging help --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6a349e1..43fcf73 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,6 +12,7 @@ jobs: - id: list name: List modified models run: | + git diff --stat HEAD~1 echo "modified=$( for model in $(ls -d *-*); do git diff --quiet HEAD~1 -- $model || echo $model From 9707b448e5b2b30df9c983b50c3cc8ebb3854054 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Wed, 26 Jul 2023 10:07:39 +0100 Subject: [PATCH 24/25] ci: safer array comparison --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43fcf73..0719c51 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,7 +48,7 @@ jobs: BUILDX_PLATFORM: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && 'linux/arm64,linux/amd64' || 'linux/amd64' }} TESTS_SKIP_CPU: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && '1' || '' }} # avoid OoM errors (TODO: remove when using larger GPU) - TESTS_SKIP_GPU: ${{ contains('a2t-whisper,cht-dolly-v2,cht-gorilla,cht-llama-v2,cht-mpt,cht-xgen,dfs-dalle,dfs-diffusers', matrix.model) && '1' || '' }} + TESTS_SKIP_GPU: ${{ contains(fromJSON('["a2t-whisper","cht-dolly-v2","cht-gorilla","cht-llama-v2","cht-mpt","cht-xgen","dfs-dalle","dfs-diffusers"]'), matrix.model) && '1' || '' }} pass: needs: build-test-push runs-on: ubuntu-latest From afd6d3f640eff9ee056b8e7f2bd45276aae51258 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Thu, 27 Jul 2023 18:32:34 +0100 Subject: [PATCH 25/25] ci: add comments --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0719c51..f65e37c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,12 +40,12 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - run: ./build.sh $BUILDX_ARGS + - run: ./build.sh ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && '--push' || '--load' }} working-directory: ${{ matrix.model }} env: - # can't load/test cross-CPU-platform, hence the mess below - BUILDX_ARGS: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && '--push' || '--load' }} + # can't load cross-CPU-platform BUILDX_PLATFORM: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && 'linux/arm64,linux/amd64' || 'linux/amd64' }} + # can't test cross-CPU-platform TESTS_SKIP_CPU: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && '1' || '' }} # avoid OoM errors (TODO: remove when using larger GPU) TESTS_SKIP_GPU: ${{ contains(fromJSON('["a2t-whisper","cht-dolly-v2","cht-gorilla","cht-llama-v2","cht-mpt","cht-xgen","dfs-dalle","dfs-diffusers"]'), matrix.model) && '1' || '' }}