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 bridge loader requires the component config to be in diffusers format, identified by the '_class_name' key. If popping '_class_name' yields None (key missing), it raises this ValueError since it cannot determine which bridge class to instantiate via ModelRegistry.

Source

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

logger = init_logger(__name__)


class BridgeLoader(PlainStateDictComponentLoader):
    """Loader for MOVA dual tower bridge with FSDP support."""

    pipeline_bridge_config_attr: str = "bridge_config"

    component_names = ["dual_tower_bridge"]
    expected_library = "diffusers"

    def load_customized(
        self, component_model_path: str, server_args: ServerArgs, component_name: str
    ):
        config = self.load_component_config(component_model_path, component_name)
        hf_config = deepcopy(config)
        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."
            )
        server_args.model_paths[component_name] = component_model_path

        # Try to get bridge config from pipeline config, fallback to creating one
        bridge_config = getattr(
            server_args.pipeline_config, self.pipeline_bridge_config_attr, None
        )
        if bridge_config is not None:
            bridge_config.update_model_arch(config)
        else:
            # Create a minimal config from hf_config
            from sglang.multimodal_gen.configs.models.bridges.mova_dual_tower import (
                MOVADualTowerConfig,
            )

            bridge_config = MOVADualTowerConfig()

View on GitHub (pinned to 0132848349)

Solutions

  1. Point the bridge component path at the directory containing the diffusers-format config.json with _class_name
  2. Re-export or re-download the bridge component in diffusers format
  3. As a last resort for a known-valid config, add "_class_name": "<BridgeClass>" manually
Defensive patterns

Strategy: validation

Validate before calling

import json

cfg = json.load(open(f"{component_path}/config.json"))
assert cfg.get("_class_name"), f"{component_path} is not diffusers-format"

Prevention

When it happens

Trigger: Calling bridge loader load_customized on a component directory whose config.json lacks '_class_name' — a transformers-style config or a manually assembled directory.

Common situations: Model path pointing at the wrong subdirectory (e.g. the root repo instead of the bridge component folder); a component exported without diffusers; partially downloaded/moved checkpoints missing config.json keys.

Related errors


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