{"record":{"id":"a2e51aa313bbaa30","repo":"Comfy-Org/ComfyUI","slug":"unknown-norm-type-norm-type","errorCode":null,"errorMessage":"Unknown norm_type: {norm_type}","messagePattern":"Unknown norm_type: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy/ldm/hydit/models.py","lineNumber":56,"sourceCode":"                 mlp_ratio=4.0,\n                 text_states_dim=1024,\n                 qk_norm=False,\n                 norm_type=\"layer\",\n                 skip=False,\n                 attn_precision=None,\n                 dtype=None,\n                 device=None,\n                 operations=None,\n                 ):\n        super().__init__()\n        use_ele_affine = True\n\n        if norm_type == \"layer\":\n            norm_layer = operations.LayerNorm\n        elif norm_type == \"rms\":\n            norm_layer = operations.RMSNorm\n        else:\n            raise ValueError(f\"Unknown norm_type: {norm_type}\")\n\n        # ========================= Self-Attention =========================\n        self.norm1 = norm_layer(hidden_size, elementwise_affine=use_ele_affine, eps=1e-6, dtype=dtype, device=device)\n        self.attn1 = Attention(hidden_size, num_heads=num_heads, qkv_bias=True, qk_norm=qk_norm, attn_precision=attn_precision, dtype=dtype, device=device, operations=operations)\n\n        # ========================= FFN =========================\n        self.norm2 = norm_layer(hidden_size, elementwise_affine=use_ele_affine, eps=1e-6, dtype=dtype, device=device)\n        mlp_hidden_dim = int(hidden_size * mlp_ratio)\n        approx_gelu = lambda: nn.GELU(approximate=\"tanh\")\n        self.mlp = Mlp(in_features=hidden_size, hidden_features=mlp_hidden_dim, act_layer=approx_gelu, drop=0, dtype=dtype, device=device, operations=operations)\n\n        # ========================= Add =========================\n        # Simply use add like SDXL.\n        self.default_modulation = nn.Sequential(\n            nn.SiLU(),\n            operations.Linear(c_emb_size, hidden_size, bias=True, dtype=dtype, device=device)\n        )\n","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy/ldm/hydit/models.py#L38-L74","documentation":"Thrown by the HunYuanDiT basic block constructor when norm_type is neither \"layer\" nor \"rms\". The block picks operations.LayerNorm vs operations.RMSNorm from this string; anything else means the config value was never a supported option.","triggerScenarios":"Building a HYDiT block with norm_type='ln', 'layernorm', 'group', or any string outside {layer, rms}; typically from a checkpoint config converted with a different naming convention.","commonSituations":"Porting configs from other repos (HunyuanDiT v1 vs v1.1 used different norms), typos, or new checkpoints whose config uses synonyms of the two accepted values.","solutions":["Map your config's value to the accepted ones: 'layer' for LayerNorm checkpoints, 'rms' for RMSNorm (v1.1 style)","Inspect the checkpoint's state dict: blocks with weight+bias norm params are LayerNorm, weight-only are RMSNorm","Fix the string in the config before constructing blocks"],"exampleFix":"# before\nnorm_type = \"layernorm\"  # ValueError\n# after\nnorm_type = \"layer\"","handlingStrategy":"validation","validationCode":"assert norm_type in {\"layer\", \"rms\"}, norm_type","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Normalize config synonyms ('layernorm'->'layer') at the loader boundary","Detect norm type from the state dict (weight-only => rms) when configs are unreliable"],"tags":["hydit","norm","config","init"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}