Skip to content

Commit 603d33a

Browse files
dtrifiroyoukaichao
authored andcommitted
[CI/Build] use setuptools-scm to set __version__ (vllm-project#4738)
Co-authored-by: youkaichao <[email protected]>
1 parent 7bb3463 commit 603d33a

16 files changed

+94
-95
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,5 +196,8 @@ _build/
196196
*_hip*
197197
hip_compat.h
198198

199+
# version file generated by setuptools-scm
200+
/vllm/_version.py
201+
199202
# Benchmark dataset
200203
benchmarks/*.json

Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,13 @@ ENV MAX_JOBS=${max_jobs}
7979
ARG nvcc_threads=8
8080
ENV NVCC_THREADS=$nvcc_threads
8181

82-
ARG buildkite_commit
83-
ENV BUILDKITE_COMMIT=${buildkite_commit}
84-
8582
ARG USE_SCCACHE
8683
ARG SCCACHE_BUCKET_NAME=vllm-build-sccache
8784
ARG SCCACHE_REGION_NAME=us-west-2
8885
ARG SCCACHE_S3_NO_CREDENTIALS=0
8986
# if USE_SCCACHE is set, use sccache to speed up compilation
9087
RUN --mount=type=cache,target=/root/.cache/pip \
88+
--mount=type=bind,source=.git,target=.git \
9189
if [ "$USE_SCCACHE" = "1" ]; then \
9290
echo "Installing sccache..." \
9391
&& curl -L -o sccache.tar.gz https://github.com/mozilla/sccache/releases/download/v0.8.1/sccache-v0.8.1-x86_64-unknown-linux-musl.tar.gz \
@@ -107,6 +105,7 @@ RUN --mount=type=cache,target=/root/.cache/pip \
107105
ENV CCACHE_DIR=/root/.cache/ccache
108106
RUN --mount=type=cache,target=/root/.cache/ccache \
109107
--mount=type=cache,target=/root/.cache/pip \
108+
--mount=type=bind,source=.git,target=.git \
110109
if [ "$USE_SCCACHE" != "1" ]; then \
111110
python3 setup.py bdist_wheel --dist-dir=dist --py-limited-api=cp38; \
112111
fi

Dockerfile.cpu

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,10 @@ ENV VLLM_CPU_DISABLE_AVX512=${VLLM_CPU_DISABLE_AVX512}
6262

6363
RUN --mount=type=cache,target=/root/.cache/pip \
6464
--mount=type=cache,target=/root/.cache/ccache \
65+
--mount=type=bind,source=.git,target=.git \
6566
VLLM_TARGET_DEVICE=cpu python3 setup.py bdist_wheel && \
66-
pip install dist/*.whl
67+
pip install dist/*.whl && \
68+
rm -rf dist
6769

6870
WORKDIR /workspace/
6971

Dockerfile.neuron

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ FROM $BASE_IMAGE
66
RUN echo "Base image is $BASE_IMAGE"
77

88
# Install some basic utilities
9-
RUN apt-get update \
10-
&& apt-get install python3 python3-pip -y \
11-
&& apt-get install -y ffmpeg libsm6 libxext6 libgl1
9+
RUN apt-get update && \
10+
apt-get install -y \
11+
git \
12+
python3 \
13+
python3-pip \
14+
ffmpeg libsm6 libxext6 libgl1
1215

1316
### Mount Point ###
1417
# When launching the container, mount the code directory to /app
@@ -22,17 +25,17 @@ RUN python3 -m pip install sentencepiece transformers==4.36.2 -U
2225
RUN python3 -m pip install transformers-neuronx --extra-index-url=https://pip.repos.neuron.amazonaws.com -U
2326
RUN python3 -m pip install --pre neuronx-cc==2.15.* --extra-index-url=https://pip.repos.neuron.amazonaws.com -U
2427

25-
COPY ./vllm /app/vllm/vllm
26-
COPY ./setup.py /app/vllm/setup.py
27-
COPY ./requirements-common.txt /app/vllm/requirements-common.txt
28-
COPY ./requirements-neuron.txt /app/vllm/requirements-neuron.txt
28+
COPY . /app/vllm
2929

3030
RUN cd /app/vllm \
31-
&& python3 -m pip install -U -r requirements-neuron.txt
31+
&& python3 -m pip install -U \
32+
cmake>=3.26 ninja packaging setuptools-scm>=8 wheel jinja2 \
33+
-r requirements-neuron.txt
3234

3335
ENV VLLM_TARGET_DEVICE neuron
34-
RUN cd /app/vllm \
35-
&& pip install -e . \
36+
RUN --mount=type=bind,source=.git,target=.git \
37+
cd /app/vllm \
38+
&& pip install --no-build-isolation -v -e . \
3639
&& cd ..
3740

3841
CMD ["/bin/bash"]

Dockerfile.openvino

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
FROM ubuntu:22.04 AS dev
55

66
RUN apt-get update -y && \
7-
apt-get install -y python3-pip git && \
8-
apt-get install -y ffmpeg libsm6 libxext6 libgl1
7+
apt-get install -y \
8+
git python3-pip \
9+
ffmpeg libsm6 libxext6 libgl1
910
WORKDIR /workspace
1011

1112
# copy requirements

Dockerfile.ppc64le

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,15 @@ COPY ./ /workspace/vllm
1616
WORKDIR /workspace/vllm
1717

1818
# These packages will be in rocketce eventually
19-
RUN pip install -v cmake xformers torch==2.3.1 uvloop==0.20.0 -r requirements-cpu.txt --prefer-binary --extra-index-url https://repo.fury.io/mgiessing
20-
21-
RUN VLLM_TARGET_DEVICE=cpu python3 setup.py install
19+
RUN --mount=type=cache,target=/root/.cache/pip \
20+
pip install -v --prefer-binary --extra-index-url https://repo.fury.io/mgiessing \
21+
cmake>=3.26 ninja packaging setuptools-scm>=8 wheel jinja2 \
22+
torch==2.3.1 \
23+
-r requirements-cpu.txt \
24+
xformers uvloop==0.20.0
25+
26+
RUN --mount=type=bind,source=.git,target=.git \
27+
VLLM_TARGET_DEVICE=cpu python3 setup.py install
2228

2329
WORKDIR /workspace/
2430

Dockerfile.rocm

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,15 @@ RUN python3 -m pip install --upgrade pip
5151
# TODO: implement sccache support across components
5252
RUN apt-get purge -y sccache; python3 -m pip uninstall -y sccache; rm -f "$(which sccache)"
5353
# Install torch == 2.5.0 on ROCm
54-
RUN case "$(ls /opt | grep -Po 'rocm-[0-9]\.[0-9]')" in \
54+
RUN --mount=type=cache,target=/root/.cache/pip \
55+
case "$(ls /opt | grep -Po 'rocm-[0-9]\.[0-9]')" in \
5556
*"rocm-6.1"*) \
5657
python3 -m pip uninstall -y torch torchvision \
57-
&& python3 -m pip install --no-cache-dir --pre \
58+
&& python3 -m pip install --pre \
5859
torch==2.5.0.dev20240726 \
60+
cmake>=3.26 ninja packaging setuptools-scm>=8 wheel jinja2 \
5961
torchvision==0.20.0.dev20240726 \
60-
--index-url https://download.pytorch.org/whl/nightly/rocm6.1;; \
62+
--extra-index-url https://download.pytorch.org/whl/nightly/rocm6.1 ;; \
6163
*) ;; esac
6264

6365
ENV LLVM_SYMBOLIZER_PATH=/opt/rocm/llvm/bin/llvm-symbolizer
@@ -138,6 +140,7 @@ ENV RAY_EXPERIMENTAL_NOSET_ROCR_VISIBLE_DEVICES=1
138140
ENV TOKENIZERS_PARALLELISM=false
139141

140142
RUN --mount=type=cache,target=${CCACHE_DIR} \
143+
--mount=type=bind,source=.git,target=.git \
141144
--mount=type=cache,target=/root/.cache/pip \
142145
python3 -m pip install -Ur requirements-rocm.txt \
143146
&& case "$(ls /opt | grep -Po 'rocm-[0-9]\.[0-9]')" in \

Dockerfile.tpu

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,25 @@ FROM $BASE_IMAGE
55
WORKDIR /workspace
66

77
# Install some basic utilities
8-
RUN apt-get update && apt-get install -y ffmpeg libsm6 libxext6 libgl1
8+
RUN apt-get update && apt-get install -y \
9+
git \
10+
ffmpeg libsm6 libxext6 libgl1
911

1012
# Install the TPU and Pallas dependencies.
11-
RUN python3 -m pip install torch_xla[tpu] -f https://storage.googleapis.com/libtpu-releases/index.html
12-
RUN python3 -m pip install torch_xla[pallas] -f https://storage.googleapis.com/jax-releases/jax_nightly_releases.html -f https://storage.googleapis.com/jax-releases/jaxlib_nightly_releases.html
13+
RUN --mount=type=cache,target=/root/.cache/pip \
14+
python3 -m pip install torch_xla[tpu] -f https://storage.googleapis.com/libtpu-releases/index.html
15+
RUN --mount=type=cache,target=/root/.cache/pip \
16+
python3 -m pip install torch_xla[pallas] -f https://storage.googleapis.com/jax-releases/jax_nightly_releases.html -f https://storage.googleapis.com/jax-releases/jaxlib_nightly_releases.html
1317

1418
# Build vLLM.
1519
COPY . /workspace/vllm
1620
ENV VLLM_TARGET_DEVICE="tpu"
17-
RUN cd /workspace/vllm && python3 -m pip install -r requirements-tpu.txt
21+
RUN --mount=type=cache,target=/root/.cache/pip \
22+
--mount=type=bind,source=.git,target=.git \
23+
cd /workspace/vllm && \
24+
python3 -m pip install \
25+
cmake>=3.26 ninja packaging setuptools-scm>=8 wheel jinja2 \
26+
-r requirements-tpu.txt
1827
RUN cd /workspace/vllm && python3 setup.py develop
1928

2029
CMD ["/bin/bash"]

Dockerfile.xpu

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,20 @@ RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRO
77
echo "deb [arch=amd64,i386 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/graphics/ubuntu jammy arc" | tee /etc/apt/sources.list.d/intel.gpu.jammy.list && \
88
chmod 644 /usr/share/keyrings/intel-graphics.gpg
99

10-
RUN apt-get update -y \
11-
&& apt-get install -y curl libicu70 lsb-release git wget vim numactl python3 python3-pip ffmpeg libsm6 libxext6 libgl1
10+
RUN apt-get update -y && \
11+
apt-get install -y curl libicu70 lsb-release git wget vim numactl python3 python3-pip ffmpeg libsm6 libxext6 libgl1
1212

1313
COPY ./ /workspace/vllm
1414

1515
WORKDIR /workspace/vllm
1616

17-
RUN pip install -v -r requirements-xpu.txt --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/
17+
RUN --mount=type=cache,target=/root/.cache/pip \
18+
pip install -v --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/ \
19+
cmake>=3.26 ninja packaging setuptools-scm>=8 wheel jinja2 \
20+
-r requirements-xpu.txt
1821

19-
RUN VLLM_TARGET_DEVICE=xpu python3 setup.py install
22+
RUN --mount=type=cache,target=/root/.cache/pip \
23+
--mount=type=bind,source=.git,target=.git \
24+
VLLM_TARGET_DEVICE=xpu python3 setup.py install
2025

2126
CMD ["/bin/bash"]

docs/source/getting_started/cpu-installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Build from source
5656
.. code-block:: console
5757
5858
$ pip install --upgrade pip
59-
$ pip install wheel packaging ninja "setuptools>=49.4.0" numpy
59+
$ pip install cmake>=3.26 wheel packaging ninja "setuptools-scm>=8" numpy
6060
$ pip install -v -r requirements-cpu.txt --extra-index-url https://download.pytorch.org/whl/cpu
6161
6262
- Third, build and install oneDNN library from source:

0 commit comments

Comments
 (0)