invoke-ai/InvokeAI · error · ValueError
TI2V-5B requires width and height to be multiples of 32 (got
Error message
TI2V-5B requires width and height to be multiples of 32 (got {width}x{height}). Wan 2.2-VAE 16x spatial * transformer patch_size 2 = pixel dims must divide by 32. What it means
For the TI2V-5B Wan variant, _validate_spatial_dimensions requires width and height to be multiples of 32, because the Wan 2.2 VAE compresses spatially 16x and the transformer patch size is 2 (16*2=32). Non-divisible pixel dimensions would break latent/patch alignment, so the invocation refuses to run.
Source
Thrown at invokeai/app/invocations/wan_denoise.py:89
total_vram = torch.cuda.get_device_properties(device).total_memory
if total_vram <= WAN_MAX_RESIDENT_TRANSFORMER_BYTES:
return None
return total_vram - WAN_MAX_RESIDENT_TRANSFORMER_BYTES
def _resolve_variant(context: InvocationContext, transformer_field: WanTransformerField) -> WanVariantType:
"""Look up the Wan variant from the main model config that produced this transformer."""
config = context.models.get_config(transformer_field.transformer)
variant = getattr(config, "variant", None)
if not isinstance(variant, WanVariantType):
raise ValueError(f"Could not determine Wan variant from model {config.name!r}: variant is {variant!r}.")
return variant
def _validate_spatial_dimensions(variant: WanVariantType, width: int, height: int) -> None:
if variant == WanVariantType.TI2V_5B and (width % 32 or height % 32):
raise ValueError(
f"TI2V-5B requires width and height to be multiples of 32 (got {width}x{height}). "
"Wan 2.2-VAE 16x spatial * transformer patch_size 2 = pixel dims must divide by 32."
)
def _validate_ref_condition_shape(
condition: torch.Tensor,
*,
channels: int,
frames: int,
height: int,
width: int,
) -> None:
if condition.ndim != 5:
raise ValueError(f"Wan reference condition must be a 5D tensor; got shape {tuple(condition.shape)}.")
if condition.shape[0] != 1:
raise ValueError(f"Wan reference condition requires batch size 1; got {condition.shape[0]}.")
if condition.shape[1] != channels:View on GitHub (pinned to 0b6a024f2f)
Solutions
- Round width and height down/up to the nearest multiple of 32 (e.g. 1280x720 -> 1280x704 or 1280x736)
- Use the resize/crop nodes to normalize input dimensions before denoising
- Pick from a preset list of 32-divisible resolutions
- If not intentionally using TI2V-5B, switch the model to a 14B variant with different constraints
Example fix
// before width = 1279 height = 719 // after width = 1280 # multiple of 32 height = 704 # multiple of 32
Defensive patterns
Strategy: validation
Validate before calling
def snap32(x: int) -> int:
return max(32, (x // 32) * 32)
width, height = snap32(width), snap32(height)
assert width % 32 == 0 and height % 32 == 0 Type guard
def dims_valid_for_ti2v(width: int, height: int) -> bool:
return width % 32 == 0 and height % 32 == 0 Try / catch
try:
result = denoise.invoke(context)
except ValueError as e:
if "multiples of 32" in str(e):
denoise.width = (denoise.width // 32) * 32
denoise.height = (denoise.height // 32) * 32
result = denoise.invoke(context)
else:
raise Prevention
- Choose resolutions from a 32-multiple preset list (e.g. 832x480, 1280x704)
- Round dimensions before encoding inputs, not after
- Remember 16x VAE * 2 patch = 32; 16-multiples are NOT enough for TI2V-5B
- Normalize source image/video size early in the graph
When it happens
Trigger: Running a Wan TI2V-5B denoise with image/video dimensions like 1280x719, 1024x576-odd values, or any width%32 != 0 or height%32 != 0 supplied via the denoise invocation's width/height inputs.
Common situations: Using dimensions inherited from arbitrary source images/videos (e.g. 1920x1080 works but 1280x720-creep values like 1279x719 don't), prompt-driven size changes, copying sizes valid for other Wan variants that allow multiples of 16 or other grids.
Related errors
- Source longer side ({long_side}px) is smaller than the Wan p
- {noise_type} noise width and height must be a multiple of {m
- All inputs must share the same dimensions. Got: {sorted(widt
- Wan reference condition must be a 5D tensor; got shape {tupl
- Source dimensions must be positive.
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/868bc80a02f6f3ed.
Report an issue: GitHub.