附加配置#
额外配置是 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 调度器的配置选项 |
|
dict |
|
权重预取的配置选项 |
|
bool |
|
是否刷新全局 Ascend 配置信息。此值通常由 RLHF 或 UT/E2E 测试用例使用。 |
|
str |
|
在为 MoE 模型使用专家负载均衡时,需要传入专家映射路径。 |
|
str |
|
当使用 KV 缓存量化方法时,需要设置 KV 缓存的数据类型,目前仅支持 int8。 |
|
bool |
|
当专家在 DP 中共享时,可以获得更好的性能,但会消耗更多内存。目前仅支持 DeepSeek 系列模型。 |
|
int |
|
LMHead 的自定义张量并行大小。 |
|
int |
|
OProj 的自定义张量并行大小。 |
|
bool |
|
是否启用多流共享专家功能。此选项仅对具有共享专家的 MoE 模型生效。 |
|
bool |
|
是否启用动态 EPLB。 |
|
int |
|
EPLB 开始时的前向迭代次数。 |
|
bool |
|
是否仅启用一次 EPLB。 |
|
int |
|
The forward iterations when the EPLB worker will finish CPU tasks. In our test default value 30 can cover most cases. |
|
str |
|
动态 EPLB 完成后,将当前专家负载热图保存到指定路径。 |
|
int |
|
初始化时指定冗余专家。 |
每个配置选项的详细信息如下:
torchair_graph_config
名称 |
类型 |
默认 |
描述 |
|---|---|---|---|
|
bool |
|
Whether to enable torchair graph mode. Currently only DeepSeek series models and PanguProMoE are supported. |
|
str |
|
When using reduce-overhead mode for torchair, it needs to be set. |
|
bool |
|
Whether to put vector operators of MLA to another stream. This option only takes effect on models using MLA (for example, DeepSeek). |
|
bool |
|
Whether to enable torchair view optimization. |
|
bool |
|
Whether to fix the memory address of weights during inference to reduce the input address refresh time during graph execution. |
|
bool |
|
Whether to use cached graph. |
|
list[int] |
|
The batch size for torchair graph cache. |
|
bool |
|
Init graph batch size dynamically if |
|
bool |
|
Whether to enable KV Cache NZ layout. This option only takes effect on models using MLA (for example, DeepSeek). |
|
bool |
|
Whether to enable super kernel to fuse operators in deepseek moe layers. This option only takes effects on moe models using dynamic w8a8 quantization. |
ascend_scheduler_config
名称 |
类型 |
默认 |
描述 |
|---|---|---|---|
|
bool |
|
Whether to enable ascend scheduler for V1 engine. |
|
bool |
|
Whether to enable P-D transfer. When it is enabled, decode is started only when prefill of all requests is done. This option only takes effect on offline inference. |
|
int |
|
Whether to change max_num_seqs of decode phase when P-D transfer is enabled. This option only takes effect when enable_pd_transfer is True. |
|
Union[int, float] |
|
The maximum number of prompts longer than long_prefill_token_threshold that will be prefilled concurrently. |
|
Union[int, float] |
|
a request is considered long if the prompt is longer than this number of tokens. |
ascend_scheduler_config 同样支持来自 vllm 调度器配置 的选项。例如,您也可以在 ascend_scheduler_config 中添加 enable_chunked_prefill: True。
weight_prefetch_config
名称 |
类型 |
默认 |
描述 |
|---|---|---|---|
|
bool |
|
Whether to enable weight prefetch. |
|
dict |
|
Prefetch ratio of each weights. |
例如#
附加配置
{
"torchair_graph_config": {
"enabled": True,
"use_cached_graph": True,
"graph_batch_sizes": [1, 2, 4, 8],
"graph_batch_sizes_init": False,
"enable_kv_nz": False
},
"ascend_scheduler_config": {
"enabled": True,
"enable_chunked_prefill": True,
"max_long_partial_prefills": 1,
"long_prefill_token_threshold": 4096,
},
"weight_prefetch_config": {
"enabled": True,
"prefetch_ratio": {
"attn": {
"qkv": 1.0,
"o": 1.0,
},
"moe": {
"gate_up": 0.8
}
},
},
"multistream_overlap_shared_expert": True,
"refresh": False,
}