跳转至

常见问题

特定版本常见问题

通用常见问题

1.目前支持哪些设备?

目前,**仅**支持 Atlas A2 系列 (Ascend-cann-kernels-910b)、Atlas A3 系列 (Atlas-A3-cann-kernels) 以及 Atlas 300I (Ascend-cann-kernels-310p) 系列:

  • Atlas A2 训练系列(Atlas 800T A2、Atlas 900 A2 PoD、Atlas 200T A2 Box16、Atlas 300T A2)
  • Atlas 800I A2 推理系列(Atlas 800I A2)
  • Atlas A3 训练系列(Atlas 800T A3、Atlas 900 A3 SuperPoD、Atlas 9000 A3 SuperPoD)
  • Atlas 800I A3 推理系列(Atlas 800I A3)
  • [实验性] Atlas 300I 推理系列(Atlas 300I Duo)。
  • [实验性] 目前对于 310I Duo,稳定版本为 vllm-ascend v0.10.0rc1。

以下系列目前尚不支持:

  • Atlas 200I A2 (Ascend-cann-kernels-310b) 暂无计划
  • Ascend 910、Ascend 910 Pro B (Ascend-cann-kernels-910) 暂无计划

从技术角度看,如果设备支持 torch-npu,则 vllm-ascend 也支持该设备。否则,我们需要通过自定义算子来实现。我们也欢迎您加入我们,共同改进。

2.如何获取我们的 Docker 容器?

您可以在 Quay.io 获取我们的容器,例如:vllm-ascendcann

如果您在中国境内,可以使用 daocloud 或其他镜像站点来加速下载:

# Replace with tag you want to pull
TAG=v0.9.1
docker pull m.daocloud.io/quay.io/ascend/vllm-ascend:$TAG
# or
docker pull quay.nju.edu.cn/ascend/vllm-ascend:$TAG

为离线环境加载 Docker 镜像

如果您想在离线环境(无互联网连接)中使用容器镜像,需要先在有网络访问权限的环境中下载镜像:

导出 Docker 镜像:

# Pull the image on a machine with internet access
TAG=v0.22.1rc1
docker pull quay.io/ascend/vllm-ascend:$TAG

# Export the image to a tar file and compress to tar.gz
docker save quay.io/ascend/vllm-ascend:$TAG | gzip > vllm-ascend-$TAG.tar.gz

在无网络环境下导入 Docker 镜像:

# Transfer the tar/tar.gz file to the offline environment and load it
TAG=v0.22.1rc1
docker load -i vllm-ascend-$TAG.tar.gz

# Verify the image is loaded
docker images | grep vllm-ascend

3.vllm-ascend 支持哪些模型?

请在此处查看更多详细信息。

4.如何与我们的社区取得联系?

您可以通过多种渠道与我们的社区开发者及用户进行交流:

  • 提交 GitHub issue
  • 参加我们的周会并分享您的想法。
  • 加入我们的微信群并进行提问。
  • 加入 vLLM 论坛 中的 Ascend 频道并发布话题。

5.vllm-ascend V1 支持哪些功能?

请在此处查看更多详细信息。

6.如何解决“无法推断设备类型”或“libatb.so:无法打开共享对象文件”的问题?

根本原因是 NPU 环境配置不正确。您可以:

  1. 尝试运行 source /usr/local/Ascend/nnal/atb/set_env.sh 以启用 NNAL 包。
  2. 尝试运行 source /usr/local/Ascend/ascend-toolkit/set_env.sh 以启用 CANN 包。
  3. 尝试运行 npu-smi info 检查 NPU 是否正常工作。

如果以上步骤均无效,可以尝试在 Python 中运行以下代码来检查是否有任何错误:

import torch
import torch_npu
import vllm

如果上述步骤仍无法解决问题,请随时提交 GitHub issue。

7.vllm-ascend 如何与 vLLM 协同工作?

vllm-ascend 是 vLLM 的硬件插件。稳定版本通常与相同的 vLLM 版本对齐,而 RC 版本可能使用对应的 vLLM 最终发布版本。例如,vllm-ascend v0.18.0rc1 对应 vLLM v0.18.0。对于主分支,我们确保 vllm-ascendvllm 在每次提交时都是兼容的。

8.vllm-ascend 支持预填充-解码 (PD) 解耦功能吗?

是的,vllm-ascend 通过 Mooncake 后端支持预填充-解码解耦功能。详情请参考官方教程

9.vllm-ascend 支持量化方法吗?

目前,vllm-ascend 已支持 w8a8、w4a8 和 w4a4 量化方法。

10.vllm-ascend 是如何进行测试的?

vllm-ascend 从功能、性能和精度三个方面进行测试。

  • 功能测试:我们添加了 CI,包括部分 vLLM 原生单元测试和 vllm-ascend 自有的单元测试。在 vllm-ascend 的测试中,我们通过端到端 (E2E) 测试来验证基本功能、主流模型可用性以及支持的功能

  • 性能测试:我们提供了基准测试工具用于端到端性能基准测试,可以方便地在本地重现。我们将发布一个性能展示网站,显示每个 PR 的性能测试结果。

  • 精度测试:我们正在努力将精度测试也添加到 CI 中。

  • 每日构建测试 (Nightly):我们每晚会运行全量测试以确保代码正常工作。

对于每个正式版本,我们未来都会发布性能测试和精度测试报告。

11.使用 vllm-ascend 时出现 "InvalidVersion" 错误如何解决?

该问题通常是由于安装了开发版或可编辑版本的 vLLM 包导致的。为此,我们提供了环境变量 VLLM_VERSION 供用户指定要使用的 vLLM 包版本。请将 VLLM_VERSION 设置为您已安装的 vLLM 包版本,格式应为 VLLM_VERSION

12.如何处理内存溢出 (OOM) 问题?

OOM 错误通常在模型超出单个 NPU 的内存容量时发生。一般性指导请参考 [vLLM OOM 故障排除文档X.Y.Z

在 NPU 的高带宽内存(片上内存)容量有限的场景下,推理期间的动态内存分配/释放可能会加剧内存碎片,从而导致 OOM。解决方法如下:

  • 限制 ](https://docs.vllm.ai/en/latest/usage/troubleshooting/#out-of-memory):这可以节省 KV 缓存初始化阶段的片上内存占用。

  • 调整 --max-model-len:若未指定,默认值为 --gpu-memory-utilization。您可以降低此值以预留更多内存,从而降低碎片风险。详见:[vLLM - 推理与服务 - 引擎参数0.9

  • 配置 ](https://docs.vllm.ai/en/latest/cli/serve/#-gpu-memory-utilization):设置此环境变量以优化 NPU 内存管理。例如,您可以使用 PYTORCH_NPU_ALLOC_CONF 启用虚拟内存功能,以缓解运行时频繁动态调整内存大小导致的内存碎片。详见:[PYTORCH_NPU_ALLOC_CONF 文档export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True

13.运行 DeepSeek 时无法启用 NPU 图模式

为 DeepSeek 启用 NPU 图模式可能会报错。这是因为当同时启用 MLA(多头潜在注意力)和 NPU 图模式时,每个 KV 头的查询数必须为 32、64 或 128。然而,DeepSeek-V2-Lite 仅有 16 个注意力头,导致每个 KV 仅有 16 个查询,超出了支持范围。对 DeepSeek-V2-Lite 的 NPU 图模式支持将在未来更新中添加。

如果您使用的是 DeepSeek-V3 或 DeepSeek-R1,请确保在张量并行切分后,](https://www.hiascend.com/document/detail/zh/Pytorch/700/comref/Envvariables/Envir_012.html)/num_heads 的值为 {32, 64, 128} 其中之一。

[rank0]: RuntimeError: EZ9999: Inner Error!
[rank0]: EZ9999: [PID: 62938] 2025-05-27-06:52:12.455.807 numHeads / numKvHeads = 8, MLA only support {32, 64, 128}.[FUNC:CheckMlaAttrs][FILE:incre_flash_attention_tiling_check.cc][LINE:1218]

14.卸载 vllm-ascend 后无法从源码重新安装 vllm-ascend

当使用 pip 从源码重新安装 vllm-ascend 时,可能会遇到 C/C++ 编译失败的问题。如果安装失败,建议使用 python setup.py install 进行安装,或者使用 python setup.py clean 清除缓存。

15.使用 vllm-ascend 时如何生成确定性结果?

有几个因素会影响输出的确定性:

  1. 采样方法:在 temperature=0 中设置 SamplingParams 来使用**贪婪采样**,例如:
from vllm import LLM, SamplingParams

prompts = [
   "Hello, my name is",
   "The president of the United States is",
   "The capital of France is",
   "The future of AI is",
]

# Create a sampling params object.
sampling_params = SamplingParams(temperature=0)
# Create an LLM.
llm = LLM(model="Qwen/Qwen3-0.6B")

# Generate texts from the prompts.
outputs = llm.generate(prompts, sampling_params)
for output in outputs:
   prompt = output.prompt
   generated_text = output.outputs[0].text
   print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
  1. Set the following environment parameters:
export LCCL_DETERMINISTIC=1
export HCCL_DETERMINISTIC=true
export ATB_MATMUL_SHUFFLE_K_ENABLE=0
export ATB_LLM_LCOC_ENABLE=0

16. How to fix the error "ImportError: Please install vllm[audio] for audio support" for the multi-modal models?

Some multi-modal models requires the librosa package to be installed, you need to install the qwen-omni-utils package to ensure all dependencies are met, for Qwen-omni, run pip install qwen-omni-utils. This package will install librosa and its related dependencies, resolving the ImportError: No module named 'librosa' issue and ensuring that the audio processing functionality works correctly.

17.如何排查并解决因流资源耗尽导致的尺寸捕获失败,其根本原因是什么?

capture_begin:../torch_npu/csrc/core/npu/NPUGraph.cpp:230 NPU function error: c10_npu::acl::AclmdlRICaptureBegin(capture_stream_, capture_mode), error code is 207008
[Error]: Stream resources are insufficient.
[PID: ...] Insufficient_Stream_Resources(EL0009): The stream resources are insufficient.

当 vLLM Ascend 在错误文本中识别出这种捕获时的流资源特征时,它会重新抛出错误,并提供针对 ACL 图尺寸和缓解措施的具体指导。

建议的缓解策略:

  1. 如果您的环境有可用的较新 HDK/CANN 栈,请升级。最近的版本改进了 ACL 图容量,因此旧的变通方法可能不再需要。
  2. 手动减少配置的图尺寸,例如:'{"cudagraph_capture_sizes":[size1, size2, size3, ...]}',或降低 max_cudagraph_capture_size
  3. 如果您的负载主要是均匀解码,请尝试使用 ACLGraph 的 FULLFULL_DECODE_ONLY 模式,而不是 PIECEWISE
  4. 如果您使用 PIECEWISEFULL_AND_PIECEWISE,并且在升级后仍然遇到此失败,请根据您的实际负载手动设置 cudagraph_capture_sizes 并减少配置的覆盖范围。
  5. 如果您正在调试启动失败,请临时禁用图模式(cudagraph_mode="NONE" / enforce_eager=True),以确认问题是否与捕获相关。

Root cause analysis: ACL graph capture can still fail when the runtime resources required by the selected graph sizes exceed what the current software/hardware stack can provide. This is most visible in PIECEWISE scenarios because the number of captured graphs scales with model depth and capture-size coverage. vLLM Ascend no longer auto-shrinks the PIECEWISE capture-size set locally, so the practical mitigations are to upgrade the HDK/CANN stack or reduce the configured graph sizes explicitly. The runtime guidance is intentionally narrow: it is only added when capture fails with the confirmed stream-resource signature above.

18.如何安装自定义版本的 torch_npu?

安装 vllm-ascend 时会覆盖 torch-npu。如果您需要安装特定版本的 torch-npu,请在安装完 vllm-ascend 之后再手动安装指定版本的 torch-npu。

19.在某些系统(如麒麟 OS)上,执行 docker pull 可能会报错 invalid tar header

在某些操作系统(如麒麟 OS)上,您可能会在 invalid tar header 过程中遇到 docker pull 错误:

failed to register layer: ApplyLayer exit status 1 stdout: stderr: archive/tar: invalid tar header

这通常是由于系统兼容性问题导致的。您可以通过另一台机器使用离线加载的方法来解决。

  1. 在另一台宿主机(如标准的 Ubuntu 服务器)上,拉取目标 ARM64 架构的镜像并打包为 .tar 文件。
export IMAGE_TAG=v0.10.0rc1-310p
export IMAGE_NAME="quay.io/ascend/vllm-ascend:${IMAGE_TAG}"
# If in China region, uncomment to use a mirror:
# export IMAGE_NAME="m.daocloud.io/quay.io/ascend/vllm-ascend:${IMAGE_TAG}"

# Pull the image for the ARM64 platform and save it
docker pull --platform linux/arm64 "${IMAGE_NAME}"
docker save -o "vllm_ascend_${IMAGE_TAG}.tar" "${IMAGE_NAME}"
  1. Transfer the image archive

Copy the vllm_ascend_<tag>.tar file (where <tag> is the image tag you used) to your target machine

20. Why am I getting an error when executing the script to start a Docker container? The error message is: "operation not permitted"

When using --shm-size, you may need to add the docker run flag to your --privileged=true command to grant the container necessary permissions. Please be aware that using --privileged=true grants the container extensive privileges on the host system, which can be a security risk. Only use this option if you understand the implications and trust the container's source.

21. How to set SOC_VERSION when building from source on a CPU-only machine?

When building from source (e.g. pip install -e .), the build may try to infer the target chip via npu-smi. If npu-smi is not available (common in CPU-only build environments), you must set SOC_VERSION manually before installation.

You can use the defaults from Dockerfile* 中的默认值。例如:

# Atlas A2
export SOC_VERSION="ascend910b1"

# Atlas A3
export SOC_VERSION="ascend910_9391"

# Atlas 300I
export SOC_VERSION="ascend310p1"

# Ascend 950 Products
export SOC_VERSION="<value starting with ascend950>"

22.为什么 TPOT 会随着并发数增加而急剧上升?

When testing a vLLM server, one may find that TPOT increases as concurrency increases (for example, TPOT increases by 0.5 ~ 1ms when concurrency increases by 4). This phenomenon is normal in most cases. However, sometimes TPOT may increase dramatically (10 to 100ms for example) as concurrency grows. This is possibly caused by PREEMPTION in vLLM. Generally, when your server hits KV cache limits, vLLM tries to free KV cache of requests to ensure sufficient space for other requests, which is called preemption in vLLM. When a request is preempted, the default behavior is to recompute the KV cache of this request again in the future, which is why the performance might drop significantly. There are several ways to verify this:

  • vLLM 通常会在服务器上记录统计信息。你可能会看到类似 GPU KV cache usage: 99.0%, 的指标。当达到 100% 时,会触发抢占。
  • 启动 vLLM 服务器时,你会看到类似 GPU KV cache size: 66340 tokensMaximum concurrency for 16,384 tokens per request: 4.05 的日志。这些是针对单个 DP 组的估计 KV 缓存容量。你可以据此调整总体请求流量。

抢占无法完全避免,因为 KV 缓存的使用总是有限制的。但有方法可以减少抢占的发生几率。正如 抢占 中所建议的,核心策略是增加可用的 KV 缓存。例如,可以增加 --gpu-memory-utilization 或减少 --max-num-seqs--max-num-batched-tokens

23.如何在单节点和多节点部署之间选择?

当模型适配在单个节点的 NPU 内存中时,建议使用单节点部署。对于像 Qwen3-32B (BF16) 这样需要 4 × 64G 卡的模型,单个节点内的多 NPU (TP) 就足够了。只有当总 NPU 数量超过单个节点容量时,才需要多节点部署。

24.我应该使用哪种量化方法?

  • BF16:最佳精度,最高内存占用。适用于对精度要求高的应用或内存充足的情况。
  • W8A8:精度和内存缩减的良好平衡。适用于内存受限硬件上的大型模型(例如 32B)。
  • W4A8/W4A4:最大程度的内存缩减。适用于在较小硬件配置上部署更大模型,但会牺牲一些精度。

25.何时应该启用 FlashComm_v1?

在使用张量并行 (TP ≥ 2) 且高并发时启用 FlashComm_v1 (VLLM_ASCEND_ENABLE_FLASHCOMM1=1)。它具有阈值保护,在可能降低性能的低并发场景下不会激活。

26.FIA 和 PA 注意力算子有什么区别?

FIA (Flash Attention) 是 vLLM-Ascend 中的默认注意力算子。在某些批次大小设置下(特别是中等并发),FIA 可能表现出次优性能。PA (Page Attention) 算子可以通过 pa_shape_list 中的 --additional-config 手动启用。当运行时批次大小与 pa_shape_list 中的值匹配时,框架会切换到 PA。这是一个临时的调优参数——未来的 FIA 优化将使此参数过时。