[torch.compile] add warning for unsupported models (#10622)
Signed-off-by: youkaichao <youkaichao@gmail.com>
This commit is contained in:
@@ -80,6 +80,9 @@ def set_current_vllm_config(vllm_config: "VllmConfig"):
|
||||
"""
|
||||
global _current_vllm_config
|
||||
old_vllm_config = _current_vllm_config
|
||||
from vllm.compilation.counter import compilation_counter
|
||||
from vllm.config import CompilationLevel
|
||||
num_models_seen = compilation_counter.num_models_seen
|
||||
try:
|
||||
_current_vllm_config = vllm_config
|
||||
yield
|
||||
@@ -88,6 +91,18 @@ def set_current_vllm_config(vllm_config: "VllmConfig"):
|
||||
vllm_config.compilation_config.enabled_custom_ops)
|
||||
logger.debug("disabled custom ops: %s",
|
||||
vllm_config.compilation_config.disabled_custom_ops)
|
||||
if vllm_config.compilation_config.level == CompilationLevel.PIECEWISE \
|
||||
and compilation_counter.num_models_seen == num_models_seen:
|
||||
# If the model supports compilation,
|
||||
# compilation_counter.num_models_seen should be increased
|
||||
# by at least 1.
|
||||
# If it is not increased, it means the model does not support
|
||||
# compilation (does not have @support_torch_compile decorator).
|
||||
logger.warning(
|
||||
"`torch.compile` is turned on, but the model %s"
|
||||
" does not support it. Please open an issue on GitHub"
|
||||
"if you want it to be supported.",
|
||||
vllm_config.model_config.model)
|
||||
_current_vllm_config = old_vllm_config
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user