Comfy-Org/ComfyUI · error · ValueError
Unsupported RIFE model: expected 5 blocks, found {len(channe
Error message
Unsupported RIFE model: expected 5 blocks, found {len(channels)} What it means
Raised by detect_rife_config() in comfy_extras/frame_interpolation_models/ifnet.py when probing a RIFE checkpoint's state dict: it reads the encoder channel count and then scans blocks.0..4.conv0.1.0.weight, requiring exactly 5 residual blocks with the expected key layout. Fewer than 5 matching keys means the checkpoint is a different RIFE architecture generation (RIFE v2/v4/v4.x variants have different block counts or key names) and this IFNet implementation cannot load it.
Source
Thrown at comfy_extras/frame_interpolation_models/ifnet.py:130
else:
fd, mask, feat = block(
torch.cat((warped_img0, warped_img1, self.warp(f0, flow[:, :2]), self.warp(f1, flow[:, 2:4]), timestep, mask, feat), 1),
flow, scale=self.scale_list[i])
flow = flow.add_(fd)
warped_img0 = self.warp(img0, flow[:, :2])
warped_img1 = self.warp(img1, flow[:, 2:4])
return torch.lerp(warped_img1, warped_img0, torch.sigmoid(mask))
def detect_rife_config(state_dict):
head_ch = state_dict["encode.cnn3.weight"].shape[1] # ConvTranspose2d: (in_ch, out_ch, kH, kW)
channels = []
for i in range(5):
key = f"blocks.{i}.conv0.1.0.weight"
if key in state_dict:
channels.append(state_dict[key].shape[0])
if len(channels) != 5:
raise ValueError(f"Unsupported RIFE model: expected 5 blocks, found {len(channels)}")
return head_ch, channels
View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Use a RIFE v4-family checkpoint known to work with ComfyUI's frame interpolation node (the officially referenced 4.x weights).
- Inspect the state dict keys (torch.load then list(sd.keys())) and confirm blocks.0-4.conv0.1.0.weight all exist; if prefixed with 'module.', strip the prefix before load.
- If the checkpoint is a different architecture version, convert it or obtain the matching version's weights rather than expecting this loader to handle it.
- Verify integrity of the download — truncated files can load partially with missing keys.
Example fix
# before
sd = torch.load('rife_v2.pth')
detect_rife_config(sd) # ValueError: expected 5 blocks, found 0
# after: use supported v4-family weights, and normalize prefixes if needed
sd = torch.load('rife46.pth')
sd = { k[len('module.'):] if k.startswith('module.') else k: v for k, v in sd.items() }
detect_rife_config(sd) Defensive patterns
Strategy: validation
Validate before calling
import torch
def is_supported_rife(sd) -> bool:
if 'encode.cnn3.weight' not in sd: return False
keys = [f'blocks.{i}.conv0.1.0.weight' for i in range(5)]
return all(k in sd for k in keys)
sd = torch.load(path, map_location='cpu')
assert is_supported_rife(sd), 'checkpoint is not a supported RIFE v4-family model' Type guard
def is_supported_rife(sd) -> bool:
if 'encode.cnn3.weight' not in sd: return False
return all(f'blocks.{i}.conv0.1.0.weight' in sd for i in range(5)) Try / catch
try:
head_ch, channels = detect_rife_config(sd)
except ValueError as e:
raise RuntimeError(f'Incompatible RIFE checkpoint ({path}): {e}') from e Prevention
- Download RIFE weights from the source the node documentation references.
- Strip 'module.' prefixes from DataParallel-saved checkpoints before loading.
- List state-dict keys and check for the blocks.0-4 pattern before wiring the file in.
When it happens
Trigger: Loading a RIFE .pth into the frame-interpolation node (comfy_extras/nodes_frame_interpolation.py calls detect_rife_config(sd) before constructing IFNet) where the checkpoint is an older/newer RIFE version whose block keys are absent or shaped differently — e.g. RIFE v2 checkpoints, community 'rife47' variants with renumbered blocks, or pruned/re-keyed state dicts.
Common situations: Downloading RIFE weights from community mirrors (flownet.pkl / .pth from HF) that are a different version than the supported 4.x family; renaming a trained/finetuned checkpoint; or using checkpoint-conversion tooling that strips 'module.' prefixes or renumbers blocks, breaking the key pattern the detector expects.
Related errors
- {}\n\nFile path: {}\n\nThe safetensors file is corrupt or in
- {}\n\nFile path: {}\n\nThe safetensors file is corrupt/incom
- Unrecognized frame interpolation model format
- The provided model does not have a heatmap_head. Please use
- INVALID_TAG_FILTER
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/4f7c536493a06500.
Report an issue: GitHub.