+ frames = pipeline(image, decode_chunk_size=2, generator=generator, num_frames=25).frames[0] If memory is not an issue and you want to optimize for speed, try wrapping the UNet with torch.compile.   Copied - pipeline.enable_model_cpu_offload()