del offloading as another point in the optimization space: it will be much faster, but memory savings won't be as large.

It is also possible to chain offloading with attention slicing for minimal memory consumption (< 2GB).


	Copied
import torch
from diffusers import StableDiffusionPipeline

pipe = StableDiffusionPipeline.from_pretrained(
    "runwayml/stable-diffusion-v1-5",
    
    torch_dtype=torch.float16,
)

prompt = "a photo of an astr