sgl-project/sglang · critical · ValueError

Invalid projection layers: {config.projection_layers}

Error message

Invalid projection layers: {config.projection_layers}

What it means

MiMo audio encoder construction switches on config.projection_layers to choose the projection head architecture; values outside the supported set fall through to this error. It indicates the config was authored for an unsupported or newer projection layout than this code supports.

Source

Thrown at python/sglang/srt/models/mimo_audio.py:1256

                )
                for i in range(self.audio_channels)
            ]
        )

        if config.projection_layers == 1:
            self.projection = nn.Linear(
                self.audio_input_local_dim * self.audio_group_size,
                self.audio_out_hidden_size,
                bias=False,
            )
        elif config.projection_layers == 2:
            self.projection = AudioProjection(
                self.audio_input_local_dim * self.audio_group_size,
                self.audio_input_local_dim * self.audio_group_size * 4,
                self.audio_out_hidden_size,
            )
        else:
            raise ValueError(f"Invalid projection layers: {config.projection_layers}")

        model_path = get_model().model_path
        if not os.path.isdir(model_path):
            from huggingface_hub import snapshot_download

            model_path = snapshot_download(
                model_path,
                allow_patterns=["audio_tokenizer/*"],
            )
        audio_tokenizer_path = os.path.join(model_path, "audio_tokenizer")
        dev = torch.device(f"cuda:{torch.cuda.current_device()}")
        self.audio_tokenizer = self._load_mimo_audio_tokenizer(
            audio_tokenizer_path, dev
        )

    @staticmethod
    def _load_mimo_audio_tokenizer(
        path: str, device: torch.device

View on GitHub (pinned to 0132848349)

Solutions

  1. Check the supported projection_layers values in mimo_audio.py build_audio_encoder and set config.projection_layers accordingly
  2. Re-download the audio tokenizer assets matching your sglang version (snapshot_download of the correct repo)
  3. Pin sglang and the MiMo checkpoint to a compatible release pair

Example fix

// before
"projection_layers": "v3"
// after
"projection_layers": 2  // a value handled by build_audio_encoder
Defensive patterns

Strategy: validation

Validate before calling

from sglang.srt.models.mimo_audio import build_audio_encoder  # inspect supported values
# before launch, confirm config value is one handled in build_audio_encoder:
# print the branch conditions or check release notes for your sglang version

Prevention

When it happens

Trigger: config.projection_layers is an unrecognized value (e.g. an int or string not in the handled branches) when the audio model is constructed during engine init. Typically triggered by a mismatched audio config.json for the MiMo checkpoint.

Common situations: Mixing audio tokenizer weights/config from a different MiMo release; upgrading sglang against an older audio config; hand-edited projection config.

Related errors


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