A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 11, 12:30 UTC
[Bugfix] Improve error messages in ModelConfig validation (#30213)
Signed-off-by: ytian218 <ytian218@bloomberg.net> Co-authored-by: ytian218 <ytian218@bloomberg.net>
yifant-code committed
Dec 14, 2025 at 08:23 UTC
5ccf0efa8422277ff25adbcf137136925a3f0b51
1 file changed
+20
-4
vllm/config/model.py
+20
-4
@@ -611,9 +611,17 @@ class ModelConfig:
611
@model_validator(mode="after")
612
def validate_model_config_after(self: "ModelConfig") -> "ModelConfig":
613
if not isinstance(self.tokenizer, str):
614
- raise ValueError("tokenizer must be a string after __post_init__.")
615
- if not isinstance(self.max_model_len, int):
616
- raise ValueError("max_model_len must be an integer after __post_init__.")
614
+ raise ValueError(
615
+ f"tokenizer must be a string, got "
616
+ f"{type(self.tokenizer).__name__}: {self.tokenizer!r}. "
617
+ "Please provide a valid tokenizer path or HuggingFace model ID."
618
+ )
619
+ if not isinstance(self.max_model_len, int) or self.max_model_len <= 0:
620
+ raise ValueError(
621
+ f"max_model_len must be a positive integer, "
622
+ f"got {type(self.max_model_len).__name__}: {self.max_model_len!r}. "
623
+ "Example: max_model_len=2048"
624
+ )
625
return self
626
627
def _get_transformers_backend_cls(self) -> str:
@@ -1186,7 +1194,15 @@ class ModelConfig:
1194
// block.attention.n_heads_in_group
1195
)
1196
1189
- raise RuntimeError("Couldn't determine number of kv heads")
1197
+ raise RuntimeError(
1198
+ "Could not determine the number of key-value attention heads "
1199
+ "from model configuration. "
1200
+ f"Model: {self.model}, Architecture: {self.architectures}. "
1201
+ "This usually indicates an unsupported model architecture or "
1202
+ "missing configuration. "
1203
+ "Please check if your model is supported at: "
1204
+ "https://docs.vllm.ai/en/latest/models/supported_models.html"
1205
+ )
1206
1207
if self.is_attention_free:
1208
return 0