Skip to content

Commit 97505a3

Browse files
committed
feat(petals): add backend
Signed-off-by: Ettore Di Giacinto <[email protected]>
1 parent 63e1f8f commit 97505a3

File tree

8 files changed

+620
-1
lines changed

8 files changed

+620
-1
lines changed

Dockerfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ARG TARGETARCH
1212
ARG TARGETVARIANT
1313

1414
ENV BUILD_TYPE=${BUILD_TYPE}
15-
ENV EXTERNAL_GRPC_BACKENDS="huggingface-embeddings:/build/backend/python/sentencetransformers/run.sh,transformers:/build/backend/python/transformers/run.sh,sentencetransformers:/build/backend/python/sentencetransformers/run.sh,autogptq:/build/backend/python/autogptq/run.sh,bark:/build/backend/python/bark/run.sh,diffusers:/build/backend/python/diffusers/run.sh,exllama:/build/backend/python/exllama/run.sh,vall-e-x:/build/backend/python/vall-e-x/run.sh,vllm:/build/backend/python/vllm/run.sh"
15+
ENV EXTERNAL_GRPC_BACKENDS="huggingface-embeddings:/build/backend/python/sentencetransformers/run.sh,petals:/build/backend/python/petals/run.sh,transformers:/build/backend/python/transformers/run.sh,sentencetransformers:/build/backend/python/sentencetransformers/run.sh,autogptq:/build/backend/python/autogptq/run.sh,bark:/build/backend/python/bark/run.sh,diffusers:/build/backend/python/diffusers/run.sh,exllama:/build/backend/python/exllama/run.sh,vall-e-x:/build/backend/python/vall-e-x/run.sh,vllm:/build/backend/python/vllm/run.sh"
1616
ENV GALLERIES='[{"name":"model-gallery", "url":"github:go-skynet/model-gallery/index.yaml"}, {"url": "github:go-skynet/model-gallery/huggingface.yaml","name":"huggingface"}]'
1717
ARG GO_TAGS="stablediffusion tts"
1818

@@ -181,13 +181,18 @@ RUN if [ "${IMAGE_TYPE}" = "extras" ]; then \
181181
RUN if [ "${IMAGE_TYPE}" = "extras" ]; then \
182182
PATH=$PATH:/opt/conda/bin make -C backend/python/exllama \
183183
; fi
184+
RUN if [ "${IMAGE_TYPE}" = "extras" ]; then \
185+
PATH=$PATH:/opt/conda/bin make -C backend/python/petals \
186+
; fi
184187

185188
# Copy VALLE-X as it's not a real "lib"
189+
# TODO: this is wrong - we should copy the lib into the conda env path
186190
RUN if [ -d /usr/lib/vall-e-x ]; then \
187191
cp -rfv /usr/lib/vall-e-x/* ./ ; \
188192
fi
189193

190194
# we also copy exllama libs over to resolve exllama import error
195+
# TODO: check if this is still needed
191196
RUN if [ -d /usr/local/lib/python3.9/dist-packages/exllama ]; then \
192197
cp -rfv /usr/local/lib/python3.9/dist-packages/exllama backend/python/exllama/;\
193198
fi

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ protogen-python:
388388
python3 -m grpc_tools.protoc -Ibackend/ --python_out=backend/python/diffusers/ --grpc_python_out=backend/python/diffusers/ backend/backend.proto
389389
python3 -m grpc_tools.protoc -Ibackend/ --python_out=backend/python/vall-e-x/ --grpc_python_out=backend/python/vall-e-x/ backend/backend.proto
390390
python3 -m grpc_tools.protoc -Ibackend/ --python_out=backend/python/vllm/ --grpc_python_out=backend/python/vllm/ backend/backend.proto
391+
python3 -m grpc_tools.protoc -Ibackend/ --python_out=backend/python/petals/ --grpc_python_out=backend/python/petals/ backend/backend.proto
391392

392393
## GRPC
393394
# Note: it is duplicated in the Dockerfile
@@ -400,6 +401,7 @@ prepare-extra-conda-environments:
400401
$(MAKE) -C backend/python/transformers
401402
$(MAKE) -C backend/python/vall-e-x
402403
$(MAKE) -C backend/python/exllama
404+
$(MAKE) -C backend/python/petals
403405

404406

405407
backend-assets/grpc:

backend/python/petals/Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.PONY: petals
2+
petals:
3+
@echo "Creating virtual environment..."
4+
@conda env create --name petals --file petals.yml
5+
@echo "Virtual environment created."
6+
7+
.PONY: run
8+
run:
9+
@echo "Running petals..."
10+
bash run.sh
11+
@echo "petals run."

backend/python/petals/backend_pb2.py

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)