Stable Diffusion
One way to use Stable Diffusion is to have a frontend GUI. This note shows how to setup a frontend called ComfyUI and use Stable Diffusion.
ComfyUI Setup
uv pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu128
The UI should be accessible at http://127.0.0.1:8188
.
Note
- Python 3.13 is supported but using 3.12 is recommended because some custom nodes and their dependencies might not support it yet.
- Put your SD checkpoints (the huge ckpt/safetensors files) in: models/checkpoints
- Put your VAE in: models/vae
Stable Diffusion
The ComfyUI does not include any models out of the box. We're going to use SDXL (Stable Diffusion XL).
-
Download the Stable Diffusion XL Base 1.0 model from Hugging Face. It's the file named
sd_xl_base_1.0.safetensors
. Place in themodels/checkpoints
directory. -
Download the Stable Diffusion XL Refiner 1.0 refiner from Huggine Face. It's the file named
sd_xl_refiner_1.0.safetensors
. Place in themodels/checkpoints
directory. -
Download the Stable Diffusion XL VAE VAE from Hugging Face. It's the file named
sdxl_vae.safetensors
. Place in themodels/vae
directory.
If you reload the UI and running the default sample template for image generation, you'll see the Stable Diffusion model and refiner available in the Load Checkpoint
node.
CLIP Text Encode Node
Used for prompt (both positive and negative)
Empty Latent Image Node
Starting point for Stable Diffusion. Can set things like image size and how many images. This node represents an empty starting image.
KSampler Node
Property | Description |
---|---|
control_after_generate | Whether the image generated is same or random. |
steps | How long it bakes the image. Go between 30 and 40. |
cfg | How close it follows prompt (between 7 and 10 is good) |
ComfyUI Manager
To add more nodes easiest way is to use ComfyUI Manager tool. Shutdown ComfyUI and follow these steps.
cd custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Manager comfyui-manager
Restart the ComfyUI and you should see a Manager button appear.
Example Workflow with OpenPose
See YouTube - Run SDXL Locally With ComfyUI (2024 Stable Diffusion Guide) by Matt Wolfe