sgl-project/sglang · error · NotImplementedError

{config.text_config.architectures[0]} is not implemented.

Error message

{config.text_config.architectures[0]} is not implemented.

What it means

InternS1's language-model wrapper only instantiates InternLM2ForCausalLM or Qwen3ForCausalLM based on config.text_config.architectures[0]; any other architecture string hits NotImplementedError.

Source

Thrown at python/sglang/srt/models/interns1.py:75

        )

        logger.info(f"num_image_token: {self.num_image_token}")

        self.vision_model = InternVisionModel(config.vision_config)
        if config.text_config.architectures[0] == "Qwen2ForCausalLM":
            self.language_model = Qwen2ForCausalLM(
                config=config.text_config, quant_config=quant_config
            )
        elif config.text_config.architectures[0] == "Qwen3MoeForCausalLM":
            self.language_model = Qwen3MoeForCausalLM(
                config=config.text_config, quant_config=quant_config
            )
        elif config.text_config.architectures[0] == "Qwen3ForCausalLM":
            self.language_model = Qwen3ForCausalLM(
                config=config.text_config, quant_config=quant_config
            )
        else:
            raise NotImplementedError(
                f"{config.text_config.architectures[0]} is not implemented."
            )

        vit_hidden_size = config.vision_config.hidden_size
        llm_hidden_size = config.text_config.hidden_size

        self.mlp1 = nn.Sequential(
            nn.LayerNorm(vit_hidden_size * int(1 / self.downsample_ratio) ** 2),
            nn.Linear(
                vit_hidden_size * int(1 / self.downsample_ratio) ** 2, llm_hidden_size
            ),
            nn.GELU(),
            nn.Linear(llm_hidden_size, llm_hidden_size),
        )

    def pixel_shuffle(self, x, scale_factor=0.5):
        n, w, h, c = x.size()
        # N, W, H, C --> N, W, H * scale, C // scale

View on GitHub (pinned to 0132848349)

Solutions

  1. Check config.text_config.architectures and align it to a supported backbone
  2. Use the matching standalone model class if the text model is neither InternLM2 nor Qwen3

Example fix

# before
"text_config": {"architectures": ["LlamaForCausalLM"]}
# after
"text_config": {"architectures": ["InternLM2ForCausalLM"]}
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED = {'InternLM2ForCausalLM', 'Qwen3ForCausalLM'}
assert config.text_config.architectures[0] in SUPPORTED

Type guard

def is_supported_interns1_text_arch(config) -> bool:
    return config.text_config.architectures[0] in {'InternLM2ForCausalLM', 'Qwen3ForCausalLM'}

Prevention

When it happens

Trigger: Loading an InternS1 multimodal checkpoint whose text_config.architectures[0] is not 'InternLM2ForCausalLM' or 'Qwen3ForCausalLM'.

Common situations: Community finetune swapping in a different text backbone; config.json edited or generated with a renamed architecture string.

Related errors


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