Comfy-Org/ComfyUI · critical · ValueError
Got {params.axes_dim} but expected positional dim {pe_dim}
Error message
Got {params.axes_dim} but expected positional dim {pe_dim} What it means
ChromaRadiance requires sum(axes_dim) == hidden_size // num_heads (pe_dim) for its rotational position embeddings, identical to the Chroma check. axes_dim distributes the per-head dimension across the positional axes (typically two spatial axes plus a time/extra axis in radiance models); an inconsistent sum means RoPE cannot be constructed over the per-head dim. The check runs right after the divisibility check in __init__.
Source
Thrown at comfy/ldm/chroma_radiance/model.py:65
"""
def __init__(self, image_model=None, final_layer=True, dtype=None, device=None, operations=None, **kwargs):
if operations is None:
raise RuntimeError("Attempt to create ChromaRadiance object without setting operations")
nn.Module.__init__(self)
self.dtype = dtype
params = ChromaRadianceParams(**kwargs)
self.params = params
self.patch_size = params.patch_size
self.in_channels = params.in_channels
self.out_channels = params.out_channels
if params.hidden_size % params.num_heads != 0:
raise ValueError(
f"Hidden size {params.hidden_size} must be divisible by num_heads {params.num_heads}"
)
pe_dim = params.hidden_size // params.num_heads
if sum(params.axes_dim) != pe_dim:
raise ValueError(f"Got {params.axes_dim} but expected positional dim {pe_dim}")
self.hidden_size = params.hidden_size
self.num_heads = params.num_heads
self.in_dim = params.in_dim
self.out_dim = params.out_dim
self.hidden_dim = params.hidden_dim
self.n_layers = params.n_layers
self.pe_embedder = EmbedND(dim=pe_dim, theta=params.theta, axes_dim=params.axes_dim)
self.img_in_patch = operations.Conv2d(
params.in_channels,
params.hidden_size,
kernel_size=params.patch_size,
stride=params.patch_size,
bias=True,
dtype=dtype,
device=device,
)
self.txt_in = operations.Linear(params.context_in_dim, self.hidden_size, dtype=dtype, device=device)
# set as nn identity for now, will overwrite it later.View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Set axes_dim entries so they sum to hidden_size // num_heads
- Derive the last axis as pe_dim minus the fixed spatial axes instead of hard-coding all entries
- Keep the checkpoint's original axes_dim; do not override it in transformer options
Example fix
# before # hidden_size=3000, num_heads=24 -> pe_dim=125 axes_dim = [16, 56, 56] # sum 128 != 125 # after axes_dim = [125 - 56 - 56, 56, 56] # [13, 56, 56], sums to 125
Defensive patterns
Strategy: validation
Validate before calling
pe_dim = config["hidden_size"] // config["num_heads"]
if sum(config["axes_dim"]) != pe_dim:
spatial = config["axes_dim"][1:]
config["axes_dim"] = [pe_dim - sum(spatial)] + spatial Prevention
- Do not override axes_dim in transformer options
- Keep axes_dim sums locked to pe_dim in any config-editing code
When it happens
Trigger: Constructing ChromaRadiance with an axes_dim list whose sum differs from hidden_size // num_heads, e.g. reusing Flux's [16, 56, 56] with a 125-dim head, or editing the spatial axis sizes for higher-resolution radiance output without rebalancing the total.
Common situations: Tuning axes_dim for custom resolutions/view counts in radiance generation; porting configs between Chroma and ChromaRadiance; hand-built configs for NeRF-style experiments.
Related errors
- Got {params.axes_dim} but expected positional dim {pe_dim}
- Hidden size {params.hidden_size} must be divisible by num_he
- Unsupported nerf_final_head_type {params.nerf_final_head_typ
- Unknown interpolation method {self.interpolation}
- Got {params.axes_dim} but expected positional dim {pe_dim}
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/5f0c558593badfe2.
Report an issue: GitHub.