{"record":{"id":"4e2005bf809c4b34","repo":"sgl-project/sglang","slug":"failed-to-load-image-processor-for-model-path","errorCode":null,"errorMessage":"Failed to load image_processor for {model_path}: {e}. This model requires an image processor for multimodal features. Check that the model files are complete and accessible.","messagePattern":"Failed to load image_processor for (.+?): (.+?)\\. This model requires an image processor for multimodal features\\. Check that the model files are complete and accessible\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/utils/hf_transformers/processor.py","lineNumber":180,"sourceCode":"        raise ValueError(f\"Cannot determine processor class for {model_path}\")\n\n    proc_cls = get_class_from_dynamic_module(\n        proc_ref, model_path, code_revision=revision\n    )\n\n    # Load sub-components individually (these succeed)\n    tokenizer = AutoTokenizer.from_pretrained(\n        model_path, trust_remote_code=trust_remote_code, revision=revision\n    )\n    init_kwargs = {\"tokenizer\": tokenizer}\n\n    if \"image_processor\" in getattr(proc_cls, \"attributes\", []):\n        try:\n            init_kwargs[\"image_processor\"] = AutoImageProcessor.from_pretrained(\n                model_path, trust_remote_code=trust_remote_code, revision=revision\n            )\n        except (ImportError, OSError, ValueError) as e:\n            raise RuntimeError(\n                f\"Failed to load image_processor for {model_path}: {e}. \"\n                f\"This model requires an image processor for multimodal features. \"\n                f\"Check that the model files are complete and accessible.\"\n            ) from e\n\n    # Instantiate feature extractor from its declared class\n    fe_class_name = getattr(proc_cls, \"feature_extractor_class\", None)\n    if fe_class_name:\n        fe_class = getattr(transformers, fe_class_name, None)\n        if fe_class is not None:\n            try:\n                init_kwargs[\"feature_extractor\"] = fe_class()\n            except TypeError as e:\n                logger.warning(\n                    \"Cannot instantiate feature extractor %s with no arguments \"\n                    \"for %s: %s\",\n                    fe_class_name,\n                    model_path,","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/utils/hf_transformers/processor.py#L162-L198","documentation":"The processor class declares an image_processor attribute, but AutoImageProcessor.from_pretrained failed with ImportError/OSError/ValueError, so the multimodal processor cannot be built. The underlying exception text is included.","triggerScenarios":"Loading a VLM whose preprocessor_config.json exists but image processor files (e.g. preprocessor configs or required libs) are missing or incompatible with the installed transformers version.","commonSituations":"Incomplete model snapshots, transformers version mismatch for new VLMs, or missing optional image dependencies.","solutions":["Read the chained {e} cause; fix that (e.g. pip install missing dep, upgrade transformers)","Re-download the full model repo (check for missing preprocessor_config.json or image files)","Fall back to a transformers/sglang version matching the model release"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"try:\n    from transformers import AutoImageProcessor; AutoImageProcessor.from_pretrained(model)\nexcept Exception: fix deps/files before calling get_processor","typeGuard":null,"tryCatchPattern":"try:\n    get_processor(model)\nexcept RuntimeError as e:\n    if 'Failed to load image_processor' in str(e): inspect e.__cause__, then upgrade transformers / re-download","preventionTips":["Install multimodal extras (torchvision/PIL) up front","Match transformers version to the VLM release"],"tags":["multimodal","image-processor","dependencies"],"backgroundTag":"image-processor-load-failed","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}