跳转至

贡献

构建和测试

建议在提交 PR 之前,设置本地开发环境以构建 vllm-ascend 并运行测试。

设置开发环境

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

但你仍然可以在 Linux/Windows/macOS 上设置开发环境,用于 lint 和运行基本测试。

在本地运行 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 --branch main 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

完成“Run lint”设置后,你可以在本地运行 CI(持续集成):

cd ~/vllm-project/

# Install the vLLM commit verified by the main-branch plugin checkout.
VLLM_COMMIT=$(tr -d '[:space:]' < vllm-ascend/.github/vllm-main-verified.commit)
git init vllm
git -C vllm fetch --depth 1 https://github.com/vllm-project/vllm.git "$VLLM_COMMIT"
git -C vllm checkout --detach FETCH_HEAD
cd vllm
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

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

🎉 恭喜!你已完成开发环境设置。

在本地测试

你可以参考 Testing 来设置测试环境并在本地运行测试。

DCO 和 Signed-off-by

在向本项目贡献更改时,你必须同意 DCO。提交必须包含 Signed-off-by: 头,以证明你同意 DCO(Developer Certificate of Origin)的条款。

在 git commit 中使用 -s 会自动添加此头。

PR 标题和分类

只有特定类型的 PR 会被审查。PR 标题会添加相应前缀以表明更改类型。请使用以下之一:

  • [Attention] 用于注意力机制的新功能或优化。
  • [Communicator] 用于通信器的新功能或优化。
  • [ModelRunner] 用于模型运行器的新功能或优化。
  • [Platform] 用于平台的新功能或优化。
  • [Worker] 用于 worker 的新功能或优化。
  • [Core] 用于核心 vllm-ascend 逻辑(例如 platform、attention、communicators、model runner)的新功能或优化。
  • [Kernel] 用于影响计算 kernel 和 ops 的更改。
  • [BugFix] 用于 bug 修复。
  • [Doc] 用于文档修复和改进。
  • [Test] 用于测试(例如单元测试)。
  • [CI] 用于构建或持续集成改进。
  • [Misc] 用于不符合上述类别的 PR。请谨慎使用。

Note

如果 PR 跨越多个类别,请包含所有相关前缀。

其他

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

本页原文 Markdown:在 AtomGit 查看·内容源自开源项目 vl/vllm-ascend