{"record":{"id":"8580d668d10de981","repo":"sgl-project/sglang","slug":"f-transformers-managed-component-name-r-quantiza","errorCode":null,"errorMessage":"f\"Transformers-managed {component_name!r} quantization requires a top-level quantization_config; got metadata from {quant_spec.source!r}\"","messagePattern":"f\"Transformers-managed (.+?) quantization requires a top-level quantization_config; got metadata from (.+?)\"","errorType":"exception","errorClass":"ComponentCheckpointUnsupportedError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/loader/component_loaders/component_loader.py","lineNumber":79,"sourceCode":"    \"\"\"A component checkpoint is unsupported and must not use native fallback.\"\"\"\n\n\nclass NativeComponentLoaderRequired(RuntimeError):\n    \"\"\"The customized loader must defer to the native library loader.\"\"\"\n\n\ndef uses_native_transformers_bnb4(config: object, component_name: str) -> bool:\n    \"\"\"Validate a serialized BnB4 checkpoint owned by Transformers.\"\"\"\n    try:\n        quant_spec = resolve_checkpoint_quant_spec(config)\n    except (TypeError, ValueError) as error:\n        raise ComponentCheckpointUnsupportedError(\n            f\"Cannot parse checkpoint quantization for {component_name!r}: {error}\"\n        ) from error\n    if quant_spec is None or quant_spec.declared_method != \"bitsandbytes\":\n        return False\n    if quant_spec.source != \"quantization_config\":\n        raise ComponentCheckpointUnsupportedError(\n            f\"Transformers-managed {component_name!r} quantization requires \"\n            \"a top-level quantization_config; \"\n            f\"got metadata from {quant_spec.source!r}\"\n        )\n\n    load_in_4bit = quant_spec.config.get(\n        \"load_in_4bit\", quant_spec.config.get(\"_load_in_4bit\")\n    )\n    load_in_8bit = quant_spec.config.get(\n        \"load_in_8bit\", quant_spec.config.get(\"_load_in_8bit\", False)\n    )\n    if load_in_4bit is not True or load_in_8bit is True:\n        raise ComponentCheckpointUnsupportedError(\n            f\"Transformers-managed {component_name!r} quantization supports only \"\n            \"serialized BitsAndBytes 4-bit checkpoints\"\n        )\n    return True\n","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/loader/component_loaders/component_loader.py#L61-L97","documentation":"For a checkpoint declaring bitsandbytes quantization, the loader requires the metadata to come from the top-level 'quantization_config' field. If the bitsandbytes declaration is discovered via another source (e.g. a nested or alternate key), ComponentCheckpointUnsupportedError is raised because Transformers can only natively manage top-level quantization_config.","triggerScenarios":"A component config where bitsandbytes is declared in a non-top-level location (e.g. inside a nested section or a legacy key), so quant_spec.source != 'quantization_config' while declared_method == 'bitsandbytes'.","commonSituations":"Checkpoints re-serialized by third-party tools that moved quantization_config into a sub-dict; mixed old/new diffusers exports where bnb metadata lives elsewhere; hand-merged configs.","solutions":["Move the bitsandbytes quantization metadata to the top-level 'quantization_config' key of the component config","Re-export the model through a current transformers/diffusers save so quantization_config lands top-level","Otherwise use a non-quantized (or fp8) export of the component"],"exampleFix":"// before: config.json\n{ \"transformers_config\": { \"quantization_config\": { \"quant_method\": \"bitsandbytes\" } } }\n// after\n{ \"quantization_config\": { \"quant_method\": \"bitsandbytes\" } }","handlingStrategy":"validation","validationCode":"qc = config.get(\"quantization_config\")\nassert qc is None or isinstance(qc, dict), \"quantization_config must be a top-level dict\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never re-serialize configs through third-party tools that restructure quantization metadata","Re-export quantized models with current transformers versions"],"tags":["quantization","bitsandbytes","config","model-loading"],"backgroundTag":"malformed-quantization-config","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}