Comfy-Org/ComfyUI · error · ValueError

Unknown interpolation method {self.interpolation}

Error message

Unknown interpolation method {self.interpolation}

What it means

VideoRopePosition3DEmb.build_emb() supports only the 'crop' interpolation method for slicing precomputed rope tables to the requested (T,H,W). Any other interpolation string raises ValueError. The method string comes from the model config key pos_emb_interpolation.

Source

Thrown at comfy/ldm/cosmos/position_embedding.py:205

        self.pos_emb_h = nn.Parameter(torch.empty(len_h, model_channels, device=device, dtype=dtype))
        self.pos_emb_w = nn.Parameter(torch.empty(len_w, model_channels, device=device, dtype=dtype))
        self.pos_emb_t = nn.Parameter(torch.empty(len_t, model_channels, device=device, dtype=dtype))

    def generate_embeddings(self, B_T_H_W_C: torch.Size, fps=Optional[torch.Tensor], device=None, dtype=None) -> torch.Tensor:
        B, T, H, W, _ = B_T_H_W_C
        if self.interpolation == "crop":
            emb_h_H = self.pos_emb_h[:H].to(device=device, dtype=dtype)
            emb_w_W = self.pos_emb_w[:W].to(device=device, dtype=dtype)
            emb_t_T = self.pos_emb_t[:T].to(device=device, dtype=dtype)
            emb = (
                repeat(emb_t_T, "t d-> b t h w d", b=B, h=H, w=W)
                + repeat(emb_h_H, "h d-> b t h w d", b=B, t=T, w=W)
                + repeat(emb_w_W, "w d-> b t h w d", b=B, t=T, h=H)
            )
            assert list(emb.shape)[:4] == [B, T, H, W], f"bad shape: {list(emb.shape)[:4]} != {B, T, H, W}"
        else:
            raise ValueError(f"Unknown interpolation method {self.interpolation}")

        return normalize(emb, dim=-1, eps=1e-6)

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Set pos_emb_interpolation to "crop" in the model config.
  2. If you need extrapolation behavior, raise max_img_h/max_img_w/max_frames in the config so the 'crop' slice covers your resolution instead of changing the method string.
  3. Verify the config remapping layer in your loader normalizes pos_emb_interpolation.

Example fix

# before
cfg["pos_emb_interpolation"] = "interp"

# after
cfg["pos_emb_interpolation"] = "crop"
Defensive patterns

Strategy: validation

Validate before calling

assert cfg.get("pos_emb_interpolation") == "crop", "only 'crop' interpolation is supported"

Prevention

When it happens

Trigger: Constructing the Cosmos/Predict2 rope embedding with pos_emb_interpolation set to anything other than 'crop' (e.g. 'interp', 'resize', 'padding'), typically when a checkpoint config is passed through unsanitized.

Common situations: Upstream NVIDIA Cosmos configs that name interpolation differently; hand-edited model configs; ports of predict2 variants that expect a resizable rope table.

Related errors


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