Skip to content

Commit

Permalink
fix(python): move accelerate and GPU-specific libs to build-type (#3194)
Browse files Browse the repository at this point in the history
Some of the dependencies in `requirements.txt`, even if generic, pulls
down the line CUDA libraries.

This changes moves mostly all GPU-specific libs to the build-type, and
tries a safer approach. In `requirements.txt` now are listed only
"first-level" dependencies, for instance, grpc, but libs-dependencies
are moved down to the respective build-type `requirements.txt` to avoid
any mixin.

This should fix #2737 and #1592.

Signed-off-by: Ettore Di Giacinto <[email protected]>
  • Loading branch information
mudler authored Aug 7, 2024
1 parent abcf0ff commit 61b5602
Show file tree
Hide file tree
Showing 79 changed files with 212 additions and 61 deletions.
4 changes: 4 additions & 0 deletions backend/python/bark/requirements-cpu.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
transformers
accelerate
torch
torchaudio
4 changes: 3 additions & 1 deletion backend/python/bark/requirements-cublas11.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
--extra-index-url https://download.pytorch.org/whl/cu118
torch
torchaudio
torchaudio
transformers
accelerate
4 changes: 3 additions & 1 deletion backend/python/bark/requirements-cublas12.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
torch
torchaudio
torchaudio
transformers
accelerate
4 changes: 3 additions & 1 deletion backend/python/bark/requirements-hipblas.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
--extra-index-url https://download.pytorch.org/whl/rocm6.0
torch
torchaudio
torchaudio
transformers
accelerate
4 changes: 3 additions & 1 deletion backend/python/bark/requirements-intel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ intel-extension-for-pytorch
torch
torchaudio
optimum[openvino]
setuptools==70.3.0 # https://github.com/mudler/LocalAI/issues/2406
setuptools==70.3.0 # https://github.com/mudler/LocalAI/issues/2406
transformers
accelerate
4 changes: 1 addition & 3 deletions backend/python/bark/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
accelerate
bark==0.1.5
grpcio==1.65.4
protobuf
certifi
transformers
certifi
3 changes: 3 additions & 0 deletions backend/python/coqui/requirements-cpu.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
transformers
accelerate
torch
4 changes: 3 additions & 1 deletion backend/python/coqui/requirements-cublas11.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
--extra-index-url https://download.pytorch.org/whl/cu118
torch
torchaudio
torchaudio
transformers
accelerate
4 changes: 3 additions & 1 deletion backend/python/coqui/requirements-cublas12.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
torch
torchaudio
torchaudio
transformers
accelerate
4 changes: 3 additions & 1 deletion backend/python/coqui/requirements-hipblas.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
--extra-index-url https://download.pytorch.org/whl/rocm6.0
torch
torchaudio
torchaudio
transformers
accelerate
4 changes: 3 additions & 1 deletion backend/python/coqui/requirements-intel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ intel-extension-for-pytorch
torch
torchaudio
optimum[openvino]
setuptools==72.1.0 # https://github.com/mudler/LocalAI/issues/2406
setuptools==72.1.0 # https://github.com/mudler/LocalAI/issues/2406
transformers
accelerate
4 changes: 1 addition & 3 deletions backend/python/coqui/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
accelerate
TTS==0.22.0
grpcio==1.65.4
protobuf
certifi
transformers
certifi
8 changes: 8 additions & 0 deletions backend/python/diffusers/requirements-cpu.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
diffusers
opencv-python
transformers
accelerate
compel
peft
sentencepiece
torch
7 changes: 7 additions & 0 deletions backend/python/diffusers/requirements-cublas11.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
--extra-index-url https://download.pytorch.org/whl/cu118
torch
diffusers
opencv-python
transformers
accelerate
compel
peft
sentencepiece
7 changes: 7 additions & 0 deletions backend/python/diffusers/requirements-cublas12.txt
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
torch
diffusers
opencv-python
transformers
accelerate
compel
peft
sentencepiece
9 changes: 8 additions & 1 deletion backend/python/diffusers/requirements-hipblas.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
--extra-index-url https://download.pytorch.org/whl/rocm6.0
torch
torchvision
torchvision
diffusers
opencv-python
transformers
accelerate
compel
peft
sentencepiece
9 changes: 8 additions & 1 deletion backend/python/diffusers/requirements-intel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,11 @@ intel-extension-for-pytorch
torch
torchvision
optimum[openvino]
setuptools==70.3.0 # https://github.com/mudler/LocalAI/issues/2406
setuptools==70.3.0 # https://github.com/mudler/LocalAI/issues/2406
diffusers
opencv-python
transformers
accelerate
compel
peft
sentencepiece
3 changes: 3 additions & 0 deletions backend/python/exllama/requirements-cpu.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
transformers
accelerate
torch
2 changes: 2 additions & 0 deletions backend/python/exllama/requirements-cublas11.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
--extra-index-url https://download.pytorch.org/whl/cu118
torch
transformers
accelerate
2 changes: 2 additions & 0 deletions backend/python/exllama/requirements-cublas12.txt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
torch
transformers
accelerate
1 change: 0 additions & 1 deletion backend/python/exllama/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
grpcio==1.65.0
protobuf
transformers
certifi
setuptools
3 changes: 3 additions & 0 deletions backend/python/exllama2/requirements-cpu.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
transformers
accelerate
torch
2 changes: 2 additions & 0 deletions backend/python/exllama2/requirements-cublas11.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
--extra-index-url https://download.pytorch.org/whl/cu118
torch
transformers
accelerate
2 changes: 2 additions & 0 deletions backend/python/exllama2/requirements-cublas12.txt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
torch
transformers
accelerate
1 change: 0 additions & 1 deletion backend/python/exllama2/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
accelerate
grpcio==1.65.4
protobuf
certifi
Expand Down
3 changes: 2 additions & 1 deletion backend/python/mamba/requirements-cpu.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
torch
torch
transformers
3 changes: 2 additions & 1 deletion backend/python/mamba/requirements-cublas11.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
--extra-index-url https://download.pytorch.org/whl/cu118
torch
torch
transformers
3 changes: 2 additions & 1 deletion backend/python/mamba/requirements-cublas12.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
torch
torch
transformers
3 changes: 1 addition & 2 deletions backend/python/mamba/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
grpcio==1.65.1
protobuf
certifi
transformers
certifi
1 change: 1 addition & 0 deletions backend/python/openvoice/requirements-cpu.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
torch
3 changes: 3 additions & 0 deletions backend/python/parler-tts/requirements-cpu.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
transformers
accelerate
torch
4 changes: 3 additions & 1 deletion backend/python/parler-tts/requirements-cublas11.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
--extra-index-url https://download.pytorch.org/whl/cu118
torch
torchaudio
torchaudio
transformers
accelerate
4 changes: 3 additions & 1 deletion backend/python/parler-tts/requirements-cublas12.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
torch
torchaudio
torchaudio
transformers
accelerate
4 changes: 3 additions & 1 deletion backend/python/parler-tts/requirements-hipblas.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
--extra-index-url https://download.pytorch.org/whl/rocm6.0
torch
torchaudio
torchaudio
transformers
accelerate
4 changes: 3 additions & 1 deletion backend/python/parler-tts/requirements-intel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ intel-extension-for-pytorch
torch
torchaudio
optimum[openvino]
setuptools==72.1.0 # https://github.com/mudler/LocalAI/issues/2406
setuptools==72.1.0 # https://github.com/mudler/LocalAI/issues/2406
transformers
accelerate
4 changes: 1 addition & 3 deletions backend/python/parler-tts/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
accelerate
grpcio==1.65.1
protobuf
git+https://github.com/huggingface/parler-tts.git@10016fb0300c0dc31a0fb70e26f3affee7b62f16
certifi
transformers
certifi
3 changes: 3 additions & 0 deletions backend/python/petals/requirements-cpu.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
transformers
accelerate
torch
1 change: 1 addition & 0 deletions backend/python/petals/requirements-cublas11.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
--extra-index-url https://download.pytorch.org/whl/cu118
torch
transformers
1 change: 1 addition & 0 deletions backend/python/petals/requirements-cublas12.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
torch
transformers
1 change: 1 addition & 0 deletions backend/python/petals/requirements-hipblas.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
--extra-index-url https://download.pytorch.org/whl/rocm6.0
torch
transformers
3 changes: 2 additions & 1 deletion backend/python/petals/requirements-intel.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
intel-extension-for-pytorch
torch
optimum[openvino]
setuptools==72.1.0 # https://github.com/mudler/LocalAI/issues/2406
setuptools==72.1.0 # https://github.com/mudler/LocalAI/issues/2406
transformers
3 changes: 1 addition & 2 deletions backend/python/petals/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
git+https://github.com/bigscience-workshop/petals
certifi
transformers
certifi
4 changes: 4 additions & 0 deletions backend/python/rerankers/requirements-cpu.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
transformers
accelerate
torch
rerankers[transformers]
3 changes: 3 additions & 0 deletions backend/python/rerankers/requirements-cublas11.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
--extra-index-url https://download.pytorch.org/whl/cu118
transformers
accelerate
torch
rerankers[transformers]
3 changes: 3 additions & 0 deletions backend/python/rerankers/requirements-cublas12.txt
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
transformers
accelerate
torch
rerankers[transformers]
5 changes: 4 additions & 1 deletion backend/python/rerankers/requirements-hipblas.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
--extra-index-url https://download.pytorch.org/whl/rocm6.0
torch
transformers
accelerate
torch
rerankers[transformers]
3 changes: 3 additions & 0 deletions backend/python/rerankers/requirements-intel.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
--extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/
intel-extension-for-pytorch
transformers
accelerate
torch
rerankers[transformers]
optimum[openvino]
setuptools==72.1.0 # https://github.com/mudler/LocalAI/issues/2406
5 changes: 1 addition & 4 deletions backend/python/rerankers/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
accelerate
rerankers[transformers]
grpcio==1.65.4
protobuf
certifi
transformers
certifi
6 changes: 6 additions & 0 deletions backend/python/sentencetransformers/requirements-cpu.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
torch
accelerate
transformers
bitsandbytes
sentence-transformers==3.0.1
transformers
3 changes: 3 additions & 0 deletions backend/python/sentencetransformers/requirements-cublas11.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
--extra-index-url https://download.pytorch.org/whl/cu118
torch
accelerate
sentence-transformers==3.0.1
transformers
3 changes: 3 additions & 0 deletions backend/python/sentencetransformers/requirements-cublas12.txt
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
torch
accelerate
sentence-transformers==3.0.1
transformers
5 changes: 4 additions & 1 deletion backend/python/sentencetransformers/requirements-hipblas.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
--extra-index-url https://download.pytorch.org/whl/rocm6.0
torch
torch
accelerate
sentence-transformers==3.0.1
transformers
Loading

0 comments on commit 61b5602

Please sign in to comment.