Generative AI
Intermediate
4.5

Generate Images with Stable Diffusion

Run an open image model and learn what each setting does.

1h 30m
1 lesson
1.2K students

What You'll Learn

Learning objectives will be added soon.

Tutorial Content

Generate locally

from diffusers import StableDiffusionPipeline
import torch

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

img = pipe("a cozy cabin in a snowy forest, golden hour, highly detailed").images[0]
img.save("cabin.png")

Knobs that matter

  • Prompt — be specific about subject, style, and lighting.
  • Steps — more steps, more detail (diminishing returns ~30–50).
  • Guidance scale — how strictly it follows the prompt (7–9 is typical).
  • Seed — fix it to reproduce or vary results.

Your Progress

Sign in to track your progress

Tags

Diffusion
Stable Diffusion
Python
Open Source