A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 15, 22:15 UTC
[CI/Build] Use uv in the Dockerfile (#13566)
Michael Goin committed
Feb 20, 2025 at 02:05 UTC
497bc831241276124674f94766880d386ca04a9d
1 file changed
+19
-13
Dockerfile
+19
-13
@@ -27,6 +27,9 @@ RUN echo 'tzdata tzdata/Areas select America' | debconf-set-selections \
27
&& ln -sf /usr/bin/python${PYTHON_VERSION}-config /usr/bin/python3-config \
28
&& curl -sS https://bootstrap.pypa.io/get-pip.py | python${PYTHON_VERSION} \
29
&& python3 --version && python3 -m pip --version
30
+# Install uv for faster pip installs
31
+RUN --mount=type=cache,target=/root/.cache/pip \
32
+ python3 -m pip install uv
33
34
# Upgrade to GCC 10 to avoid https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92519
35
# as it was causing spam when compiling the CUTLASS kernels
@@ -52,13 +55,13 @@ WORKDIR /workspace
55
# after this step
56
RUN --mount=type=cache,target=/root/.cache/pip \
57
if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
55
- python3 -m pip install --index-url https://download.pytorch.org/whl/nightly/cu126 "torch==2.7.0.dev20250121+cu126" "torchvision==0.22.0.dev20250121"; \
58
+ uv pip install --system --index-url https://download.pytorch.org/whl/nightly/cu126 "torch==2.7.0.dev20250121+cu126" "torchvision==0.22.0.dev20250121"; \
59
fi
60
61
COPY requirements-common.txt requirements-common.txt
62
COPY requirements-cuda.txt requirements-cuda.txt
63
RUN --mount=type=cache,target=/root/.cache/pip \
61
- python3 -m pip install -r requirements-cuda.txt
64
+ uv pip install --system -r requirements-cuda.txt
65
66
# cuda arch list used by torch
67
# can be useful for both `dev` and `test`
@@ -79,7 +82,7 @@ ARG TARGETPLATFORM
82
COPY requirements-build.txt requirements-build.txt
83
84
RUN --mount=type=cache,target=/root/.cache/pip \
82
- python3 -m pip install -r requirements-build.txt
85
+ uv pip install --system -r requirements-build.txt
86
87
COPY . .
88
ARG GIT_REPO_CHECK=0
@@ -144,7 +147,7 @@ COPY requirements-lint.txt requirements-lint.txt
147
COPY requirements-test.txt requirements-test.txt
148
COPY requirements-dev.txt requirements-dev.txt
149
RUN --mount=type=cache,target=/root/.cache/pip \
147
- python3 -m pip install -r requirements-dev.txt
150
+ uv pip install --system -r requirements-dev.txt
151
#################### DEV IMAGE ####################
152
153
#################### vLLM installation IMAGE ####################
@@ -174,6 +177,9 @@ RUN echo 'tzdata tzdata/Areas select America' | debconf-set-selections \
177
&& ln -sf /usr/bin/python${PYTHON_VERSION}-config /usr/bin/python3-config \
178
&& curl -sS https://bootstrap.pypa.io/get-pip.py | python${PYTHON_VERSION} \
179
&& python3 --version && python3 -m pip --version
180
+# Install uv for faster pip installs
181
+RUN --mount=type=cache,target=/root/.cache/pip \
182
+ python3 -m pip install uv
183
184
# Workaround for https://github.com/openai/triton/issues/2507 and
185
# https://github.com/pytorch/pytorch/issues/107960 -- hopefully
@@ -187,13 +193,13 @@ RUN ldconfig /usr/local/cuda-$(echo $CUDA_VERSION | cut -d. -f1,2)/compat/
193
# after this step
194
RUN --mount=type=cache,target=/root/.cache/pip \
195
if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
190
- python3 -m pip install --index-url https://download.pytorch.org/whl/nightly/cu124 "torch==2.6.0.dev20241210+cu124" "torchvision==0.22.0.dev20241215"; \
196
+ uv pip install --system --index-url https://download.pytorch.org/whl/nightly/cu124 "torch==2.6.0.dev20241210+cu124" "torchvision==0.22.0.dev20241215"; \
197
fi
198
199
# Install vllm wheel first, so that torch etc will be installed.
200
RUN --mount=type=bind,from=build,src=/workspace/dist,target=/vllm-workspace/dist \
201
--mount=type=cache,target=/root/.cache/pip \
196
- python3 -m pip install dist/*.whl --verbose
202
+ uv pip install --system dist/*.whl --verbose
203
204
# If we need to build FlashInfer wheel before its release:
205
# $ export FLASHINFER_ENABLE_AOT=1
@@ -210,7 +216,7 @@ RUN --mount=type=bind,from=build,src=/workspace/dist,target=/vllm-workspace/dist
216
RUN --mount=type=cache,target=/root/.cache/pip \
217
. /etc/environment && \
218
if [ "$TARGETPLATFORM" != "linux/arm64" ]; then \
213
- python3 -m pip install https://github.com/flashinfer-ai/flashinfer/releases/download/v0.2.1.post1/flashinfer_python-0.2.1.post1+cu124torch2.5-cp38-abi3-linux_x86_64.whl ; \
219
+ uv pip install --system https://github.com/flashinfer-ai/flashinfer/releases/download/v0.2.1.post1/flashinfer_python-0.2.1.post1+cu124torch2.5-cp38-abi3-linux_x86_64.whl ; \
220
fi
221
COPY examples examples
222
@@ -220,7 +226,7 @@ COPY examples examples
226
# TODO: Remove this once FlashInfer AOT wheel is fixed
227
COPY requirements-build.txt requirements-build.txt
228
RUN --mount=type=cache,target=/root/.cache/pip \
223
- python3 -m pip install -r requirements-build.txt
229
+ uv pip install --system -r requirements-build.txt
230
231
#################### vLLM installation IMAGE ####################
232
@@ -233,15 +239,15 @@ ADD . /vllm-workspace/
239
240
# install development dependencies (for testing)
241
RUN --mount=type=cache,target=/root/.cache/pip \
236
- python3 -m pip install -r requirements-dev.txt
242
+ uv pip install --system -r requirements-dev.txt
243
244
# install development dependencies (for testing)
245
RUN --mount=type=cache,target=/root/.cache/pip \
240
- python3 -m pip install -e tests/vllm_test_utils
246
+ uv pip install --system -e tests/vllm_test_utils
247
248
# enable fast downloads from hf (for testing)
249
RUN --mount=type=cache,target=/root/.cache/pip \
244
- python3 -m pip install hf_transfer
250
+ uv pip install --system hf_transfer
251
ENV HF_HUB_ENABLE_HF_TRANSFER 1
252
253
# Copy in the v1 package for testing (it isn't distributed yet)
@@ -262,9 +268,9 @@ FROM vllm-base AS vllm-openai-base
268
# install additional dependencies for openai api server
269
RUN --mount=type=cache,target=/root/.cache/pip \
270
if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
265
- pip install accelerate hf_transfer 'modelscope!=1.15.0' 'bitsandbytes>=0.42.0' 'timm==0.9.10' boto3 runai-model-streamer runai-model-streamer[s3]; \
271
+ uv pip install --system accelerate hf_transfer 'modelscope!=1.15.0' 'bitsandbytes>=0.42.0' 'timm==0.9.10' boto3 runai-model-streamer runai-model-streamer[s3]; \
272
else \
267
- pip install accelerate hf_transfer 'modelscope!=1.15.0' 'bitsandbytes>=0.45.0' 'timm==0.9.10' boto3 runai-model-streamer runai-model-streamer[s3]; \
273
+ uv pip install --system accelerate hf_transfer 'modelscope!=1.15.0' 'bitsandbytes>=0.45.0' 'timm==0.9.10' boto3 runai-model-streamer runai-model-streamer[s3]; \
274
fi
275
276
ENV VLLM_USAGE_SOURCE production-docker-image