From b44f0380490384af574f2008e53d8699636f1555 Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Sat, 7 Oct 2023 11:13:17 +0200 Subject: [PATCH] feat(conda): add make target and entrypoints for the dockerfile Signed-off-by: Ettore Di Giacinto --- Dockerfile | 6 +++++- Makefile | 4 ++++ extra/grpc/autogptq/run.sh | 10 ++++++++++ extra/grpc/bark/run.sh | 10 ++++++++++ 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100755 extra/grpc/autogptq/run.sh create mode 100755 extra/grpc/bark/run.sh diff --git a/Dockerfile b/Dockerfile index 21e6eddf4b9d..6f914d089881 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ ARG TARGETARCH ARG TARGETVARIANT ENV BUILD_TYPE=${BUILD_TYPE} -ENV EXTERNAL_GRPC_BACKENDS="huggingface-embeddings:/build/extra/grpc/huggingface/huggingface.py,autogptq:/build/extra/grpc/autogptq/autogptq.py,bark:/build/extra/grpc/bark/ttsbark.py,diffusers:/build/extra/grpc/diffusers/backend_diffusers.py,exllama:/build/extra/grpc/exllama/exllama.py,vall-e-x:/build/extra/grpc/vall-e-x/ttsvalle.py,vllm:/build/extra/grpc/vllm/backend_vllm.py" +ENV EXTERNAL_GRPC_BACKENDS="huggingface-embeddings:/build/extra/grpc/huggingface/huggingface.py,autogptq:/build/extra/grpc/autogptq/run.sh,bark:/build/extra/grpc/bark/run.sh,diffusers:/build/extra/grpc/diffusers/backend_diffusers.py,exllama:/build/extra/grpc/exllama/exllama.py,vall-e-x:/build/extra/grpc/vall-e-x/ttsvalle.py,vllm:/build/extra/grpc/vllm/backend_vllm.py" ENV GALLERIES='[{"name":"model-gallery", "url":"github:go-skynet/model-gallery/index.yaml"}, {"url": "github:go-skynet/model-gallery/huggingface.yaml","name":"huggingface"}]' ARG GO_TAGS="stablediffusion tts" @@ -166,6 +166,10 @@ COPY --from=builder /build/local-ai ./ # do not let stablediffusion rebuild (requires an older version of absl) COPY --from=builder /build/backend-assets/grpc/stablediffusion ./backend-assets/grpc/stablediffusion +RUN if [ "${IMAGE_TYPE}" = "extras" ]; then \ + make prepare-extra-conda-environments \ + ; fi + # Copy VALLE-X as it's not a real "lib" RUN if [ -d /usr/lib/vall-e-x ]; then \ cp -rfv /usr/lib/vall-e-x/* ./ ; \ diff --git a/Makefile b/Makefile index f944b00252f3..bd8a566c330d 100644 --- a/Makefile +++ b/Makefile @@ -415,6 +415,10 @@ protogen-python: ## GRPC +prepare-extra-conda-environments: + $(MAKE) -C extra/grpc/autogptq + $(MAKE) -C extra/grpc/bark + backend-assets/grpc: mkdir -p backend-assets/grpc diff --git a/extra/grpc/autogptq/run.sh b/extra/grpc/autogptq/run.sh new file mode 100755 index 000000000000..22d1216c9637 --- /dev/null +++ b/extra/grpc/autogptq/run.sh @@ -0,0 +1,10 @@ +## +## A bash script wrapper that runs the autogptq server with conda + +# Activate conda environment +source activate autogptq + +# get the directory where the bash script is located +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +python $DIR/autogptq.py \ No newline at end of file diff --git a/extra/grpc/bark/run.sh b/extra/grpc/bark/run.sh new file mode 100755 index 000000000000..a21bfa738866 --- /dev/null +++ b/extra/grpc/bark/run.sh @@ -0,0 +1,10 @@ +## +## A bash script wrapper that runs the ttsbark server with conda + +# Activate conda environment +source activate ttsbark + +# get the directory where the bash script is located +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +python $DIR/ttsbark.py \ No newline at end of file