sgl-project/sglang · error · ValueError
Required `vision_config.model_type` is not found in hf_confi
Error message
Required `vision_config.model_type` is not found in hf_config: `{hf_config}` What it means
The LLaVA wrapper processor needs hf_config.vision_config.model_type to select the inner processor. The loaded HF config has a vision_config without a model_type field, so dispatch is impossible.
Source
Thrown at python/sglang/srt/multimodal/processors/llava.py:301
if sgl_processor_cls:
return sgl_processor_cls[0]
raise ValueError(
f"Cannot find corresponding multimodal processor registered in sglang for model type `{model_type}`"
)
def __init__(self, hf_config, server_args, _processor, *args, **kwargs):
assert hasattr(hf_config, "vision_config")
assert hasattr(hf_config, "text_config")
self.vision_config = hf_config.vision_config
self.text_config = hf_config.text_config
self.hf_config = hf_config
if vision_type := getattr(self.vision_config, "model_type"):
self.inner = self._get_sgl_processor_cls(vision_type)(
hf_config, server_args, _processor, *args, **kwargs
)
else:
raise ValueError(
f"Required `vision_config.model_type` is not found in hf_config: `{hf_config}`"
)
async def process_mm_data_async(self, *args, **kwargs):
return await self.inner.process_mm_data_async(*args, **kwargs)
View on GitHub (pinned to 0132848349)
Solutions
- Inspect the model repo's config.json and confirm vision_config.model_type exists (e.g. "siglip_vision_model")
- Fix or restore the missing key in config.json from the original base model repo
- Re-download the model from a trusted mirror in case of a corrupted snapshot
Example fix
// config.json before
"vision_config": {"hidden_size": 1152}
// after
"vision_config": {"model_type": "siglip_vision_model", "hidden_size": 1152} Defensive patterns
Strategy: validation
Validate before calling
cfg = json.load(open(model_dir / "config.json"))
assert cfg.get("vision_config", {}).get("model_type"), "vision_config.model_type missing" Prevention
- Validate config.json structure after downloading or merging checkpoints
- Keep a reference config from the base model to diff against
When it happens
Trigger: Loading a model whose config.json contains vision_config but that dict lacks the model_type key (malformed or hand-edited config, or a checkpoint saved by an older transformers version).
Common situations: Merging checkpoints or editing configs manually drops vision_config.model_type; a quantized/converted repo ships an incomplete config.
Related errors
- {selection_error}{component_suffix}
- f"Unsupported patch_size type: {type(patch_size)}"
- Model config does not contain a _class_name attribute. Only
- Model config does not contain a _class_name attribute. Only
- f"Cannot parse checkpoint quantization for {component_name!r
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/bebeba108816342c.
Report an issue: GitHub.