{"record":{"id":"3e42fdb0f996649e","repo":"sgl-project/sglang","slug":"ffn-hidden-size-must-be-positive","errorCode":null,"errorMessage":"ffn_hidden_size must be positive.","messagePattern":"ffn_hidden_size must be positive\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"critical","filePath":"python/sglang/multimodal_gen/runtime/models/dits/minimax_h3.py","lineNumber":1813,"sourceCode":"            and not envs.SGLANG_CACHE_DIT_ENABLED\n            and not hasattr(self, \"_sglang_cache_dit_adapter\")\n            and not is_layerwise_offloaded_module(self)\n            and all(type(block) is MiniMaxH3DiTBlock for block in self.blocks)\n        )\n\n    def _validate_tp_config(\n        self, *, arch: MiniMaxH3DiTArchConfig, tp_size: int\n    ) -> None:\n        if tp_size <= 0:\n            raise ValueError(\"TP size must be positive.\")\n        if arch.num_attention_heads <= 0:\n            raise ValueError(\"num_attention_heads must be positive.\")\n        if arch.hidden_size <= 0:\n            raise ValueError(\"hidden_size must be positive.\")\n        if arch.attention_head_dim <= 0:\n            raise ValueError(\"attention_head_dim must be positive.\")\n        if arch.ffn_hidden_size <= 0:\n            raise ValueError(\"ffn_hidden_size must be positive.\")\n        for name, value in (\n            (\"num_attention_heads\", arch.num_attention_heads),\n            (\"hidden_size\", arch.hidden_size),\n            (\"ffn_hidden_size\", arch.ffn_hidden_size),\n            (\"time_embed_hidden_size\", arch.time_embed_hidden_size),\n            (\"adaln_out_features\", arch.adaln_out_features),\n            (\"final_adaln_out_features\", arch.final_adaln_out_features),\n            (\"video_patch_output_dim\", arch.latents_dim * math.prod(arch.patch_size)),\n            (\"audio_patch_output_dim\", arch.audio_latents_dim),\n        ):\n            if value % tp_size:\n                raise ValueError(\n                    f\"MiniMax H3 {name}={value} must be divisible by \"\n                    f\"TP size {tp_size}.\"\n                )\n\n    @staticmethod\n    def _validate_sequence_parallel_config(","sourceCodeStart":1795,"sourceCodeEnd":1831,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/models/dits/minimax_h3.py#L1795-L1831","documentation":"The FFN hidden dimension must be positive because it is TP-sharded (each rank holds ffn_hidden_size/tp_size columns/rows). The constructor rejects non-positive values before allocating MLP weights.","triggerScenarios":"Building the model with an arch config where ffn_hidden_size is 0, negative, or missing (defaulted to 0), e.g. from a partially converted checkpoint.","commonSituations":"Config field renamed between versions (intermediate_size vs ffn_hidden_size); hand-written configs omitting the MLP width; YAML/JSON with a null value coerced to 0.","solutions":["Set ffn_hidden_size to the checkpoint's MLP width (commonly a multiple like 4x hidden_size)","Check the config deserialization: confirm the JSON key matches the dataclass field","Add a pre-flight assert on all positive-size fields before construction"],"exampleFix":"# before\narch = MiniMaxH3DiTArchConfig(..., ffn_hidden_size=0)\n# after\narch = MiniMaxH3DiTArchConfig(..., ffn_hidden_size=4 * hidden_size)","handlingStrategy":"validation","validationCode":"assert arch.ffn_hidden_size > 0","typeGuard":"def ffn_ok(arch) -> bool:\n    return getattr(arch, \"ffn_hidden_size\", 0) > 0","tryCatchPattern":null,"preventionTips":["Keep a required-fields checklist for arch configs","Unit-test config parsing with the real checkpoint JSON"],"tags":["config","model-architecture","validation","minimax-h3"],"backgroundTag":"invalid-model-config","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}