It takes the 4ch latent and decodes it with the
WanDecoder3d module.
After a short warmup phase, the head of the WanDecoder3d became part of the process.
During the warmup, the model learned the color space. Later on, the imported/modified head improved the stability of the image.
1if __name__ == '__main__':
2 model = WanXL()
3 vae = AutoencoderKLWan.from_pretrained('Wan-AI/Wan2.2-TI2V-5B-Diffusers', subfolder='vae')
4 z = torch.randn(1, 4, 128, 128) # (B, C, H, W)
5 x = model(z) # (B, C, T, H, W)
6 image = transforms.functional.to_pil_image(model.decode_by(vae, x).squeeze())
The SDXL latent was generated by this
model.
As shown in the example, the target image size is preferably 1024px due to the lossy compression of the original encoded data.