{"record":{"id":"f1f8ac4e4745d572","repo":"Comfy-Org/ComfyUI","slug":"normalization-name-not-found","errorCode":null,"errorMessage":"Normalization {name} not found","messagePattern":"Normalization (.+?) not found","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"critical","filePath":"comfy/ldm/cosmos/blocks.py","lineNumber":35,"sourceCode":"from typing import Optional\nimport logging\n\nimport numpy as np\nimport torch\nfrom einops import rearrange, repeat\nfrom einops.layers.torch import Rearrange\nfrom torch import nn\n\nfrom comfy.ldm.modules.attention import optimized_attention\n\n\ndef get_normalization(name: str, channels: int, weight_args={}, operations=None):\n    if name == \"I\":\n        return nn.Identity()\n    elif name == \"R\":\n        return operations.RMSNorm(channels, elementwise_affine=True, eps=1e-6, **weight_args)\n    else:\n        raise ValueError(f\"Normalization {name} not found\")\n\n\nclass BaseAttentionOp(nn.Module):\n    def __init__(self):\n        super().__init__()\n\n\nclass Attention(nn.Module):\n    \"\"\"\n    Generalized attention impl.\n\n    Allowing for both self-attention and cross-attention configurations depending on whether a `context_dim` is provided.\n    If `context_dim` is None, self-attention is assumed.\n\n    Parameters:\n        query_dim (int): Dimension of each query vector.\n        context_dim (int, optional): Dimension of each context vector. If None, self-attention is assumed.\n        heads (int, optional): Number of attention heads. Defaults to 8.","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy/ldm/cosmos/blocks.py#L17-L53","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use only 'I' or 'R' in qkv_norm tuples for Cosmos models in this ComfyUI version","Map unsupported codes to the closest supported one ('L' -> 'R' or 'I') if exact behavior is not critical for your checkpoint","Update ComfyUI if a newer version adds the normalization type your checkpoint needs"],"exampleFix":"# before\nattn_cfg = {\"qkv_norm\": (\"L\", \"R\", \"R\")}  # 'L' unsupported\n\n# after\nattn_cfg = {\"qkv_norm\": (\"R\", \"R\", \"R\")}","handlingStrategy":"validation","validationCode":"VALID_NORMS = {\"I\", \"R\"}\nassert all(n in VALID_NORMS for n in qkv_norm), f\"qkv_norm {qkv_norm} contains unsupported code\"","typeGuard":"def is_valid_qkv_norm(qkv_norm) -> bool:\n    return all(n in {\"I\", \"R\"} for n in qkv_norm)","tryCatchPattern":null,"preventionTips":["Restrict Cosmos configs to RMSNorm/Identity normalization codes","When porting upstream configs, map unsupported norm codes before model init"],"tags":["cosmos","normalization","config","attention"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}