CrazyMonkey0 commited on
Commit
5adcb69
·
1 Parent(s): 3768374

feat(docker): install llama-cpp-python directly with OpenBLAS

Browse files
Files changed (2) hide show
  1. Dockerfile +29 -41
  2. requirements.txt +60 -6
Dockerfile CHANGED
@@ -1,63 +1,51 @@
1
- FROM python:3.12-alpine
2
 
3
- # Ustaw katalog roboczy
4
  WORKDIR /app
5
 
6
- # Podstawowe zależności systemowe potrzebne do ML i audio
7
- RUN apk add --no-cache \
8
- bash \
9
- curl \
10
- wget \
11
- git \
12
- build-base \
13
  gcc \
14
  g++ \
15
- make \
16
  cmake \
17
- musl-dev \
18
- linux-headers \
19
- libstdc++ \
20
- libgcc \
21
- libffi-dev \
22
- openblas-dev \
23
- lapack-dev \
24
- freetype-dev \
25
- libpng-dev \
26
- espeak-ng \
27
  sox \
28
  ffmpeg \
29
- bash-completion \
30
- zlib-dev \
31
- xz-dev \
32
- tiff-dev \
33
- jpeg-dev \
 
 
 
 
34
  gfortran \
35
- pkgconfig \
36
- curl-dev \
37
- openssl-dev \
38
- bzip2-dev \
39
- xz-dev \
40
- git-lfs \
41
- && rm -rf /var/cache/apk/*
42
 
43
- # Skopiuj plik z wymaganiami
44
  COPY requirements.txt /app/requirements.txt
45
 
46
  # Upgrade pip
47
  RUN pip install --upgrade pip setuptools wheel
48
 
49
- # Zainstaluj prebuilt wheel llama-cpp-python dla Alpine
50
- RUN pip install --no-cache-dir \
51
- https://github.com/abetlen/llama-cpp-python/releases/download/v0.3.2/llama_cpp_python-0.3.2-cp312-cp312-linux_x86_64.whl
52
-
53
- # Instalacja zależności z requirements
54
  RUN pip install --no-cache-dir -r requirements.txt
55
 
56
- # Skopiuj resztę aplikacji
 
 
 
 
57
  COPY . /app
58
 
59
- # Ustaw port
60
  EXPOSE 7860
61
 
62
- # Uruchomienie aplikacji FastAPI przez Gunicorn
63
  CMD ["gunicorn", "app.main:app", "-k", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:7860", "--workers", "1", "--timeout", "120"]
 
1
+ FROM python:3.12-slim-bookworm
2
 
 
3
  WORKDIR /app
4
 
5
+ # Install essential system dependencies
6
+ RUN apt-get update && apt-get install -y --no-install-recommends \
7
+ build-essential \
 
 
 
 
8
  gcc \
9
  g++ \
 
10
  cmake \
11
+ git \
12
+ git-lfs \
13
+ wget \
14
+ curl \
 
 
 
 
 
 
15
  sox \
16
  ffmpeg \
17
+ espeak-ng \
18
+ libffi-dev \
19
+ libopenblas-dev \
20
+ liblapack-dev \
21
+ libfreetype6-dev \
22
+ libpng-dev \
23
+ zlib1g-dev \
24
+ libbz2-dev \
25
+ libjpeg-dev \
26
  gfortran \
27
+ pkg-config \
28
+ bash-completion \
29
+ && rm -rf /var/lib/apt/lists/*
 
 
 
 
30
 
31
+ # Copy Python requirements
32
  COPY requirements.txt /app/requirements.txt
33
 
34
  # Upgrade pip
35
  RUN pip install --upgrade pip setuptools wheel
36
 
37
+ # Install dependencies from requirements
 
 
 
 
38
  RUN pip install --no-cache-dir -r requirements.txt
39
 
40
+ # Build and install llama-cpp-python with OpenBLAS
41
+ ENV CMAKE_ARGS="-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS"
42
+ RUN pip install --no-cache-dir llama-cpp-python
43
+
44
+ # Copy the rest of the application
45
  COPY . /app
46
 
47
+ # Expose port
48
  EXPOSE 7860
49
 
50
+ # Run FastAPI with Gunicorn
51
  CMD ["gunicorn", "app.main:app", "-k", "uvicorn.workers.UvicornWorker", "--bind", "0.0.0.0:7860", "--workers", "1", "--timeout", "120"]
requirements.txt CHANGED
@@ -1,6 +1,7 @@
1
  absl-py==2.1.0
2
  accelerate==1.5.2
3
  addict==2.4.0
 
4
  aiohttp==3.11.13
5
  aiosignal==1.3.2
6
  annotated-types==0.7.0
@@ -20,15 +21,20 @@ cloudpathlib==0.21.0
20
  colorama==0.4.6
21
  confection==0.1.5
22
  csvw==3.5.1
 
 
23
  cymem==2.0.11
24
  datasets==3.4.0
25
  decorator==5.2.1
26
  dill==0.3.8
27
  diskcache==5.6.3
 
 
28
  dnspython==2.7.0
 
29
  email_validator==2.2.0
30
- en_core_web_sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.8.0/en_core_web_sm-3.8.0-py3-none-any.whl
31
- espeakng-loader==0.1.51.0
32
  executing==2.2.0
33
  fastapi==0.115.11
34
  fastapi-cli==0.0.7
@@ -50,6 +56,7 @@ huggingface-hub==0.29.3
50
  idna==3.10
51
  inflect==7.5.0
52
  ipython==9.0.2
 
53
  isodate==0.7.2
54
  itsdangerous==2.2.0
55
  jedi==0.19.2
@@ -61,7 +68,9 @@ keras==3.9.0
61
  kokoro==0.9.4
62
  langcodes==3.5.0
63
  language-tags==1.2.0
 
64
  lazy_loader==0.4
 
65
  librosa==0.11.0
66
  llvmlite==0.44.0
67
  loguru==0.7.3
@@ -70,30 +79,58 @@ Markdown==3.7
70
  markdown-it-py==3.0.0
71
  MarkupSafe==3.0.2
72
  matplotlib-inline==0.1.7
 
 
73
  ml_dtypes==0.5.1
74
  more-itertools==10.6.0
75
  mpmath==1.3.0
76
  msgpack==1.1.0
77
  multidict==6.1.0
 
 
 
78
  networkx==3.4.2
79
  nltk==3.9.1
80
  num2words==0.5.14
81
  numba==0.61.0
82
- numpy==1.25.2
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  opt_einsum==3.4.0
 
84
  orjson==3.10.15
85
  packaging==24.2
86
  pandas==2.2.3
 
87
  pexpect==4.9.0
88
  phonemizer-fork==3.3.2
89
  platformdirs==4.3.6
90
  pooch==1.8.2
91
  preshed==3.0.9
92
  prompt_toolkit==3.0.50
 
93
  protobuf==5.29.3
94
  psutil==7.0.0
 
 
 
 
95
  pycparser==2.22
96
  pydantic==2.10.6
 
 
 
97
  Pygments==2.19.1
98
  pyparsing==3.2.1
99
  python-dateutil==2.9.0.post0
@@ -101,26 +138,38 @@ python-dotenv==1.0.1
101
  python-multipart==0.0.20
102
  pytz==2025.1
103
  PyYAML==6.0.2
 
 
104
  regex==2024.11.6
105
  requests==2.32.3
 
106
  rich==13.9.4
 
 
107
  sacremoses==0.1.1
 
108
  scikit-learn==1.6.1
109
- scipy==1.10.1
 
110
  sentencepiece==0.2.0
111
  setuptools==76.0.0
 
112
  six==1.17.0
 
 
113
  soundfile==0.13.1
114
  soxr==0.5.0.post1
115
  spacy==3.8.4
116
  spacy-curated-transformers==0.3.0
117
  spacy-legacy==3.0.12
 
118
  srsly==2.5.1
 
119
  starlette==0.46.1
120
  sympy==1.13.1
121
  tensorboard==2.19.0
122
  tensorboard-data-server==0.7.2
123
- tensorflow-cpu==2.19.0
124
  termcolor==2.5.0
125
  thinc==8.3.4
126
  threadpoolctl==3.6.0
@@ -128,20 +177,25 @@ tokenizers==0.21.1
128
  torch==2.6.0
129
  torchaudio==2.6.0
130
  tqdm==4.67.1
 
131
  transformers==4.49.0
 
 
 
132
  typing_extensions==4.12.2
133
  tzdata==2025.1
134
  ujson==5.10.0
 
135
  urllib3==2.3.0
136
  uvicorn==0.34.0
137
  uvloop==0.21.0
138
  wasabi==1.1.3
139
  watchfiles==1.0.4
140
  wcwidth==0.2.13
 
141
  websockets==15.0.1
142
  Werkzeug==3.1.3
143
  wheel==0.45.1
144
  wrapt==1.17.2
145
  xxhash==3.5.0
146
  yarl==1.18.3
147
-
 
1
  absl-py==2.1.0
2
  accelerate==1.5.2
3
  addict==2.4.0
4
+ aiohappyeyeballs==2.6.1
5
  aiohttp==3.11.13
6
  aiosignal==1.3.2
7
  annotated-types==0.7.0
 
21
  colorama==0.4.6
22
  confection==0.1.5
23
  csvw==3.5.1
24
+ curated-tokenizers==0.0.9
25
+ curated-transformers==0.1.1
26
  cymem==2.0.11
27
  datasets==3.4.0
28
  decorator==5.2.1
29
  dill==0.3.8
30
  diskcache==5.6.3
31
+ Distance==0.1.3
32
+ dlinfo==2.0.0
33
  dnspython==2.7.0
34
+ docopt==0.6.2
35
  email_validator==2.2.0
36
+ en_core_web_sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.8.0/en_core_web_sm-3.8.0-py3-none-any.whl#sha256=1932429db727d4bff3deed6b34cfc05df17794f4a52eeb26cf8928f7c1a0fb85
37
+ espeakng-loader==0.2.4
38
  executing==2.2.0
39
  fastapi==0.115.11
40
  fastapi-cli==0.0.7
 
56
  idna==3.10
57
  inflect==7.5.0
58
  ipython==9.0.2
59
+ ipython_pygments_lexers==1.1.1
60
  isodate==0.7.2
61
  itsdangerous==2.2.0
62
  jedi==0.19.2
 
68
  kokoro==0.9.4
69
  langcodes==3.5.0
70
  language-tags==1.2.0
71
+ language_data==1.3.0
72
  lazy_loader==0.4
73
+ libclang==18.1.1
74
  librosa==0.11.0
75
  llvmlite==0.44.0
76
  loguru==0.7.3
 
79
  markdown-it-py==3.0.0
80
  MarkupSafe==3.0.2
81
  matplotlib-inline==0.1.7
82
+ mdurl==0.1.2
83
+ misaki==0.9.4
84
  ml_dtypes==0.5.1
85
  more-itertools==10.6.0
86
  mpmath==1.3.0
87
  msgpack==1.1.0
88
  multidict==6.1.0
89
+ multiprocess==0.70.16
90
+ murmurhash==1.0.12
91
+ namex==0.0.8
92
  networkx==3.4.2
93
  nltk==3.9.1
94
  num2words==0.5.14
95
  numba==0.61.0
96
+ numpy==1.26.4
97
+ nvidia-cublas-cu12==12.4.5.8
98
+ nvidia-cuda-cupti-cu12==12.4.127
99
+ nvidia-cuda-nvrtc-cu12==12.4.127
100
+ nvidia-cuda-runtime-cu12==12.4.127
101
+ nvidia-cudnn-cu12==9.1.0.70
102
+ nvidia-cufft-cu12==11.2.1.3
103
+ nvidia-curand-cu12==10.3.5.147
104
+ nvidia-cusolver-cu12==11.6.1.9
105
+ nvidia-cusparse-cu12==12.3.1.170
106
+ nvidia-cusparselt-cu12==0.6.2
107
+ nvidia-nccl-cu12==2.21.5
108
+ nvidia-nvjitlink-cu12==12.4.127
109
+ nvidia-nvtx-cu12==12.4.127
110
  opt_einsum==3.4.0
111
+ optree==0.14.1
112
  orjson==3.10.15
113
  packaging==24.2
114
  pandas==2.2.3
115
+ parso==0.8.4
116
  pexpect==4.9.0
117
  phonemizer-fork==3.3.2
118
  platformdirs==4.3.6
119
  pooch==1.8.2
120
  preshed==3.0.9
121
  prompt_toolkit==3.0.50
122
+ propcache==0.3.0
123
  protobuf==5.29.3
124
  psutil==7.0.0
125
+ ptyprocess==0.7.0
126
+ pure_eval==0.2.3
127
+ py-cpuinfo==9.0.0
128
+ pyarrow==19.0.1
129
  pycparser==2.22
130
  pydantic==2.10.6
131
+ pydantic-extra-types==2.10.3
132
+ pydantic-settings==2.8.1
133
+ pydantic_core==2.27.2
134
  Pygments==2.19.1
135
  pyparsing==3.2.1
136
  python-dateutil==2.9.0.post0
 
138
  python-multipart==0.0.20
139
  pytz==2025.1
140
  PyYAML==6.0.2
141
+ rdflib==7.1.3
142
+ referencing==0.36.2
143
  regex==2024.11.6
144
  requests==2.32.3
145
+ rfc3986==1.5.0
146
  rich==13.9.4
147
+ rich-toolkit==0.13.2
148
+ rpds-py==0.23.1
149
  sacremoses==0.1.1
150
+ safetensors==0.5.3
151
  scikit-learn==1.6.1
152
+ scipy==1.15.2
153
+ segments==2.3.0
154
  sentencepiece==0.2.0
155
  setuptools==76.0.0
156
+ shellingham==1.5.4
157
  six==1.17.0
158
+ smart-open==7.1.0
159
+ sniffio==1.3.1
160
  soundfile==0.13.1
161
  soxr==0.5.0.post1
162
  spacy==3.8.4
163
  spacy-curated-transformers==0.3.0
164
  spacy-legacy==3.0.12
165
+ spacy-loggers==1.0.5
166
  srsly==2.5.1
167
+ stack-data==0.6.3
168
  starlette==0.46.1
169
  sympy==1.13.1
170
  tensorboard==2.19.0
171
  tensorboard-data-server==0.7.2
172
+ tensorflow==2.19.0
173
  termcolor==2.5.0
174
  thinc==8.3.4
175
  threadpoolctl==3.6.0
 
177
  torch==2.6.0
178
  torchaudio==2.6.0
179
  tqdm==4.67.1
180
+ traitlets==5.14.3
181
  transformers==4.49.0
182
+ triton==3.2.0
183
+ typeguard==4.4.2
184
+ typer==0.15.2
185
  typing_extensions==4.12.2
186
  tzdata==2025.1
187
  ujson==5.10.0
188
+ uritemplate==4.1.1
189
  urllib3==2.3.0
190
  uvicorn==0.34.0
191
  uvloop==0.21.0
192
  wasabi==1.1.3
193
  watchfiles==1.0.4
194
  wcwidth==0.2.13
195
+ weasel==0.4.1
196
  websockets==15.0.1
197
  Werkzeug==3.1.3
198
  wheel==0.45.1
199
  wrapt==1.17.2
200
  xxhash==3.5.0
201
  yarl==1.18.3