
image = pipe(prompt, num_inference_steps=30).images[0] scaled_dot_product_attention improves the latency from 4.63 seconds to 3.31 seconds.   Use faster kernels with torch.compile Compile the UNet and the VAE to benefit from the faster kernels. First, configure a few compiler flags:   Copied from diffusers import StableDiffusionXLPipeline
import torch

torch._inductor.config.conv_1x1_as_mm = True
torch._inductor.config.coordinate_descent_tunin