scaled-dot product attention or xFormers (you can use one or the other, but there’s no need to use both). You can also offload the model to the GPU while the other pipeline components wait on the CPU.   Copied + pipeline.enable_model_cpu_offload()
+ pipeline.enable_xformers_memory_efficient_attention() With torch.compile, you can boost your inference speed even more by wrapping your UNet with it:   Copied pipeline.unet = torch.compile(pipeline.