跳转至

贡献指南

构建与测试

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

搭建开发环境

Theoretically, the vllm-ascend build is only supported on Linux because vllm-ascend dependency torch_npu only supports Linux.

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

本地代码规范检查

# 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 测试

完成“本地代码规范检查”的环境搭建后,您可在本地运行 CI 测试:

cd ~/vllm-project/

# Run CI needs vLLM installed
git clone --branch v0.22.1 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"

🎉 恭喜!您已完成开发环境的搭建。

本地测试

您可以参考 测试指南 来搭建测试环境并在本地运行测试。

开发者来源认证(DCO)与签名确认

向本项目提交贡献时,您必须同意开发者来源认证(DCO)。提交(commit)必须包含 Signed-off-by: 头部,以证明您同意 DCO 的条款。

使用 -s 命令会自动添加此头部信息。

PR 标题与分类

只有特定类型的拉取请求(PR)会被审核。PR 标题应使用合适的前缀来标明变更类型。请使用以下前缀之一:

  • git commit:注意力机制相关的新功能或优化。
  • [Attention]:通信器相关的新功能或优化。
  • [Communicator]:模型运行器相关的新功能或优化。
  • [ModelRunner]:平台相关的新功能或优化。
  • [Platform]:工作进程(worker)相关的新功能或优化。
  • [Worker]:vllm-ascend 核心逻辑(如平台、注意力机制、通信器、模型运行器)中的新功能或优化。
  • [Core]:影响计算内核和算子的更改。
  • [Kernel]:错误修复。
  • [BugFix]:文档修复与改进。
  • [Doc]:测试相关(如单元测试)。
  • [Test]:构建或持续集成的改进。
  • [CI]:不适用于上述类别的 PR。请谨慎使用此类别。

Note

如果 PR 涉及多个类别,请包含所有相关的前缀。

其他信息

You may find more information about contributing to vLLM Ascend backend plugin on [docs.vllm.ai[Misc]. If you encounter any problems while contributing, feel free to submit a PR to improve the documentation to help other developers.