Skip to content

Commit 15314cc

Browse files
authored
[v0.7.3][Build] Upgrade torch-npu to 2.5.1 (#662)
### What this PR does / why we need it? Upgrade torch-npu to 2.5.1 ### Does this PR introduce _any_ user-facing change? update installation doc Signed-off-by: MengqingCao <cmq0113@163.com>
1 parent c9b3e03 commit 15314cc

File tree

13 files changed

+46
-83
lines changed

13 files changed

+46
-83
lines changed

.github/workflows/mypy.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ jobs:
3838
runs-on: ubuntu-latest
3939
strategy:
4040
matrix:
41-
python-version: ["3.9", "3.10", "3.11", "3.12"]
41+
# TODO: Add 3.12 back when torch-npu support 3.12
42+
python-version: ["3.9", "3.10", "3.11"]
4243
steps:
4344
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4445
- name: Set up Python ${{ matrix.python-version }}
@@ -47,7 +48,7 @@ jobs:
4748
python-version: ${{ matrix.python-version }}
4849
- name: Install dependencies
4950
run: |
50-
pip install -r requirements-dev.txt
51+
pip install -r requirements-dev.txt
5152
5253
- name: Checkout vllm-project/vllm repo
5354
uses: actions/checkout@v4

.github/workflows/vllm_ascend_test.yaml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,6 @@ jobs:
8989
pip install -r requirements-dev.txt
9090
pip install -e .
9191
92-
- name: Install pta
93-
run: |
94-
if [ ! -d /root/.cache/pta ]; then
95-
mkdir -p /root/.cache/pta
96-
fi
97-
98-
if [ ! -f /root/.cache/pta/torch_npu-2.5.1.dev20250320-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl ]; then
99-
cd /root/.cache/pta
100-
rm -rf pytorch_v2.5.1_py310*
101-
wget https://pytorch-package.obs.cn-north-4.myhuaweicloud.com/pta/Daily/v2.5.1/20250320.3/pytorch_v2.5.1_py310.tar.gz
102-
tar -zxvf pytorch_v2.5.1_py310.tar.gz
103-
fi
104-
105-
pip install /root/.cache/pta/torch_npu-2.5.1.dev20250320-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
106-
10792
- name: Run vllm-project/vllm-ascend e2e test
10893
run: |
10994
pytest -sv tests/test_offline_inference.py

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ include(${CMAKE_CURRENT_LIST_DIR}/cmake/utils.cmake)
1010
# Suppress potential warnings about unused manually-specified variables
1111
set(ignoreMe "${VLLM_PYTHON_PATH}")
1212

13-
set(PYTHON_SUPPORTED_VERSIONS "3.9" "3.10" "3.11" "3.12")
13+
# TODO: Add 3.12 back when torch-npu support 3.12
14+
set(PYTHON_SUPPORTED_VERSIONS "3.9" "3.10" "3.11")
1415

1516
find_package(pybind11 REQUIRED)
1617

Dockerfile

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,16 @@ RUN pip config set global.index-url ${PIP_INDEX_URL}
3737
ARG VLLM_REPO=https://github.com/vllm-project/vllm.git
3838
ARG VLLM_TAG=v0.7.3
3939
RUN git clone --depth 1 $VLLM_REPO --branch $VLLM_TAG /workspace/vllm
40-
RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install /workspace/vllm/ --extra-index https://download.pytorch.org/whl/cpu/
41-
# In x86, triton will be installed by vllm. But in Ascend, triton doesn't work correctly. we need to uninstall it.
42-
RUN python3 -m pip uninstall -y triton
40+
RUN VLLM_TARGET_DEVICE="empty" python3 -m pip install -e /workspace/vllm/ --extra-index https://download.pytorch.org/whl/cpu/ && \
41+
python3 -m pip cache purge
4342

4443
# Install vllm-ascend
45-
RUN python3 -m pip install /workspace/vllm-ascend/ --extra-index https://download.pytorch.org/whl/cpu/
46-
47-
# Install torch-npu
48-
RUN bash /workspace/vllm-ascend/pta_install.sh
44+
RUN python3 -m pip install -e /workspace/vllm-ascend/ --extra-index https://download.pytorch.org/whl/cpu/ && \
45+
python3 -m pip cache purge
4946

5047
# Install modelscope (for fast download) and ray (for multinode)
51-
# TODO(yikun): Remove "<1.23.0" after v0.7.4 which resloved by https://github.com/vllm-project/vllm/pull/13807
52-
RUN python3 -m pip install "modelscope<1.23.0" ray
48+
# TODO(yikun): Remove "<1.23.0" after v0.8.4 which resloved by https://github.com/vllm-project/vllm/pull/13807
49+
RUN python3 -m pip install "modelscope<1.23.0" ray && \
50+
python3 -m pip cache purge
5351

5452
CMD ["/bin/bash"]

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ By using vLLM Ascend plugin, popular open-source models, including Transformer-l
3434

3535
- Hardware: Atlas 800I A2 Inference series, Atlas A2 Training series
3636
- Software:
37-
* Python >= 3.9
37+
* Python >= 3.9, < 3.12
3838
* CANN >= 8.0.0
39-
* PyTorch >= 2.5.1, torch-npu >= 2.5.1.dev20250320
39+
* PyTorch >= 2.5.1, torch-npu >= 2.5.1
4040
* vLLM (the same version as vllm-ascend)
4141

4242
Find more about how to setup your environment step by step in [here](docs/source/installation.md).

README.zh.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ vLLM 昇腾插件 (`vllm-ascend`) 是一个让vLLM在Ascend NPU无缝运行的
3434

3535
- 硬件:Atlas 800I A2 Inference系列、Atlas A2 Training系列
3636
- 软件:
37-
* Python >= 3.9
37+
* Python >= 3.9, < 3.12
3838
* CANN >= 8.0.RC2
39-
* PyTorch >= 2.5.1, torch-npu >= 2.5.1.dev20250320
39+
* PyTorch >= 2.5.1, torch-npu >= 2.5.1
4040
* vLLM (与vllm-ascend版本一致)
4141

4242
[此处](docs/source/installation.md),您可以了解如何逐步准备环境。

docs/source/installation.md

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ This document describes how to install vllm-ascend manually.
55
## Requirements
66

77
- OS: Linux
8-
- Python: 3.9 or higher
8+
- Python: >= 3.9, < 3.12
99
- A hardware with Ascend NPU. It's usually the Atlas 800 A2 series.
1010
- Software:
1111

12-
| Software | Supported version | Note |
13-
| ------------ | ----------------- | ---- |
12+
| Software | Supported version | Note |
13+
| ------------ | ----------------- | -------------------------------------- |
1414
| CANN | >= 8.0.0 | Required for vllm-ascend and torch-npu |
15-
| torch-npu | >= 2.5.1.dev20250320 | Required for vllm-ascend |
16-
| torch | >= 2.5.1 | Required for torch-npu and vllm |
15+
| torch-npu | >= 2.5.1 | Required for vllm-ascend |
16+
| torch | >= 2.5.1 | Required for torch-npu and vllm |
1717

1818
You have 2 way to install:
1919
- **Using pip**: first prepare env manually or via CANN image, then install `vllm-ascend` using pip.
@@ -156,25 +156,6 @@ pip install -e . --extra-index https://download.pytorch.org/whl/cpu/
156156
```
157157
:::
158158

159-
Current version depends on a unreleased `torch-npu`, you need to install manually:
160-
161-
```
162-
# Once the packages are installed, you need to install `torch-npu` manually,
163-
# because that vllm-ascend relies on an unreleased version of torch-npu.
164-
# This step will be removed in the next vllm-ascend release.
165-
#
166-
# Here we take python 3.10 on aarch64 as an example. Feel free to install the correct version for your environment. See:
167-
#
168-
# https://pytorch-package.obs.cn-north-4.myhuaweicloud.com/pta/Daily/v2.5.1/20250320.3/pytorch_v2.5.1_py39.tar.gz
169-
# https://pytorch-package.obs.cn-north-4.myhuaweicloud.com/pta/Daily/v2.5.1/20250320.3/pytorch_v2.5.1_py310.tar.gz
170-
# https://pytorch-package.obs.cn-north-4.myhuaweicloud.com/pta/Daily/v2.5.1/20250320.3/pytorch_v2.5.1_py311.tar.gz
171-
#
172-
mkdir pta
173-
cd pta
174-
wget https://pytorch-package.obs.cn-north-4.myhuaweicloud.com/pta/Daily/v2.5.1/20250320.3/pytorch_v2.5.1_py310.tar.gz
175-
tar -xvf pytorch_v2.5.1_py310.tar.gz
176-
pip install ./torch_npu-2.5.1.dev20250320-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
177-
```
178159
::::
179160

180161
::::{tab-item} Using docker

pta_install.sh

Lines changed: 0 additions & 16 deletions
This file was deleted.

pyproject.toml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
[build-system]
22
# Should be mirrored in requirements.txt
33
requires = [
4-
"setuptools>=64",
5-
"setuptools-scm>=8",
64
"cmake>=3.26",
7-
"pybind11",
85
"decorator",
6+
"numpy<2.0.0",
7+
"packaging",
8+
"pip",
9+
"pybind11",
910
"pyyaml",
1011
"scipy",
11-
"torch_npu >= 2.5.1rc1",
12-
"torch >= 2.5.1"
12+
"setuptools>=64",
13+
"setuptools-scm>=8",
14+
"torch-npu==2.5.1",
15+
"torch>=2.5.1",
16+
"torchvision<0.21.0",
17+
"wheel",
1318
]
1419
build-backend = "setuptools.build_meta"

requirements-lint.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ clang-format==18.1.5
99
sphinx-lint==1.0.0
1010

1111
# type checking
12-
mypy==1.11.1
12+
mypy==1.15.0
1313
types-PyYAML
1414
types-requests
1515
types-setuptools

0 commit comments

Comments
 (0)