Comfy-Org/ComfyUI · error · ValueError
SeedVR2 conditioning shape must match latent batch/temporal/
Error message
SeedVR2 conditioning shape must match latent batch/temporal/spatial dimensions; got latent {tuple(x.shape)} and conditioning {tuple(conditions.shape)}. What it means
After channel/ndim checks, SeedVR2 requires the conditioning latent to match the noisy latent in batch, temporal, and spatial dims (conditions.shape[0] == b and conditions.shape[2:] == (t, h, w)) because they are concatenated token-wise after flattening. Any mismatch — different resolution, frame count, or batch — aborts with both shapes printed.
Source
Thrown at comfy/ldm/seedvr/model.py:1292
def forward(
self,
x,
timestep,
context, # l c
disable_cache: bool = False,
**kwargs
):
transformer_options = kwargs.get("transformer_options", {})
patches_replace = transformer_options.get("patches_replace", {})
blocks_replace = patches_replace.get("dit", {})
conditions = kwargs.get("condition")
if conditions is None:
raise ValueError("SeedVR2 requires conditioning latents from the SeedVR2Conditioning node.")
x = self._check_seedvr2_video_latent(x, SEEDVR2_LATENT_CHANNELS, "latent")
conditions = self._check_seedvr2_video_latent(conditions, SEEDVR2_LATENT_CHANNELS + 1, "conditioning")
b, _, t, h, w = x.shape
if conditions.shape[0] != b or conditions.shape[2:] != (t, h, w):
raise ValueError(
f"SeedVR2 conditioning shape must match latent batch/temporal/spatial dimensions; got latent {tuple(x.shape)} and conditioning {tuple(conditions.shape)}."
)
x = x.movedim(1, -1)
conditions = conditions.movedim(1, -1)
cache = Cache(disable=disable_cache)
txt, txt_shape = self._resolve_text_conditioning(context, transformer_options.get("cond_or_uncond"))
vid, vid_shape = flatten(x)
cond_latent, _ = flatten(conditions)
vid = torch.cat([vid, cond_latent], dim=-1)
txt = self.txt_in(txt)
vid_shape_before_patchify = vid_shape
vid, vid_shape = self.vid_in(vid, vid_shape, cache=cache)
View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Make the LQ conditioning video exactly the target latent's T/H/W (match resolution and frame count before VAE encode).
- Ensure batch dims agree — replicate the conditioning if you batch the latent.
- Apply the same temporal trimming (T % t == 1) to both latent and conditioning.
- Use the SeedVR2Conditioning node, which validates alignment, instead of manual concatenation.
Example fix
# before cond = lq_latent # encoded at 720x1280, latent is 724x1284 # after lq = torch.nn.functional.interpolate(lq_video, size=(T, H_out, W_out), mode='trilinear') cond = seedvr_vae.encode(lq) # same T,H,W as target latent
Defensive patterns
Strategy: validation
Validate before calling
def check_conditioning_alignment(x, cond):
b, _, t, h, w = x.shape
if cond.shape[0] != b or cond.shape[2:] != (t, h, w):
raise ValueError(
f"conditioning {tuple(cond.shape)} must match latent (b={b}, t={t}, h={h}, w={w})"
)
return cond Type guard
def conditioning_aligned(x, cond) -> bool:
return cond.dim() == 5 and cond.shape[0] == x.shape[0] and cond.shape[2:] == x.shape[2:] Prevention
- Encode LQ and target at identical resolution and frame counts.
- Apply identical temporal trimming to latent and conditioning.
- Replicate the conditioning tensor when batching the latent.
When it happens
Trigger: Encoding the LQ/reference video at a different resolution or frame count than the generation target; batch size of the conditioning differing from the latent batch; cropping/trimming one input but not the other.
Common situations: Upscaling workflows where the LQ video was resized to the target resolution with slightly different rounding (off-by-one dims); frame-count changes after trimming to satisfy T % t == 1 on only one side; batch-2 sampling with a batch-1 conditioning latent.
Related errors
- PixDiT_T2I requires context (text embeddings) of shape [B, L
- SeedVR2 patch input temporal size must satisfy T % {t} == 1,
- SeedVR2 expected an even text-conditioning batch, got shape
- SeedVR2 expected {name} to be 5-D native latent, got shape {
- SeedVR2 expected {name} channels to be {channels}, got shape
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/565ef5881fbc859f.
Report an issue: GitHub.