贡献#

Building and Testing#

It's recommended to set up a local development environment to build vllm-ascend and run tests before you submit a PR.

Set up a development environment#

理论上,vllm-ascend 构建仅支持 Linux,因为 vllm-ascend 的依赖项 torch_npu 只支持 Linux。

But you can still set up a development environment on Linux/Windows/macOS for linting and running basic tests.

在本地运行 lint#

# Choose a base dir (~/vllm-project/) and set up venv
cd ~/vllm-project/
python3 -m venv .venv
source ./.venv/bin/activate

# Clone vllm-ascend and install
git clone https://github.com/vllm-project/vllm-ascend.git
cd vllm-ascend

# Install lint requirement and enable pre-commit hook
pip install -r requirements-lint.txt

# Run lint (You need to install pre-commits deps via proxy network at first time)
bash format.sh

本地运行CI#

After completing "Run lint" setup, you can run CI locally:

cd ~/vllm-project/

# Run CI need vLLM installed
git clone --branch v0.11.0rc3 https://github.com/vllm-project/vllm.git
cd vllm
pip install -r requirements/build.txt
VLLM_TARGET_DEVICE="empty" pip install .
cd ..

# Install requirements
cd vllm-ascend
# For Linux:
pip install -r requirements-dev.txt
# For non Linux:
cat requirements-dev.txt | grep -Ev '^#|^--|^$|^-r' | while read PACKAGE; do pip install "$PACKAGE"; done
cat requirements.txt | grep -Ev '^#|^--|^$|^-r' | while read PACKAGE; do pip install "$PACKAGE"; done

# Run ci:
bash format.sh ci

提交该提交#

# Commit changed files using `-s`
git commit -sm "your commit info"

🎉 恭喜!你已经完成了开发环境的搭建。

Testing locally#

You can refer to Testing to set up a testing environment and running tests locally.

DCO 和签名确认#

当为本项目贡献更改时,您必须同意 DCO。提交必须包含 Signed-off-by: 头部,以证明您同意 DCO 的条款。

在使用 git commit 时加上 -s 参数会自动添加这个头部信息。

PR 标题与分类#

只有特定类型的 PR 会被审核。PR 标题应使用合适的前缀以指明更改类型。请使用以下之一:

  • [Attention] 用于注意力机制中新特性或优化。

  • [Communicator] 适用于通信器中的新特性或优化。

  • [ModelRunner] 用于模型运行器中的新功能或优化。

  • [Platform] 用于平台中新功能或优化。

  • [Worker] 用于 worker 的新功能或优化。

  • [Core] 用于核心 vllm-ascend 逻辑中的新特性或优化(例如平台、注意力机制、通信器、模型运行器)。

  • [Kernel] for changes affecting compute kernels and ops.

  • [Bugfix] 用于表示错误修复。

  • [Doc] 用于文档修复和改进。

  • [Test] 用于测试(如单元测试)。

  • [CI] 用于构建或持续集成的改进。

  • 对于不属于上述类别的 PR,请使用 [Misc]。请谨慎使用此标签。

备注

如果拉取请求(PR)涵盖多个类别,请包含所有相关的前缀。

其他#

你可以在 docs.vllm.ai 上找到有关为 vLLM Ascend 后端插件做贡献的更多信息。如果你在贡献过程中遇到任何问题,欢迎随时提交 PR 来改进文档,以帮助其他开发者。

索引