Comfy-Org/ComfyUI · error · ValueError
Unknown pos_emb_cls {self.pos_emb_cls}
Error message
Unknown pos_emb_cls {self.pos_emb_cls} What it means
Identical guard to the Cosmos image-to-video model, but in the Predict2 model: build_pos_embed() only accepts pos_emb_cls == 'rope3d' (VideoRopePosition3DEmb). Any other config value raises ValueError at model construction.
Source
Thrown at comfy/ldm/cosmos/predict2.py:743
)
self.final_layer = FinalLayer(
hidden_size=self.model_channels,
spatial_patch_size=self.patch_spatial,
temporal_patch_size=self.patch_temporal,
out_channels=self.out_channels,
use_adaln_lora=self.use_adaln_lora,
adaln_lora_dim=self.adaln_lora_dim,
device=device, dtype=dtype, operations=operations,
)
self.t_embedding_norm = operations.RMSNorm(model_channels, eps=1e-6, device=device, dtype=dtype)
def build_pos_embed(self, device=None, dtype=None) -> None:
if self.pos_emb_cls == "rope3d":
cls_type = VideoRopePosition3DEmb
else:
raise ValueError(f"Unknown pos_emb_cls {self.pos_emb_cls}")
logging.debug(f"Building positional embedding with {self.pos_emb_cls} class, impl {cls_type}")
kwargs = dict(
model_channels=self.model_channels,
len_h=self.max_img_h // self.patch_spatial,
len_w=self.max_img_w // self.patch_spatial,
len_t=self.max_frames // self.patch_temporal,
max_fps=self.max_fps,
min_fps=self.min_fps,
is_learnable=self.pos_emb_learnable,
interpolation=self.pos_emb_interpolation,
head_dim=self.model_channels // self.num_heads,
h_extrapolation_ratio=self.rope_h_extrapolation_ratio,
w_extrapolation_ratio=self.rope_w_extrapolation_ratio,
t_extrapolation_ratio=self.rope_t_extrapolation_ratio,
enable_fps_modulation=self.rope_enable_fps_modulation,
device=device,
)View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Set pos_emb_cls to "rope3d" in the Predict2 model config.
- Confirm the loader copies pos_emb_cls from the checkpoint config instead of relying on a default that may be missing.
- If the checkpoint uses a genuinely different embedding, the variant is unsupported; use a compatible Predict2 checkpoint.
Example fix
# before
model = Predict2Model(cfg_with_wrong_or_missing_pos_emb_cls, ...)
# after
cfg = {**raw_cfg, "pos_emb_cls": "rope3d"}
model = Predict2Model(cfg, ...) Defensive patterns
Strategy: validation
Validate before calling
assert cfg.get("pos_emb_cls") == "rope3d", f"Predict2 requires pos_emb_cls='rope3d', got {cfg.get('pos_emb_cls')!r}" Prevention
- Validate Predict2 config enums before construction.
- Do not mix config dicts between Cosmos 1.0 and Predict2 variants.
When it happens
Trigger: Instantiating the Predict2 transformer with a config where pos_emb_cls is absent or not 'rope3d' — e.g. loading a Cosmos-Predict2 checkpoint variant whose config key uses a different name or spelling.
Common situations: Mixing config schemas between Cosmos 1.0 and Predict2 checkpoints; custom loaders that merge config dicts and drop/overwrite pos_emb_cls.
Related errors
- Unknown pos_emb_cls {self.pos_emb_cls}
- Normalization {name} not found
- Normalization mode {self.qkv_norm_mode} not found, only supp
- Unknown patch method: {self.patch_method}
- Unknown interpolation method {self.interpolation}
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/f6438a66a996636c.
Report an issue: GitHub.