{"record":{"id":"8eff3d22dfb8a9fa","repo":"sgl-project/sglang","slug":"load-intern-s2-mobius-through-its-conditional-gene","errorCode":null,"errorMessage":"Load Intern-S2-Mobius through its conditional-generation wrapper so vision, language, lm_head, and strict coverage are handled together","messagePattern":"Load Intern-S2-Mobius through its conditional-generation wrapper so vision, language, lm_head, and strict coverage are handled together","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/models/interns2_mobius.py","lineNumber":821,"sourceCode":"            ):\n                start = self.hidden_size * layer_idx\n                hidden_states.add_(\n                    input_deepstack_embeds[:, start : start + self.hidden_size]\n                )\n\n        if hidden_states.shape[0] != 0:\n            if residual is None:\n                hidden_states = self.norm(hidden_states)\n            else:\n                hidden_states, _ = self.norm(hidden_states, residual)\n        return (\n            hidden_states\n            if not aux_hidden_states\n            else (hidden_states, aux_hidden_states)\n        )\n\n    def load_weights(self, weights: Iterable[tuple[str, torch.Tensor]]):\n        raise ValueError(\n            \"Load Intern-S2-Mobius through its conditional-generation wrapper \"\n            \"so vision, language, lm_head, and strict coverage are handled together\"\n        )\n\n\nclass InternS2MobiusForConditionalGeneration(Qwen3_5ForConditionalGeneration):\n    packed_modules_mapping = InternS2MobiusForCausalLM.packed_modules_mapping\n    supported_lora_modules = InternS2MobiusForCausalLM.supported_lora_modules\n\n    def __init__(\n        self,\n        config: InternS2MobiusConfig,\n        quant_config: QuantizationConfig | None = None,\n        prefix: str = \"\",\n        language_model_cls=InternS2MobiusForCausalLM,\n    ) -> None:\n        ignored_layers = getattr(quant_config, \"ignored_layers\", None)\n        if (","sourceCodeStart":803,"sourceCodeEnd":839,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/models/interns2_mobius.py#L803-L839","documentation":"The baseline model intentionally disables direct weight loading so users cannot bypass the conditional-generation wrapper, which coordinates vision tower, language model, lm_head, and strict checkpoint coverage checks.","triggerScenarios":"Calling model.load_weights(weights) on InternS2MobiusModel directly instead of on InternS2MobiusForConditionalGeneration.","commonSituations":"Custom loaders, weight-conversion scripts, or tooling that grabs the inner text model and loads weights onto it.","solutions":["Load weights via InternS2MobiusForConditionalGeneration.load_weights","If you need custom loading, subclass the wrapper rather than the baseline","Pass over the weights untouched to the standard model loader"],"exampleFix":"# before\nbase_model.load_weights(iter(weights))\n\n# after\nInternS2MobiusForConditionalGeneration.load_weights(model, iter(weights))","handlingStrategy":"type-guard","validationCode":"from sglang.srt.models.interns2_mobius import InternS2MobiusForConditionalGeneration\nassert isinstance(model, InternS2MobiusForConditionalGeneration)","typeGuard":"def supports_direct_load(model) -> bool:\n    return not type(model).__name__ == \"InternS2MobiusModel\"","tryCatchPattern":null,"preventionTips":["Always load weights through the ConditionalGeneration wrapper","Guard custom loaders with an isinstance check"],"tags":["weight-loading","api-misuse"],"backgroundTag":"guarded-api-misuse","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}