Skip to content

Commit f7ef414

Browse files
committed
Reject unsupported architectures in the front end
verify_model_arch only ran from _try_load_model_cls, which the API server does not reach: front-end resolution goes through inspect_model_cls. On SM120 the guard therefore fired inside the worker, off the usage-stats path in init_device(), so both TP workers spawned and dumped a traceback before EngineCore shut them down. Call verify_model_arch from ModelConfig once the architecture is resolved, so an unsupported device is rejected before any worker starts. The check in _try_load_model_cls stays as a backstop for paths that build a model without going through ModelConfig. Reported-by: Rawsejet <#51560> Signed-off-by: maxim955827848 <maxim955827848@gmail.com>
1 parent ea8778f commit f7ef414

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

tests/test_config.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,26 @@ def test_draft_runner(model_id, expected_runner_type, expected_convert_type):
611611
assert config.convert_type == expected_convert_type
612612

613613

614+
def test_platform_rejects_unsupported_arch_during_config(monkeypatch):
615+
"""Architectures the platform cannot run are rejected in the front end.
616+
617+
`_try_load_model_cls` checks this as well, but only once a worker is
618+
already up and loading the model.
619+
"""
620+
rejected = []
621+
622+
def verify_model_arch(model_arch: str) -> None:
623+
rejected.append(model_arch)
624+
raise ValueError(f"Model architecture '{model_arch}' is not supported")
625+
626+
monkeypatch.setattr(current_platform, "verify_model_arch", verify_model_arch)
627+
628+
with pytest.raises(ValueError, match="Qwen3ForCausalLM"):
629+
ModelConfig("Qwen/Qwen3-0.6B", max_model_len=2048)
630+
631+
assert rejected == ["Qwen3ForCausalLM"]
632+
633+
614634
MODEL_IDS_EXPECTED = [
615635
("Qwen/Qwen1.5-7B", 32768),
616636
("mistralai/Mistral-7B-v0.1", 4096),

vllm/config/model.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,11 @@ def __post_init__(
671671
self._architecture = arch
672672
logger.info("Resolved architecture: %s", arch)
673673

674+
# Reject architectures this platform cannot run before any worker is
675+
# spawned. `_try_load_model_cls` checks this too, but that only runs
676+
# once the model is being loaded inside a worker.
677+
current_platform.verify_model_arch(arch)
678+
674679
# Set default tokenizer modes based on model architecture
675680
if self.tokenizer_mode == "auto":
676681
if self.model_impl == "terratorch":

0 commit comments

Comments
 (0)