{"record":{"id":"868bc80a02f6f3ed","repo":"invoke-ai/InvokeAI","slug":"ti2v-5b-requires-width-and-height-to-be-multiples","errorCode":null,"errorMessage":"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.","messagePattern":"TI2V-5B requires width and height to be multiples of 32 \\(got (.+?)x(.+?)\\)\\. Wan 2\\.2-VAE 16x spatial \\* transformer patch_size 2 = pixel dims must divide by 32\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/app/invocations/wan_denoise.py","lineNumber":89,"sourceCode":"\n    total_vram = torch.cuda.get_device_properties(device).total_memory\n    if total_vram <= WAN_MAX_RESIDENT_TRANSFORMER_BYTES:\n        return None\n    return total_vram - WAN_MAX_RESIDENT_TRANSFORMER_BYTES\n\n\ndef _resolve_variant(context: InvocationContext, transformer_field: WanTransformerField) -> WanVariantType:\n    \"\"\"Look up the Wan variant from the main model config that produced this transformer.\"\"\"\n    config = context.models.get_config(transformer_field.transformer)\n    variant = getattr(config, \"variant\", None)\n    if not isinstance(variant, WanVariantType):\n        raise ValueError(f\"Could not determine Wan variant from model {config.name!r}: variant is {variant!r}.\")\n    return variant\n\n\ndef _validate_spatial_dimensions(variant: WanVariantType, width: int, height: int) -> None:\n    if variant == WanVariantType.TI2V_5B and (width % 32 or height % 32):\n        raise ValueError(\n            f\"TI2V-5B requires width and height to be multiples of 32 (got {width}x{height}). \"\n            \"Wan 2.2-VAE 16x spatial * transformer patch_size 2 = pixel dims must divide by 32.\"\n        )\n\n\ndef _validate_ref_condition_shape(\n    condition: torch.Tensor,\n    *,\n    channels: int,\n    frames: int,\n    height: int,\n    width: int,\n) -> None:\n    if condition.ndim != 5:\n        raise ValueError(f\"Wan reference condition must be a 5D tensor; got shape {tuple(condition.shape)}.\")\n    if condition.shape[0] != 1:\n        raise ValueError(f\"Wan reference condition requires batch size 1; got {condition.shape[0]}.\")\n    if condition.shape[1] != channels:","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/invocations/wan_denoise.py#L71-L107","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nwidth = 1279\nheight = 719\n// after\nwidth = 1280   # multiple of 32\nheight = 704   # multiple of 32","handlingStrategy":"validation","validationCode":"def snap32(x: int) -> int:\n    return max(32, (x // 32) * 32)\nwidth, height = snap32(width), snap32(height)\nassert width % 32 == 0 and height % 32 == 0","typeGuard":"def dims_valid_for_ti2v(width: int, height: int) -> bool:\n    return width % 32 == 0 and height % 32 == 0","tryCatchPattern":"try:\n    result = denoise.invoke(context)\nexcept ValueError as e:\n    if \"multiples of 32\" in str(e):\n        denoise.width = (denoise.width // 32) * 32\n        denoise.height = (denoise.height // 32) * 32\n        result = denoise.invoke(context)\n    else:\n        raise","preventionTips":["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"],"tags":["validation","wan","dimensions"],"backgroundTag":"dimension-not-multiple-of-32","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}