{"record":{"id":"d535c5ca0542d28d","repo":"sgl-project/sglang","slug":"cannot-determine-processor-class-for-model-path","errorCode":null,"errorMessage":"Cannot determine processor class for {model_path}","messagePattern":"Cannot determine processor class for (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/utils/hf_transformers/processor.py","lineNumber":162,"sourceCode":"    auto_map = getattr(config, \"auto_map\", None) or {}\n    proc_ref = auto_map.get(\"AutoProcessor\")\n    if not proc_ref:\n        try:\n            pp_file = _resolve_local_or_cached_file(\n                model_path, \"preprocessor_config.json\", revision\n            )\n            with open(pp_file) as f:\n                pp_auto_map = json.load(f).get(\"auto_map\", {})\n            proc_ref = pp_auto_map.get(\"AutoProcessor\")\n        except (OSError, json.JSONDecodeError, ValueError) as e:\n            logger.warning(\n                \"_build_processor_manually: could not read preprocessor_config.json \"\n                \"for %s: %s\",\n                model_path,\n                e,\n            )\n    if not proc_ref:\n        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(","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/utils/hf_transformers/processor.py#L144-L180","documentation":"When auto-loading the processor class fails, sglang falls back to _build_processor_manually using the processor_class/auto_map entry from preprocessor_config.json; that reference is missing too, so no processor class can be constructed for the model.","triggerScenarios":"Loading a multimodal model whose repo lacks both a resolvable auto_map/processor_class in preprocessor_config.json and standard processor files.","commonSituations":"Partial uploads, custom models missing processor metadata, or trust_remote_code models whose remote processor code path is absent.","solutions":["Ensure preprocessor_config.json contains a processor_class or auto_map entry pointing at the processor implementation","Re-download the model to restore missing files","Pass trust_remote_code=True if the model ships remote code"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"import json; pc = json.load(open(Path(model)/'preprocessor_config.json'))\nproc_ref = pc.get('auto_map',{}).get('AutoProcessor') or pc.get('processor_class')\nif not proc_ref: expect manual-build failure","typeGuard":null,"tryCatchPattern":"try:\n    get_processor(model)\nexcept ValueError as e:\n    if 'Cannot determine processor class' in str(e): re-download model or use transformers AutoProcessor directly","preventionTips":["Use complete, official multimodal model repos","Enable trust_remote_code for custom processors"],"tags":["multimodal","processor","model-loading"],"backgroundTag":"processor-class-not-found","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}