sgl-project/sglang · error · ValueError
Unsupported library: {transformers_or_diffusers}
Error message
Unsupported library: {transformers_or_diffusers} What it means
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.
Source
Thrown at python/sglang/multimodal_gen/runtime/loader/component_loaders/component_loader.py:390
config=config,
trust_remote_code=server_args.trust_remote_code,
revision=server_args.revision,
**load_kwargs,
)
elif transformers_or_diffusers == "diffusers":
from diffusers import AutoModel
component_model_path = prepare_diffusers_component_path_for_loading(
component_model_path
)
return AutoModel.from_pretrained(
component_model_path,
revision=server_args.revision,
trust_remote_code=server_args.trust_remote_code,
**load_kwargs,
)
else:
raise ValueError(f"Unsupported library: {transformers_or_diffusers}")
def resolve_native_transformers_model_class(self, config: PretrainedConfig) -> type:
return transformers.AutoModel
def load_customized(
self, component_model_path: str, server_args: ServerArgs, component_name: str
):
"""
Load the customized version component, implemented and optimized in SGL-diffusion
"""
raise NotImplementedError(
f"load_customized not implemented for {self.__class__.__name__}"
)
@classmethod
def _ensure_loaders_registered(cls):
"""
avoid multiple registrationView on GitHub (pinned to 0132848349)
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()
Example fix
# before self.library = 'Transformers' # after self.library = 'transformers'
Defensive patterns
Strategy: validation
Validate before calling
library = (getattr(loader, 'library', '') or '').strip().lower()
assert library in ('transformers', 'diffusers'), f"Unsupported library: {library}" Type guard
def is_supported_library(v) -> bool:
return isinstance(v, str) and v.strip().lower() in ('transformers', 'diffusers') Prevention
- Normalize library strings to lowercase at config-read time
- Add unit tests for loaders covering both library branches
When it happens
Trigger: 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.
Common situations: Typos in component library configuration; new loaders copied from an example forgetting to set the library; config serialization changing case or adding whitespace.
Related errors
- f"flash attention version {fa_ver} is not supported."
- Model config does not contain a _class_name attribute. Only
- Model config does not contain a _class_name attribute. Only
- f"Cannot parse checkpoint quantization for {component_name!r
- f"Transformers-managed {component_name!r} quantization requi
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/16afaa578de74f91.
Report an issue: GitHub.