附加配置#
额外配置是 vLLM 提供的一种机制,允许插件自行控制内部行为。vLLM Ascend 利用这种机制使项目更加灵活。
如何使用#
无论是在线模式还是离线模式,用户都可以使用额外的配置。以 Qwen3 为例:
在线模式:
vllm serve Qwen/Qwen3-8B --additional-config='{"config_key":"config_value"}'
离线模式:
from vllm import LLM
LLM(model="Qwen/Qwen3-8B", additional_config={"config_key":"config_value"})
配置选项#
下表列出了 vLLM Ascend 中可用的其他配置选项:
名称 |
类型 |
默认 |
描述 |
|---|---|---|---|
|
dict |
|
torchair 图模式的配置选项 |
|
dict |
|
ascend 调度器的配置选项 |
|
bool |
|
是否刷新全局 ascend 配置信息。此值通常由 rlhf 或 ut/e2e 测试用例使用。 |
|
str |
|
在为MOE模型使用专家负载均衡时,需要传入专家映射路径。 |
|
str |
|
当使用kv缓存量化方法时,需要设置kv缓存的数据类型,目前仅支持int8。 |
|
bool |
|
Whether to enable prefill optimizations. |
每个配置选项的详细信息如下:
torchair_graph_config
名称 |
类型 |
默认 |
描述 |
|---|---|---|---|
|
bool |
|
是否启用 torchair 图模式。目前仅支持 DeepSeek 系列模型和 PanguProMoE 使用 torchair 图模式。 |
|
bool |
|
是否将MLA的向量操作放到另一个流中。此选项仅对使用MLA的模型(例如,DeepSeek)有效。 |
|
bool |
|
是否启用多流共享专家功能。此选项仅对 DeepSeek MoE 模型生效。 |
|
bool |
|
是否启用torchair视图优化 |
|
bool |
|
是否使用缓存的图 |
|
list[int] |
|
torchair 图缓存的批量大小 |
|
bool |
|
如果 |
|
bool |
|
是否启用 kvcache NZ 布局。此选项仅对使用 MLA 的模型(例如 DeepSeek)生效。 |
|
bool |
|
Whether to enable super kernel |
ascend_scheduler_config
名称 |
类型 |
默认 |
描述 |
|---|---|---|---|
|
bool |
|
是否为 V1 引擎启用 ascend 调度器 |
ascend_scheduler_config 也支持来自 vllm scheduler config 的选项。例如,你也可以在 ascend_scheduler_config 中添加 enable_chunked_prefill: True。
示例#
以下是额外配置的一个示例:
{
"torchair_graph_config": {
"enabled": True,
"use_cached_graph": True,
"graph_batch_sizes": [1, 2, 4, 8],
"graph_batch_sizes_init": False,
"enable_multistream_moe": False,
"enable_kv_nz": False
},
"ascend_scheduler_config": {
"enabled": True,
"enable_chunked_prefill": True,
},
"refresh": False,
}