{"record":{"id":"a59e5cf308444019","repo":"invoke-ai/InvokeAI","slug":"ti2v-5b-i2v-requires-width-and-height-to-be-multip","errorCode":null,"errorMessage":"TI2V-5B I2V requires width and height to be multiples of 32 (got {self.width}x{self.height}). The Wan 2.2-VAE uses 16x spatial compression and the transformer adds a 2x patch on top, so pixel dims must divide by 32 for the patchify step.","messagePattern":"TI2V-5B I2V requires width and height to be multiples of 32 \\(got (.+?)x(.+?)\\)\\. The Wan 2\\.2-VAE uses 16x spatial compression and the transformer adds a 2x patch on top, so pixel dims must divide by 32 for the patchify step\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/app/invocations/wan_ref_image_encoder.py","lineNumber":163,"sourceCode":"            # Pick the encoder path by VAE z_dim: 48 means the Wan 2.2-VAE (TI2V-5B),\n            # which uses a single-frame 48-channel condition that the denoise loop\n            # blends with the noisy latents at every step (expand_timesteps path).\n            # 16 means the standard Wan VAE (A14B), which uses the 20-channel\n            # mask + latent condition concatenated to noise along the channel dim.\n            is_ti2v_5b = getattr(vae.config, \"z_dim\", 16) == 48\n            if end_pil_image is not None and (is_ti2v_5b or self.num_frames <= 1):\n                raise ValueError(\n                    \"End-image (FLF2V) interpolation is only supported for I2V-A14B video \"\n                    f\"(num_frames > 1). Got {'TI2V-5B' if is_ti2v_5b else 'single-frame I2V'}. \"\n                    \"Remove the End Image input, or use an A14B VAE with num_frames > 1.\"\n                )\n            if is_ti2v_5b:\n                # TI2V-5B I2V needs latent H/W to be even for the transformer\n                # patch_size=(1,2,2), so pixel dims must be multiples of 32\n                # (16x VAE * 2 transformer patch). A14B's 8x VAE only needed\n                # multiples of 16.\n                if self.width % 32 != 0 or self.height % 32 != 0:\n                    raise ValueError(\n                        f\"TI2V-5B I2V requires width and height to be multiples of 32 \"\n                        f\"(got {self.width}x{self.height}). The Wan 2.2-VAE uses 16x \"\n                        f\"spatial compression and the transformer adds a 2x patch on \"\n                        f\"top, so pixel dims must divide by 32 for the patchify step.\"\n                    )\n                condition = encode_reference_image_to_ti2v_condition(\n                    image=pil_image,\n                    vae=vae,\n                    width=self.width,\n                    height=self.height,\n                    device=device,\n                    dtype=target_dtype,\n                )\n            elif self.num_frames <= 1:\n                condition = encode_reference_image_to_condition(\n                    image=pil_image,\n                    vae=vae,\n                    width=self.width,","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/invocations/wan_ref_image_encoder.py#L145-L181","documentation":"TI2V-5B uses the Wan 2.2 VAE with 16x spatial compression and a transformer patch size of (1,2,2), so latent H/W must be even; that means pixel width and height must be multiples of 32. InvokeAI raises ValueError when they are not, because the patchify step would otherwise fail on odd latent dimensions.","triggerScenarios":"Running wan_ref_image_encoder with a TI2V-5B VAE and width/height not divisible by 32, e.g. 512x704, 1024x576, or any multiple of 8/16 that isn't a multiple of 32.","commonSituations":"Reusing dimensions tuned for A14B (8x VAE, multiples of 16 suffice, e.g. 832x480) and applying them to TI2V-5B.","solutions":["Round width and height up to the nearest multiple of 32 (e.g. 832x480 -> 832x480 is fine since 32*26 and 32*15; 512x704 works; 848 -> 864).","Use standard 32-multiple resolutions like 1280x704 or 960x544 for TI2V-5B.","Switch to the A14B VAE/transformer if you need finer 16-pixel granularity."],"exampleFix":"// before\nwidth, height = 816, 480  # 816 % 32 != 0\n// after\nwidth, height = 832, 480  # both multiples of 32","handlingStrategy":"validation","validationCode":"assert is_ti2v_5b is False or (width % 32 == 0 and height % 32 == 0), \\\n    f\"TI2V-5B needs multiples of 32, got {width}x{height}\"\nwidth, height = (w + 31) // 32 * 32, (h + 31) // 32 * 32","typeGuard":null,"tryCatchPattern":"try:\n    out = encoder.invoke(context)\nexcept ValueError as e:\n    if \"multiples of 32\" in str(e):\n        width, height = (width + 31) // 32 * 32, (height + 31) // 32 * 32\n    else:\n        raise","preventionTips":["Use canonical TI2V-5B resolutions (multiples of 32, e.g. 1280x704).","Remember the rule: A14B -> multiple of 16; TI2V-5B -> multiple of 32.","Snap resolution in a shared resize step before both encoder and denoise."],"tags":["validation","resolution","ti2v-5b","wan"],"backgroundTag":"invalid-resolution-multiple","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}