Skip to content

Latest commit

 

History

History
172 lines (126 loc) · 5.45 KB

sd.md

File metadata and controls

172 lines (126 loc) · 5.45 KB

Stable Diffusion 1.x, 2.x, and SDXL

Stable Diffusion 1.x, 2.x, and SDXL support text-to-image and image-to-image generation from single-file checkpoints.

Model files

Component Weights and downloads CLI option Requirement
SD 1.4 checkpoint CompVis SD 1.4 -m / --model Choose a matching SD checkpoint
SD 1.5 checkpoint Stable Diffusion 1.5 -m / --model Choose a matching SD checkpoint
SD 2.1 checkpoint Stable Diffusion 2.1 -m / --model Choose a matching SD checkpoint
SDXL checkpoint sd_xl_base_1.0.safetensors from SDXL -m / --model For SDXL examples
SDXL VAE sdxl_vae-fp16-fix.safetensors --vae Use an override when required by the checkpoint

Usage

Web UI

Follow the Web UI guide to start the server, then select the recipe matching your weights. Fill the component slots below and click Load models. Use the files and compatibility requirements in Model files.

Recipe Component slots
SD 1.x (sd1-checkpoint) model, vae, tae
SD 2.1 512 (sd2-512-checkpoint) model, vae, tae
SD 2.1 768 (sd2-768-checkpoint) model, vae, tae
SDXL (sdxl-checkpoint) model, vae, tae
SD Turbo (sd-turbo) model, vae, tae
SDXL Turbo (sdxl-turbo) model, vae, tae

Slot IDs correspond to CLI component options: diffusion_model uses --diffusion-model, llm uses --llm, and model uses -m / --model. Select optional components when required by your checkpoint or task.

DGL

Example Description
SD 1.4 Text-to-image generation.
SD 1.5 Text-to-image generation.
SDXL Text-to-image generation.
SD 1.4 image to image Start from an existing image.
SD 1.5 ControlNet Use a pose control image.
SD 1.5 inpainting Use an inpainting checkpoint and mask.
NitroSD Realism / NitroFusion Explicit noise schedule and custom prediction transform.

Run a script

Edit paths, prompts and settings in the script's var block, then run from the build directory. Paths inside the script resolve from the working directory.

Windows (PowerShell)

.\bin\Release\sd-cli.exe -M dgl --script ..\docs\dgl\sd\sd1-4-txt2img.dgl

Linux/macOS

./bin/sd-cli -M dgl --script ../docs/dgl/sd/sd1-4-txt2img.dgl

Choose another script from the table to run a different task. Add --check to validate syntax and types without loading weights. See the shared run instructions for build paths and the server's file-access rules.

Legacy CLI

CLI examples use the shared path and shell conventions.

SD 1.4

Windows (PowerShell)

.\bin\Release\sd-cli.exe -m ..\models\checkpoints\sd-v1-4.ckpt -p "a lovely cat"

Linux/macOS

./bin/sd-cli -m ../models/checkpoints/sd-v1-4.ckpt -p "a lovely cat"

SD 1.5

Windows (PowerShell)

.\bin\Release\sd-cli.exe -m ..\models\checkpoints\v1-5-pruned-emaonly.safetensors -p "a lovely cat"

Linux/macOS

./bin/sd-cli -m ../models/checkpoints/v1-5-pruned-emaonly.safetensors -p "a lovely cat"

SDXL

Windows (PowerShell)

.\bin\Release\sd-cli.exe `
  -m ..\models\checkpoints\sd_xl_base_1.0.safetensors `
  --vae ..\models\vae\sdxl_vae-fp16-fix.safetensors `
  -p "a lovely cat" `
  -H 1024 `
  -W 1024 `
  -v

Linux/macOS

./bin/sd-cli \
  -m ../models/checkpoints/sd_xl_base_1.0.safetensors \
  --vae ../models/vae/sdxl_vae-fp16-fix.safetensors \
  -p "a lovely cat" \
  -H 1024 \
  -W 1024 \
  -v

img2img example

Use the image generated above as ./output.png.

Windows (PowerShell)

.\bin\Release\sd-cli.exe `
  -m ..\models\checkpoints\sd-v1-4.ckpt `
  -p "cat with blue eyes" `
  -i .\output.png `
  --strength 0.4 `
  -o .\img2img_output.png

Linux/macOS

./bin/sd-cli \
  -m ../models/checkpoints/sd-v1-4.ckpt \
  -p "cat with blue eyes" \
  -i ./output.png \
  --strength 0.4 \
  -o ./img2img_output.png

Precision comparison

Using formats of different precisions will yield results of varying quality.

f32 f16 q8_0 q5_0 q5_1 q4_0 q4_1

Notes and limitations

See SD3 / SD3.5 for Stable Diffusion 3, and FLUX.1 for FLUX. The SD3 model repository uses a different component setup. For distilled and tiny variants, see distilled SD models.