Comfy-Org/ComfyUI · critical · ValueError

Normalization {name} not found

Error message

Normalization {name} not found

What it means

get_normalization in the Cosmos tokenizer/prediction blocks maps a one-letter code to a normalization module: 'I' -> nn.Identity, 'R' -> operations.RMSNorm (eps 1e-6, elementwise affine). Any other letter raises ValueError. The code comes from the qkv_norm tuple on Cosmos attention blocks (e.g. ('R','R','R') or ('I','R','R')) parsed from the model config.

Source

Thrown at comfy/ldm/cosmos/blocks.py:35

from typing import Optional
import logging

import numpy as np
import torch
from einops import rearrange, repeat
from einops.layers.torch import Rearrange
from torch import nn

from comfy.ldm.modules.attention import optimized_attention


def get_normalization(name: str, channels: int, weight_args={}, operations=None):
    if name == "I":
        return nn.Identity()
    elif name == "R":
        return operations.RMSNorm(channels, elementwise_affine=True, eps=1e-6, **weight_args)
    else:
        raise ValueError(f"Normalization {name} not found")


class BaseAttentionOp(nn.Module):
    def __init__(self):
        super().__init__()


class Attention(nn.Module):
    """
    Generalized attention impl.

    Allowing for both self-attention and cross-attention configurations depending on whether a `context_dim` is provided.
    If `context_dim` is None, self-attention is assumed.

    Parameters:
        query_dim (int): Dimension of each query vector.
        context_dim (int, optional): Dimension of each context vector. If None, self-attention is assumed.
        heads (int, optional): Number of attention heads. Defaults to 8.

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Use only 'I' or 'R' in qkv_norm tuples for Cosmos models in this ComfyUI version
  2. Map unsupported codes to the closest supported one ('L' -> 'R' or 'I') if exact behavior is not critical for your checkpoint
  3. Update ComfyUI if a newer version adds the normalization type your checkpoint needs

Example fix

# before
attn_cfg = {"qkv_norm": ("L", "R", "R")}  # 'L' unsupported

# after
attn_cfg = {"qkv_norm": ("R", "R", "R")}
Defensive patterns

Strategy: validation

Validate before calling

VALID_NORMS = {"I", "R"}
assert all(n in VALID_NORMS for n in qkv_norm), f"qkv_norm {qkv_norm} contains unsupported code"

Type guard

def is_valid_qkv_norm(qkv_norm) -> bool:
    return all(n in {"I", "R"} for n in qkv_norm)

Prevention

When it happens

Trigger: Building Cosmos attention with qkv_norm strings containing unsupported letters like 'L' (LayerNorm), 'B' (BatchNorm), or lowercase 'r'; happens when a custom Cosmos config or a ported upstream config uses a normalization code this ComfyUI version does not implement.

Common situations: Loading Cosmos-Predict/Transfer variants with normalization configs beyond RMSNorm/Identity; hand-porting configs from NVIDIA's cosmos repo where more norm types exist; typos in custom configs.

Related errors


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