|
23 | 23 | import vllm.envs as envs
|
24 | 24 | from vllm.logger import logger
|
25 | 25 | from vllm.platforms import Platform, PlatformEnum
|
26 |
| -from vllm.utils import supports_dynamo |
27 | 26 |
|
28 | 27 | from vllm_ascend.utils import ASCEND_QUATIZATION_METHOD, update_aclgraph_sizes
|
29 | 28 |
|
@@ -131,16 +130,27 @@ def check_and_update_config(cls, vllm_config: VllmConfig) -> None:
|
131 | 130 | if vllm_config.additional_config is not None:
|
132 | 131 | enable_graph_mode = vllm_config.additional_config.get(
|
133 | 132 | "enable_graph_mode", False)
|
134 |
| - if enable_graph_mode and not supports_dynamo(): |
135 |
| - logger.warning( |
136 |
| - "enable_graph_mode is not supported because the version of torch is too low, forcing close enable_graph_mode" |
137 |
| - ) |
138 |
| - vllm_config.additional_config["enable_graph_mode"] = False |
139 |
| - if enable_graph_mode and envs.VLLM_USE_V1 and envs.VLLM_MLA_DISABLE: |
140 |
| - logger.warning( |
141 |
| - "NPU graph mode is still experimental and not supported for V1 without mla currently, " |
142 |
| - "it has been disabled automatically.") |
143 |
| - vllm_config.additional_config["enable_graph_mode"] = False |
| 133 | + if enable_graph_mode: |
| 134 | + if enforce_eager: |
| 135 | + raise RuntimeError( |
| 136 | + f"Expect enable_graph_mode != enforce_eager. However got enable_graph_mode={enable_graph_mode}" |
| 137 | + f" and enforce_eager={enforce_eager}. Please set `enforce_eager=False` if you attempt" |
| 138 | + " to enable NPU graph mode.") |
| 139 | + elif envs.VLLM_USE_V1 and envs.VLLM_MLA_DISABLE: |
| 140 | + logger.warning( |
| 141 | + "NPU graph mode is still experimental and not supported for V1 without mla currently, " |
| 142 | + "it has been disabled automatically.") |
| 143 | + vllm_config.additional_config["enable_graph_mode"] = False |
| 144 | + if model_config: |
| 145 | + model_type = model_config.hf_config.model_type |
| 146 | + if "deepseek" not in model_type: |
| 147 | + raise NotImplementedError( |
| 148 | + "NPU Graph only supports deepseek. Please " |
| 149 | + "disable it by additional_config={'enable_graph_mode': True} " |
| 150 | + "to serve deepseek models with NPU graph mode on vllm-ascend with V0 engine." |
| 151 | + " Or set `enforce_eager=True` to use eager mode on V1 engine." |
| 152 | + ) |
| 153 | + |
144 | 154 | elif envs.VLLM_USE_V1 and model_config is not None and not enforce_eager:
|
145 | 155 | model_type = model_config.hf_config.model_type
|
146 | 156 | if "deepseek" in model_type:
|
|
0 commit comments