Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
ee5f34b1
Unverified
Commit
ee5f34b1
authored
Sep 23, 2024
by
Daniele
Committed by
GitHub
Sep 23, 2024
Browse files
[CI/Build] use setuptools-scm to set __version__ (#4738)
Co-authored-by:
youkaichao
<
youkaichao@126.com
>
parent
f2bd246c
Changes
16
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
94 additions
and
95 deletions
+94
-95
.gitignore
.gitignore
+3
-0
Dockerfile
Dockerfile
+2
-3
Dockerfile.cpu
Dockerfile.cpu
+3
-1
Dockerfile.neuron
Dockerfile.neuron
+13
-10
Dockerfile.openvino
Dockerfile.openvino
+3
-2
Dockerfile.ppc64le
Dockerfile.ppc64le
+9
-3
Dockerfile.rocm
Dockerfile.rocm
+6
-3
Dockerfile.tpu
Dockerfile.tpu
+13
-4
Dockerfile.xpu
Dockerfile.xpu
+9
-4
docs/source/getting_started/cpu-installation.rst
docs/source/getting_started/cpu-installation.rst
+1
-1
pyproject.toml
pyproject.toml
+9
-1
requirements-build.txt
requirements-build.txt
+2
-1
setup.py
setup.py
+10
-50
tests/test_embedded_commit.py
tests/test_embedded_commit.py
+4
-3
vllm/__init__.py
vllm/__init__.py
+2
-2
vllm/version.py
vllm/version.py
+5
-7
No files found.
.gitignore
View file @
ee5f34b1
...
...
@@ -196,5 +196,8 @@ _build/
*_hip*
hip_compat.h
# version file generated by setuptools-scm
/vllm/_version.py
# Benchmark dataset
benchmarks/*.json
Dockerfile
View file @
ee5f34b1
...
...
@@ -79,15 +79,13 @@ ENV MAX_JOBS=${max_jobs}
ARG
nvcc_threads=8
ENV
NVCC_THREADS=$nvcc_threads
ARG
buildkite_commit
ENV
BUILDKITE_COMMIT=${buildkite_commit}
ARG
USE_SCCACHE
ARG
SCCACHE_BUCKET_NAME=vllm-build-sccache
ARG
SCCACHE_REGION_NAME=us-west-2
ARG
SCCACHE_S3_NO_CREDENTIALS=0
# if USE_SCCACHE is set, use sccache to speed up compilation
RUN
--mount
=
type
=
cache,target
=
/root/.cache/pip
\
--mount
=
type
=
bind
,source
=
.git,target
=
.git
\
if
[
"
$USE_SCCACHE
"
=
"1"
]
;
then
\
echo
"Installing sccache..."
\
&&
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 \
ENV
CCACHE_DIR=/root/.cache/ccache
RUN
--mount
=
type
=
cache,target
=
/root/.cache/ccache
\
--mount
=
type
=
cache,target
=
/root/.cache/pip
\
--mount
=
type
=
bind
,source
=
.git,target
=
.git
\
if
[
"
$USE_SCCACHE
"
!=
"1"
]
;
then
\
python3 setup.py bdist_wheel
--dist-dir
=
dist
--py-limited-api
=
cp38
;
\
fi
...
...
Dockerfile.cpu
View file @
ee5f34b1
...
...
@@ -62,8 +62,10 @@ ENV VLLM_CPU_DISABLE_AVX512=${VLLM_CPU_DISABLE_AVX512}
RUN --mount=type=cache,target=/root/.cache/pip \
--mount=type=cache,target=/root/.cache/ccache \
--mount=type=bind,source=.git,target=.git \
VLLM_TARGET_DEVICE=cpu python3 setup.py bdist_wheel && \
pip install dist/*.whl
pip install dist/*.whl && \
rm -rf dist
WORKDIR /workspace/
...
...
Dockerfile.neuron
View file @
ee5f34b1
...
...
@@ -6,9 +6,12 @@ FROM $BASE_IMAGE
RUN echo "Base image is $BASE_IMAGE"
# Install some basic utilities
RUN apt-get update \
&& apt-get install python3 python3-pip -y \
&& apt-get install -y ffmpeg libsm6 libxext6 libgl1
RUN apt-get update && \
apt-get install -y \
git \
python3 \
python3-pip \
ffmpeg libsm6 libxext6 libgl1
### Mount Point ###
# 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
RUN python3 -m pip install transformers-neuronx --extra-index-url=https://pip.repos.neuron.amazonaws.com -U
RUN python3 -m pip install --pre neuronx-cc==2.15.* --extra-index-url=https://pip.repos.neuron.amazonaws.com -U
COPY ./vllm /app/vllm/vllm
COPY ./setup.py /app/vllm/setup.py
COPY ./requirements-common.txt /app/vllm/requirements-common.txt
COPY ./requirements-neuron.txt /app/vllm/requirements-neuron.txt
COPY . /app/vllm
RUN cd /app/vllm \
&& python3 -m pip install -U -r requirements-neuron.txt
&& python3 -m pip install -U \
cmake>=3.26 ninja packaging setuptools-scm>=8 wheel jinja2 \
-r requirements-neuron.txt
ENV VLLM_TARGET_DEVICE neuron
RUN cd /app/vllm \
&& pip install -e . \
RUN --mount=type=bind,source=.git,target=.git \
cd /app/vllm \
&& pip install --no-build-isolation -v -e . \
&& cd ..
CMD ["/bin/bash"]
Dockerfile.openvino
View file @
ee5f34b1
...
...
@@ -4,8 +4,9 @@
FROM ubuntu:22.04 AS dev
RUN apt-get update -y && \
apt-get install -y python3-pip git && \
apt-get install -y ffmpeg libsm6 libxext6 libgl1
apt-get install -y \
git python3-pip \
ffmpeg libsm6 libxext6 libgl1
WORKDIR /workspace
# copy requirements
...
...
Dockerfile.ppc64le
View file @
ee5f34b1
...
...
@@ -16,9 +16,15 @@ COPY ./ /workspace/vllm
WORKDIR /workspace/vllm
# These packages will be in rocketce eventually
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
RUN VLLM_TARGET_DEVICE=cpu python3 setup.py install
RUN --mount=type=cache,target=/root/.cache/pip \
pip install -v --prefer-binary --extra-index-url https://repo.fury.io/mgiessing \
cmake>=3.26 ninja packaging setuptools-scm>=8 wheel jinja2 \
torch==2.3.1 \
-r requirements-cpu.txt \
xformers uvloop==0.20.0
RUN --mount=type=bind,source=.git,target=.git \
VLLM_TARGET_DEVICE=cpu python3 setup.py install
WORKDIR /workspace/
...
...
Dockerfile.rocm
View file @
ee5f34b1
...
...
@@ -51,13 +51,15 @@ RUN python3 -m pip install --upgrade pip
# TODO: implement sccache support across components
RUN apt-get purge -y sccache; python3 -m pip uninstall -y sccache; rm -f "$(which sccache)"
# Install torch == 2.5.0 on ROCm
RUN case "$(ls /opt | grep -Po 'rocm-[0-9]\.[0-9]')" in \
RUN --mount=type=cache,target=/root/.cache/pip \
case "$(ls /opt | grep -Po 'rocm-[0-9]\.[0-9]')" in \
*"rocm-6.1"*) \
python3 -m pip uninstall -y torch torchvision \
&& python3 -m pip install
--no-cache-dir
--pre \
&& python3 -m pip install --pre \
torch==2.5.0.dev20240726 \
cmake>=3.26 ninja packaging setuptools-scm>=8 wheel jinja2 \
torchvision==0.20.0.dev20240726 \
--index-url https://download.pytorch.org/whl/nightly/rocm6.1;; \
--
extra-
index-url https://download.pytorch.org/whl/nightly/rocm6.1
;; \
*) ;; esac
ENV LLVM_SYMBOLIZER_PATH=/opt/rocm/llvm/bin/llvm-symbolizer
...
...
@@ -138,6 +140,7 @@ ENV RAY_EXPERIMENTAL_NOSET_ROCR_VISIBLE_DEVICES=1
ENV TOKENIZERS_PARALLELISM=false
RUN --mount=type=cache,target=${CCACHE_DIR} \
--mount=type=bind,source=.git,target=.git \
--mount=type=cache,target=/root/.cache/pip \
python3 -m pip install -Ur requirements-rocm.txt \
&& case "$(ls /opt | grep -Po 'rocm-[0-9]\.[0-9]')" in \
...
...
Dockerfile.tpu
View file @
ee5f34b1
...
...
@@ -5,16 +5,25 @@ FROM $BASE_IMAGE
WORKDIR /workspace
# Install some basic utilities
RUN apt-get update && apt-get install -y ffmpeg libsm6 libxext6 libgl1
RUN apt-get update && apt-get install -y \
git \
ffmpeg libsm6 libxext6 libgl1
# Install the TPU and Pallas dependencies.
RUN python3 -m pip install torch_xla[tpu] -f https://storage.googleapis.com/libtpu-releases/index.html
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
RUN --mount=type=cache,target=/root/.cache/pip \
python3 -m pip install torch_xla[tpu] -f https://storage.googleapis.com/libtpu-releases/index.html
RUN --mount=type=cache,target=/root/.cache/pip \
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
# Build vLLM.
COPY . /workspace/vllm
ENV VLLM_TARGET_DEVICE="tpu"
RUN cd /workspace/vllm && python3 -m pip install -r requirements-tpu.txt
RUN --mount=type=cache,target=/root/.cache/pip \
--mount=type=bind,source=.git,target=.git \
cd /workspace/vllm && \
python3 -m pip install \
cmake>=3.26 ninja packaging setuptools-scm>=8 wheel jinja2 \
-r requirements-tpu.txt
RUN cd /workspace/vllm && python3 setup.py develop
CMD ["/bin/bash"]
Dockerfile.xpu
View file @
ee5f34b1
...
...
@@ -7,15 +7,20 @@ RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRO
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 && \
chmod 644 /usr/share/keyrings/intel-graphics.gpg
RUN apt-get update -y \
&&
apt-get install -y curl libicu70 lsb-release git wget vim numactl python3 python3-pip ffmpeg libsm6 libxext6 libgl1
RUN apt-get update -y
&&
\
apt-get install -y curl libicu70 lsb-release git wget vim numactl python3 python3-pip ffmpeg libsm6 libxext6 libgl1
COPY ./ /workspace/vllm
WORKDIR /workspace/vllm
RUN pip install -v -r requirements-xpu.txt --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/
RUN --mount=type=cache,target=/root/.cache/pip \
pip install -v --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/ \
cmake>=3.26 ninja packaging setuptools-scm>=8 wheel jinja2 \
-r requirements-xpu.txt
RUN VLLM_TARGET_DEVICE=xpu python3 setup.py install
RUN --mount=type=cache,target=/root/.cache/pip \
--mount=type=bind,source=.git,target=.git \
VLLM_TARGET_DEVICE=xpu python3 setup.py install
CMD ["/bin/bash"]
docs/source/getting_started/cpu-installation.rst
View file @
ee5f34b1
...
...
@@ -56,7 +56,7 @@ Build from source
.. code-block:: console
$ pip install --upgrade pip
$ pip install wheel packaging ninja "setuptools
>=49.4.0
" numpy
$ pip install
cmake>=3.26
wheel packaging ninja "setuptools
-scm>=8
" numpy
$ pip install -v -r requirements-cpu.txt --extra-index-url https://download.pytorch.org/whl/cpu
- Third, build and install oneDNN library from source:
...
...
pyproject.toml
View file @
ee5f34b1
...
...
@@ -4,7 +4,8 @@ requires = [
"cmake>=3.26"
,
"ninja"
,
"packaging"
,
"setuptools >= 49.4.0"
,
"setuptools>=61"
,
"setuptools-scm>=8.0"
,
"torch == 2.4.0"
,
"wheel"
,
"jinja2"
,
...
...
@@ -19,6 +20,10 @@ exclude = [
"examples/fp8/quantizer/quantize.py"
]
[tool.ruff.lint.per-file-ignores]
"vllm/version.py"
=
["F401"]
"vllm/_version.py"
=
["ALL"]
[tool.ruff.lint]
select
=
[
# pycodestyle
...
...
@@ -46,6 +51,9 @@ ignore = [
"UP032"
,
]
[tool.setuptools_scm]
version_file
=
"vllm/_version.py"
[tool.mypy]
python_version
=
"3.8"
...
...
requirements-build.txt
View file @
ee5f34b1
...
...
@@ -2,7 +2,8 @@
cmake>=3.26
ninja
packaging
setuptools>=49.4.0
setuptools>=61
setuptools-scm>=8
torch==2.4.0
wheel
jinja2
setup.py
View file @
ee5f34b1
...
...
@@ -5,7 +5,6 @@ import os
import
re
import
subprocess
import
sys
import
warnings
from
pathlib
import
Path
from
shutil
import
which
from
typing
import
Dict
,
List
...
...
@@ -14,6 +13,7 @@ import torch
from
packaging.version
import
Version
,
parse
from
setuptools
import
Extension
,
find_packages
,
setup
from
setuptools.command.build_ext
import
build_ext
from
setuptools_scm
import
get_version
from
torch.utils.cpp_extension
import
CUDA_HOME
...
...
@@ -28,34 +28,6 @@ def load_module_from_path(module_name, path):
ROOT_DIR
=
os
.
path
.
dirname
(
__file__
)
logger
=
logging
.
getLogger
(
__name__
)
def
embed_commit_hash
():
try
:
if
"BUILDKITE_COMMIT"
in
os
.
environ
:
# ci build
commit_id
=
os
.
environ
[
"BUILDKITE_COMMIT"
]
else
:
commit_id
=
subprocess
.
check_output
([
"git"
,
"rev-parse"
,
"HEAD"
],
encoding
=
"utf-8"
).
strip
()
commit_contents
=
f
'__commit__ = "
{
commit_id
}
"
\n
'
version_file
=
os
.
path
.
join
(
ROOT_DIR
,
"vllm"
,
"commit_id.py"
)
with
open
(
version_file
,
"w"
,
encoding
=
"utf-8"
)
as
f
:
f
.
write
(
commit_contents
)
except
subprocess
.
CalledProcessError
as
e
:
warnings
.
warn
(
f
"Failed to get commit hash:
\n
{
e
}
"
,
RuntimeWarning
,
stacklevel
=
2
)
except
Exception
as
e
:
warnings
.
warn
(
f
"Failed to embed commit hash:
\n
{
e
}
"
,
RuntimeWarning
,
stacklevel
=
2
)
embed_commit_hash
()
# cannot import envs directly because it depends on vllm,
# which is not installed yet
envs
=
load_module_from_path
(
'envs'
,
os
.
path
.
join
(
ROOT_DIR
,
'vllm'
,
'envs.py'
))
...
...
@@ -381,21 +353,9 @@ def get_path(*filepath) -> str:
return
os
.
path
.
join
(
ROOT_DIR
,
*
filepath
)
def
find_version
(
filepath
:
str
)
->
str
:
"""Extract version information from the given filepath.
Adapted from https://github.com/ray-project/ray/blob/0b190ee1160eeca9796bc091e07eaebf4c85b511/python/setup.py
"""
with
open
(
filepath
)
as
fp
:
version_match
=
re
.
search
(
r
"^__version__ = ['\"]([^'\"]*)['\"]"
,
fp
.
read
(),
re
.
M
)
if
version_match
:
return
version_match
.
group
(
1
)
raise
RuntimeError
(
"Unable to find version string."
)
def
get_vllm_version
()
->
str
:
version
=
find_version
(
get_path
(
"vllm"
,
"version.py"
))
version
=
get_version
()
sep
=
"+"
if
"+"
not
in
version
else
"."
# dev versions might contain +
if
_no_device
():
if
envs
.
VLLM_TARGET_DEVICE
==
"empty"
:
...
...
@@ -406,27 +366,27 @@ def get_vllm_version() -> str:
cuda_version_str
=
cuda_version
.
replace
(
"."
,
""
)[:
3
]
# skip this for source tarball, required for pypi
if
"sdist"
not
in
sys
.
argv
:
version
+=
f
"
+
cu
{
cuda_version_str
}
"
version
+=
f
"
{
sep
}
cu
{
cuda_version_str
}
"
elif
_is_hip
():
# Get the HIP version
hipcc_version
=
get_hipcc_rocm_version
()
if
hipcc_version
!=
MAIN_CUDA_VERSION
:
rocm_version_str
=
hipcc_version
.
replace
(
"."
,
""
)[:
3
]
version
+=
f
"
+
rocm
{
rocm_version_str
}
"
version
+=
f
"
{
sep
}
rocm
{
rocm_version_str
}
"
elif
_is_neuron
():
# Get the Neuron version
neuron_version
=
str
(
get_neuronxcc_version
())
if
neuron_version
!=
MAIN_CUDA_VERSION
:
neuron_version_str
=
neuron_version
.
replace
(
"."
,
""
)[:
3
]
version
+=
f
"
+
neuron
{
neuron_version_str
}
"
version
+=
f
"
{
sep
}
neuron
{
neuron_version_str
}
"
elif
_is_openvino
():
version
+=
"+
openvino"
version
+=
f
"
{
sep
}
openvino"
elif
_is_tpu
():
version
+=
"+
tpu"
version
+=
f
"
{
sep
}
tpu"
elif
_is_cpu
():
version
+=
"+
cpu"
version
+=
f
"
{
sep
}
cpu"
elif
_is_xpu
():
version
+=
"+
xpu"
version
+=
f
"
{
sep
}
xpu"
else
:
raise
RuntimeError
(
"Unknown runtime environment"
)
...
...
tests/test_embedded_commit.py
View file @
ee5f34b1
...
...
@@ -2,6 +2,7 @@ import vllm
def
test_embedded_commit_defined
():
assert
vllm
.
__commit__
!=
"COMMIT_HASH_PLACEHOLDER"
# 7 characters is the length of a short commit hash
assert
len
(
vllm
.
__commit__
)
>=
7
assert
hasattr
(
vllm
,
"__version__"
)
assert
hasattr
(
vllm
,
"__version_tuple__"
)
assert
vllm
.
__version__
!=
"dev"
assert
vllm
.
__version_tuple__
!=
(
0
,
0
,
"dev"
)
vllm/__init__.py
View file @
ee5f34b1
...
...
@@ -12,11 +12,11 @@ from vllm.outputs import (CompletionOutput, EmbeddingOutput,
from
vllm.pooling_params
import
PoolingParams
from
vllm.sampling_params
import
SamplingParams
from
.version
import
__
commit
__
,
__version__
from
.version
import
__
version
__
,
__version_
tuple_
_
__all__
=
[
"__commit__"
,
"__version__"
,
"__version_tuple__"
,
"LLM"
,
"ModelRegistry"
,
"PromptType"
,
...
...
vllm/version.py
View file @
ee5f34b1
import
warnings
try
:
import
vllm.commit_id
__commit__
=
vllm
.
commit_id
.
__commit__
from
._version
import
__version__
,
__version_tuple__
except
Exception
as
e
:
import
warnings
warnings
.
warn
(
f
"Failed to read commit hash:
\n
{
e
}
"
,
RuntimeWarning
,
stacklevel
=
2
)
__commit__
=
"COMMIT_HASH_PLACEHOLDER"
__version__
=
"0.6.1.post2"
__version__
=
"dev"
__version_tuple__
=
(
0
,
0
,
__version__
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment