{"record":{"id":"16afaa578de74f91","repo":"sgl-project/sglang","slug":"unsupported-library-transformers-or-diffusers","errorCode":null,"errorMessage":"Unsupported library: {transformers_or_diffusers}","messagePattern":"Unsupported library: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/loader/component_loaders/component_loader.py","lineNumber":390,"sourceCode":"                config=config,\n                trust_remote_code=server_args.trust_remote_code,\n                revision=server_args.revision,\n                **load_kwargs,\n            )\n        elif transformers_or_diffusers == \"diffusers\":\n            from diffusers import AutoModel\n\n            component_model_path = prepare_diffusers_component_path_for_loading(\n                component_model_path\n            )\n            return AutoModel.from_pretrained(\n                component_model_path,\n                revision=server_args.revision,\n                trust_remote_code=server_args.trust_remote_code,\n                **load_kwargs,\n            )\n        else:\n            raise ValueError(f\"Unsupported library: {transformers_or_diffusers}\")\n\n    def resolve_native_transformers_model_class(self, config: PretrainedConfig) -> type:\n        return transformers.AutoModel\n\n    def load_customized(\n        self, component_model_path: str, server_args: ServerArgs, component_name: str\n    ):\n        \"\"\"\n        Load the customized version component, implemented and optimized in SGL-diffusion\n        \"\"\"\n        raise NotImplementedError(\n            f\"load_customized not implemented for {self.__class__.__name__}\"\n        )\n\n    @classmethod\n    def _ensure_loaders_registered(cls):\n        \"\"\"\n        avoid multiple registration","sourceCodeStart":372,"sourceCodeEnd":408,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/loader/component_loaders/component_loader.py#L372-L408","documentation":"load_native dispatches on a library name ('transformers' or 'diffusers'); any other value falls through to this ValueError. The library string comes from the component/loader configuration describing which framework loads the checkpoint natively.","triggerScenarios":"A loader or component config setting library to something like 'diffuser', 'Transformers' (wrong case), 'timm', or None reaching load_native; called via _load_native_with_context during component loading.","commonSituations":"Typos in component library configuration; new loaders copied from an example forgetting to set the library; config serialization changing case or adding whitespace.","solutions":["Set the library attribute to exactly 'transformers' or 'diffusers' (lowercase)","If a third-party loader needs another framework, implement load_customized instead of relying on load_native","Strip/normalize the string when reading it from config: value.strip().lower()"],"exampleFix":"# before\nself.library = 'Transformers'\n# after\nself.library = 'transformers'","handlingStrategy":"validation","validationCode":"library = (getattr(loader, 'library', '') or '').strip().lower()\nassert library in ('transformers', 'diffusers'), f\"Unsupported library: {library}\"","typeGuard":"def is_supported_library(v) -> bool:\n    return isinstance(v, str) and v.strip().lower() in ('transformers', 'diffusers')","tryCatchPattern":null,"preventionTips":["Normalize library strings to lowercase at config-read time","Add unit tests for loaders covering both library branches"],"tags":["model-loading","config","dispatch"],"backgroundTag":"invalid-enum-config-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}