Comfy-Org/ComfyUI · error · ValueError

Unknown norm_type: {norm_type}

Error message

Unknown norm_type: {norm_type}

What it means

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.

Source

Thrown at comfy/ldm/hydit/models.py:56

                 mlp_ratio=4.0,
                 text_states_dim=1024,
                 qk_norm=False,
                 norm_type="layer",
                 skip=False,
                 attn_precision=None,
                 dtype=None,
                 device=None,
                 operations=None,
                 ):
        super().__init__()
        use_ele_affine = True

        if norm_type == "layer":
            norm_layer = operations.LayerNorm
        elif norm_type == "rms":
            norm_layer = operations.RMSNorm
        else:
            raise ValueError(f"Unknown norm_type: {norm_type}")

        # ========================= Self-Attention =========================
        self.norm1 = norm_layer(hidden_size, elementwise_affine=use_ele_affine, eps=1e-6, dtype=dtype, device=device)
        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)

        # ========================= FFN =========================
        self.norm2 = norm_layer(hidden_size, elementwise_affine=use_ele_affine, eps=1e-6, dtype=dtype, device=device)
        mlp_hidden_dim = int(hidden_size * mlp_ratio)
        approx_gelu = lambda: nn.GELU(approximate="tanh")
        self.mlp = Mlp(in_features=hidden_size, hidden_features=mlp_hidden_dim, act_layer=approx_gelu, drop=0, dtype=dtype, device=device, operations=operations)

        # ========================= Add =========================
        # Simply use add like SDXL.
        self.default_modulation = nn.Sequential(
            nn.SiLU(),
            operations.Linear(c_emb_size, hidden_size, bias=True, dtype=dtype, device=device)
        )

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Map your config's value to the accepted ones: 'layer' for LayerNorm checkpoints, 'rms' for RMSNorm (v1.1 style)
  2. Inspect the checkpoint's state dict: blocks with weight+bias norm params are LayerNorm, weight-only are RMSNorm
  3. Fix the string in the config before constructing blocks

Example fix

# before
norm_type = "layernorm"  # ValueError
# after
norm_type = "layer"
Defensive patterns

Strategy: validation

Validate before calling

assert norm_type in {"layer", "rms"}, norm_type

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14). Data as JSON: /api/errors/a2e51aa313bbaa30. Report an issue: GitHub.