{"record":{"id":"f6438a66a996636c","repo":"Comfy-Org/ComfyUI","slug":"unknown-pos-emb-cls-self-pos-emb-cls-f6438a","errorCode":null,"errorMessage":"Unknown pos_emb_cls {self.pos_emb_cls}","messagePattern":"Unknown pos_emb_cls (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy/ldm/cosmos/predict2.py","lineNumber":743,"sourceCode":"        )\n\n        self.final_layer = FinalLayer(\n            hidden_size=self.model_channels,\n            spatial_patch_size=self.patch_spatial,\n            temporal_patch_size=self.patch_temporal,\n            out_channels=self.out_channels,\n            use_adaln_lora=self.use_adaln_lora,\n            adaln_lora_dim=self.adaln_lora_dim,\n            device=device, dtype=dtype, operations=operations,\n        )\n\n        self.t_embedding_norm = operations.RMSNorm(model_channels, eps=1e-6, device=device, dtype=dtype)\n\n    def build_pos_embed(self, device=None, dtype=None) -> None:\n        if self.pos_emb_cls == \"rope3d\":\n            cls_type = VideoRopePosition3DEmb\n        else:\n            raise ValueError(f\"Unknown pos_emb_cls {self.pos_emb_cls}\")\n\n        logging.debug(f\"Building positional embedding with {self.pos_emb_cls} class, impl {cls_type}\")\n        kwargs = dict(\n            model_channels=self.model_channels,\n            len_h=self.max_img_h // self.patch_spatial,\n            len_w=self.max_img_w // self.patch_spatial,\n            len_t=self.max_frames // self.patch_temporal,\n            max_fps=self.max_fps,\n            min_fps=self.min_fps,\n            is_learnable=self.pos_emb_learnable,\n            interpolation=self.pos_emb_interpolation,\n            head_dim=self.model_channels // self.num_heads,\n            h_extrapolation_ratio=self.rope_h_extrapolation_ratio,\n            w_extrapolation_ratio=self.rope_w_extrapolation_ratio,\n            t_extrapolation_ratio=self.rope_t_extrapolation_ratio,\n            enable_fps_modulation=self.rope_enable_fps_modulation,\n            device=device,\n        )","sourceCodeStart":725,"sourceCodeEnd":761,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy/ldm/cosmos/predict2.py#L725-L761","documentation":"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.","triggerScenarios":"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.","commonSituations":"Mixing config schemas between Cosmos 1.0 and Predict2 checkpoints; custom loaders that merge config dicts and drop/overwrite pos_emb_cls.","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."],"exampleFix":"# before\nmodel = Predict2Model(cfg_with_wrong_or_missing_pos_emb_cls, ...)\n\n# after\ncfg = {**raw_cfg, \"pos_emb_cls\": \"rope3d\"}\nmodel = Predict2Model(cfg, ...)","handlingStrategy":"validation","validationCode":"assert cfg.get(\"pos_emb_cls\") == \"rope3d\", f\"Predict2 requires pos_emb_cls='rope3d', got {cfg.get('pos_emb_cls')!r}\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate Predict2 config enums before construction.","Do not mix config dicts between Cosmos 1.0 and Predict2 variants."],"tags":["cosmos","predict2","config","model-loading"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}