sgl-project/sglang · error · ValueError

Model config does not contain a _class_name attribute. Only

Error message

Model config does not contain a _class_name attribute. Only diffusers format is supported.

What it means

The diffusion decoder loader instantiates the decoder class from config's '_class_name'. If that key is missing (None after pop), it raises this ValueError — only diffusers-format component configs, which carry _class_name, are supported.

Source

Thrown at python/sglang/multimodal_gen/runtime/loader/component_loaders/diffusion_decoder_loader.py:38

    """Loader for the standalone, replicated LTX-2.5 diffusion decoder."""

    component_names = ["diffusion_decoder"]
    expected_library = "diffusers"

    def load_customized(
        self,
        component_model_path: str,
        server_args: ServerArgs,
        component_name: str = "diffusion_decoder",
        *args,
    ):
        config = self.load_component_config(component_model_path, component_name)
        component_weights_path = self.resolve_component_weights_path(
            component_model_path, server_args, component_name
        )
        class_name = config.pop("_class_name", None)
        if class_name is None:
            raise ValueError(
                "Model config does not contain a _class_name attribute. "
                "Only diffusers format is supported."
            )
        config.pop("_diffusers_version", None)
        config.pop("_name_or_path", None)

        server_args.model_paths[component_name] = component_model_path
        model_cls, _ = ModelRegistry.resolve_model_cls(class_name)
        target_device = self.target_device(
            server_args.should_start_component_on_cpu(component_name)
        )
        dtype = resolve_precision(
            server_args, component_name, precision_attr="vae_precision"
        )

        decoder_config = LTX25DiffusionDecoderConfig()
        decoder_config.update_model_arch(config)
        with set_default_torch_dtype(dtype), skip_init_modules():

View on GitHub (pinned to 0132848349)

Solutions

  1. Point the decoder component path at the diffusers-format directory containing config.json with _class_name
  2. Re-export the decoder with diffusers save_pretrained
  3. Manually add "_class_name": "<DecoderClass>" if the config is otherwise correct
Defensive patterns

Strategy: validation

Validate before calling

import json

cfg = json.load(open(f"{decoder_path}/config.json"))
assert cfg.get("_class_name"), "decoder component must be diffusers-format"

Prevention

When it happens

Trigger: Loading a diffusion decoder component directory whose config.json lacks '_class_name' (transformers-style config, hand-written config, or wrong directory).

Common situations: Wrong subdirectory given as the decoder path; decoder exported without diffusers save_pretrained; a renamed/mangled config.json.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/5e0563a88c6ed4ed. Report an issue: GitHub.