
The Diffusers library is the Hugging Face standard for working with image generation models — Stable Diffusion, FLUX, and more.
pip install diffusers accelerate
from diffusers import StableDiffusionPipeline
import torch
pipe = StableDiffusionPipeline.from_pretrained(
"runwayml/stable-diffusion-v1-5",
torch_dtype=torch.float16
).to("cuda")
image = pipe("A golden retriever on the moon, photorealistic").images[0]
image.save("output.png")Reference:
TaskLoco™ — The Sticky Note GOAT