{"record":{"id":"4202237ddd70c256","repo":"sgl-project/sglang","slug":"model-config-does-not-contain-a-class-name-attrib","errorCode":null,"errorMessage":"Model config does not contain a _class_name attribute. Only diffusers format is supported.","messagePattern":"Model config does not contain a _class_name attribute\\. Only diffusers format is supported\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/loader/component_loaders/adapter_loader.py","lineNumber":53,"sourceCode":"        \"connectors\": LTX2ConnectorConfig,\n        \"duration_head\": LTX2DurationHeadConfig,\n    }\n\n    def load_customized(\n        self,\n        component_model_path: str,\n        server_args: ServerArgs,\n        component_name: str = \"connectors\",\n        *args,\n    ):\n        config = self.load_component_config(component_model_path, component_name)\n        component_weights_path = self.resolve_component_weights_path(\n            component_model_path, server_args, component_name\n        )\n\n        cls_name = config.pop(\"_class_name\", None)\n        if cls_name is None:\n            raise ValueError(\n                \"Model config does not contain a _class_name attribute. \"\n                \"Only diffusers format is supported.\"\n            )\n\n        config.pop(\"_diffusers_version\", None)\n        config.pop(\"_name_or_path\", None)\n\n        server_args.model_paths[component_name] = component_model_path\n\n        model_cls, _ = ModelRegistry.resolve_model_cls(cls_name)\n\n        # Not a fixed name: connectors follow DiT offload, while the duration\n        # head stays resident unless selected explicitly.\n        target_device = self.target_device(\n            server_args.should_start_component_on_cpu(component_name)\n        )\n        default_dtype = resolve_precision(\n            server_args, component_name, precision_attr=\"dit_precision\"","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/loader/component_loaders/adapter_loader.py#L35-L71","documentation":"The adapter loader reads the component's config.json and pops '_class_name' to determine which diffusers class to instantiate. If the key is absent (or None), it raises this ValueError because only diffusers-format component configs, which always carry _class_name, are supported.","triggerScenarios":"Calling load_customized on an adapter component directory whose config.json has no '_class_name' key — e.g. a plain transformers-style config, a hand-written config, or a config where the key was renamed.","commonSituations":"Pointing --adapter-path (or the component model path) at a transformers checkpoint instead of a diffusers one; exporting an adapter without diffusers save_pretrained; config file edited/renamed keys.","solutions":["Re-export the adapter with diffusers save_pretrained so config.json contains _class_name","Point the component path at the correct diffusers-format adapter directory","If the config is valid but hand-edited, add \"_class_name\": \"<AdapterClass>\" to config.json"],"exampleFix":"// before: config.json has no _class_name\n// after: config.json\n{ \"_class_name\": \"MotionAdapter\", \"...\": \"...\" }","handlingStrategy":"validation","validationCode":"import json\n\ncfg = json.load(open(f\"{adapter_path}/config.json\"))\nassert \"_class_name\" in cfg, \"adapter is not in diffusers format (missing _class_name)\"","typeGuard":null,"tryCatchPattern":"try:\n    loader.load_customized(path, server_args, name)\nexcept ValueError as e:\n    if \"_class_name\" in str(e):\n        raise SystemExit(f\"{path} is not a diffusers-format adapter\") from e\n    raise","preventionTips":["Always source components from diffusers save_pretrained exports","Check config.json for _class_name before wiring component paths"],"tags":["model-loading","diffusers","adapter","config"],"backgroundTag":"missing-config-key","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}