{"record":{"id":"3b2d85c401c1d5ae","repo":"sgl-project/sglang","slug":"minimax-h3-qwen3-vl-language-layer-configuration-i","errorCode":null,"errorMessage":"MiniMax H3 Qwen3-VL language-layer configuration is inconsistent: {selected_layer} vs {int(arch.num_hidden_layers)}","messagePattern":"MiniMax H3 Qwen3-VL language-layer configuration is inconsistent: (.+?) vs (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"critical","filePath":"python/sglang/multimodal_gen/runtime/models/encoders/minimax_h3_qwen3vl.py","lineNumber":270,"sourceCode":"                f\"encoder's {int(arch.checkpoint_num_hidden_layers)} layers\"\n            )\n        arch.conditioning_projection_path = projection_path\n        arch.num_hidden_layers = tap\n        arch.text_config.num_hidden_layers = tap\n\n    def should_materialize_checkpoint_weight(self, name: str) -> bool:\n        name = _map_checkpoint_name(name)\n        return (\n            \"rotary_emb.inv_freq\" not in name\n            and not _is_unconsumed_checkpoint_weight(name, self.selected_lm_layer)\n        )\n\n    def __init__(self, config: MiniMaxH3Qwen3VLConfig) -> None:\n        super().__init__(config)\n        arch = config.arch_config\n        selected_layer = int(arch.text_config.num_hidden_layers)\n        if selected_layer <= 0 or int(arch.num_hidden_layers) != selected_layer:\n            raise ValueError(\n                \"MiniMax H3 Qwen3-VL language-layer configuration is \"\n                f\"inconsistent: {selected_layer} vs {int(arch.num_hidden_layers)}\"\n            )\n        self.model = Qwen3VLModel(\n            arch,\n            quant_config=config.quant_config,\n            use_tensor_parallel=True,\n            prefix=\"model\",\n        )\n        # H3 and ClipProj consume an unnormalized intermediate residual stream.\n        self.model.language_model.norm = nn.Identity()\n        self.image_token_id = int(arch.image_token_id)\n        self.video_token_id = int(arch.video_token_id)\n        self.selected_lm_layer = selected_layer\n        self.hidden_dim = MINIMAX_H3_QWEN3VL_HIDDEN_DIM\n        self.conditioning_projection = (\n            MiniMaxH3ConditioningProjection(arch.conditioning_projection_path)\n            if arch.conditioning_projection_path is not None","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/models/encoders/minimax_h3_qwen3vl.py#L252-L288","documentation":"The model requires arch.num_hidden_layers and arch.text_config.num_hidden_layers to agree (and be positive) after the tap-based truncation. Disagreement means the config was mutated inconsistently between the top-level and text config.","triggerScenarios":"Constructing MiniMaxH3Qwen3VLModel with arch_config where num_hidden_layers != text_config.num_hidden_layers or text_config.num_hidden_layers <= 0.","commonSituations":"Manually editing config to limit layers (e.g. layer offloading / truncation experiments) and updating only one of the two fields; a config-loading bug that sets them differently.","solutions":["Set both arch_config.num_hidden_layers and arch_config.text_config.num_hidden_layers to the same positive value","If truncating layers via the conditioning-projection tap path, rely on configure_component_paths which sets both consistently"],"exampleFix":"# before\narch.num_hidden_layers = 12\narch.text_config.num_hidden_layers = 28\nmodel = MiniMaxH3Qwen3VLModel(config)\n# after\narch.num_hidden_layers = 12\narch.text_config.num_hidden_layers = 12\nmodel = MiniMaxH3Qwen3VLModel(config)","handlingStrategy":"validation","validationCode":"assert 0 < arch.text_config.num_hidden_layers == arch.num_hidden_layers","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Update both num_hidden_layers fields together when truncating layers","Prefer the library's tap-based truncation API over manual config edits"],"tags":["minimax-h3","config","layer-count","inconsistent-config"],"backgroundTag":"inconsistent-model-config","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}