)
pipe = pipe.to("mps")

# Recommended if your computer has < 64 GB of RAM
pipe.enable_attention_slicing()

prompt = "a photo of an astronaut riding a horse on mars"
image = pipe(prompt).images[0]
image Generating multiple prompts in a batch can crash or fail to work reliably. We believe this is related to the mps backend in PyTorch. While this is being investigated, you should iterate instead of batching. If you’re using PyTorch 1.13, you need