Comfy-Org/ComfyUI · error · ValueError

Invalid normalization type: {normtype}

Error message

Invalid normalization type: {normtype}

What it means

Raised by the Normalize factory in the causal audio autoencoder when normtype is neither 'group' nor 'pixel'. The factory only constructs GroupNorm (for 'group') or PixelNorm (for 'pixel'); any other string falls through to this ValueError.

Source

Thrown at comfy/ldm/lightricks/vae/causal_audio_autoencoder.py:98

    NONE = "none"


class CausalityAxis(StringConvertibleEnum):
    """Enum for specifying the causality axis in causal convolutions."""

    NONE = None
    WIDTH = "width"
    HEIGHT = "height"
    WIDTH_COMPATIBILITY = "width-compatibility"


def Normalize(in_channels, *, num_groups=32, normtype="group"):
    if normtype == "group":
        return torch.nn.GroupNorm(num_groups=num_groups, num_channels=in_channels, eps=1e-6, affine=True)
    elif normtype == "pixel":
        return PixelNorm(dim=1, eps=1e-6)
    else:
        raise ValueError(f"Invalid normalization type: {normtype}")


class CausalConv2d(nn.Module):
    """
    A causal 2D convolution.

    This layer ensures that the output at time `t` only depends on inputs
    at time `t` and earlier. It achieves this by applying asymmetric padding
    to the time dimension (width) before the convolution.
    """

    def __init__(
        self,
        in_channels,
        out_channels,
        kernel_size,
        stride=1,
        dilation=1,

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Use 'group' (default) or 'pixel' as the normtype value
  2. Check the norm_type value in the model config dict being passed to Encoder/Decoder
  3. If a new norm type is genuinely needed, extend the Normalize factory with an explicit branch

Example fix

# before
Normalize(in_channels, normtype="batch")

# after
Normalize(in_channels, normtype="group")
Defensive patterns

Strategy: validation

Validate before calling

if norm_type not in ("group", "pixel"):
    raise ValueError(f"norm_type must be 'group' or 'pixel', got {norm_type!r}")

Type guard

def is_valid_norm_type(t) -> bool:
    return t in ("group", "pixel")

Prevention

When it happens

Trigger: Calling Normalize(in_channels, normtype="layer"), "batch", "instance", or a typo like "gruop"; also triggered indirectly by constructing ResnetBlock(norm_type=...) or Encoder/Decoder with an unrecognized norm_type string.

Common situations: Porting configs that use layer/batch norm variants from other VAE implementations; typos in checkpoint config JSON (norm_type field); assuming a broader norm registry exists.

Related errors


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