images = pipe(prompt, num_inference_steps=steps, num_images_per_prompt=batch_size).images[0] Depending on GPU type, torch.compile can provide an additional speed-up of 5-300x on top of SDPA! If you’re using more recent GPU architectures such as Ampere (A100, 3090), Ada (4090), and Hopper (H100), torch.compile is able to squeeze even more performance out of these GPUs. Compilation requires some time to complete, so it is best suited for situations where you prepare your pipeline once and then perform the same type of inference operations multiple times. For example, calling the compiled pipeline on a different image size triggers compilation again which can be expensive. For more information and different options about torch.compile, refer to the torch_compile tutorial.  Benchmark We conducted a comprehensive benchmark with PyTorch 2.0’s efficient attention implementation and torch.compile across different GPUs and batch sizes for five of our most used pipelines. The code is benchmarked on 🤗 Diffusers v0.17.0.dev0 to optimize torch.compile usage (see here for more details). Expand the dropdown below to find the code used to benchmark each pipeline:   Stable Diffusion text-to-image   Copied from diffusers import DiffusionPipeline