o important to change the memory layout of the UNet and the VAE to “channels_last” when compiling them. This ensures maximum speed:   Copied pipe.unet.to(memory_format=torch.channels_last)
pipe.vae.to(memory_format=torch.channels_last) Then, compile and perform inference:   Copied # Compile the UNet and VAE.
pipe.unet = torch.compile(pipe.unet, mode="max-autotune", fullgraph=True)
pipe.vae.decode = torch.compile(pipe.vae.decode, mode="max-autot