Welcome to dgenerate’s documentation!

This is the command line manual and library documentation for dgenerate.

dgenerate is a scriptable command line tool for generating images and animation sequences using stable diffusion and related techniques, with an accompanying UI scripting environment.

For library usage examples see the Library Usage Examples folder under the examples folder in the github repository.

For command line usage documentation see the Usage Manual or the Examples Folder in the github repository.

Library Documentation

Diffusion Model Feature Support Tables

  • --model-type sd (SD 1.5 - SD 2.*)

  • --model-type pix2pix (SD 1.5 - SD 2.* - Pix2Pix)

  • --model-type sdxl (Stable Diffusion XL)

  • --model-type kolors (Kolors)

  • --model-type if (Deep Floyd Stage 1)

  • --model-type ifs (Deep Floyd Stage 2)

  • --model-type ifs-img2img (Deep Floyd Stage 2 - Img2Img)

  • --model-type sdxl-pix2pix (Stable Diffusion XL - Pix2Pix)

  • --model-type upscaler-x2 (Stable Diffusion x2 Upscaler)

  • --model-type upscaler-x4 (Stable Diffusion x4 Upscaler)

  • --model-type s-cascade (Stable Cascade)

  • --model-type sd3 (Stable Diffusion 3 and 3.5)

  • --model-type sd3-pix2pix (Stable Diffusion 3 - Pix2Pix [UltraEdit])

  • --model-type flux (Flux.1)

  • --model-type flux-fill (Flux.1 - Infill / Outfill)

  • --model-type flux-kontext (Flux.1 - Pix2Pix like editing)

  • --model-type flux2 (Flux.2 and Flux.2 Klein)

  • --model-type flux2-klein-kv (Flux.2 Klein KV)

  • --model-type z-image (Z-Image)

  • --model-type z-image-omni (Z-Image Omni)

  • --model-type qwen-image (Qwen-Image)

  • --model-type qwen-image-edit (Qwen-Image Edit and Edit-Plus)

  • --model-type qwen-image-layered (Qwen-Image Layered)

  • --model-type ltx (LTX-2.5 and LTX-Video, see Video Model Feature Support)

  • --model-type wan (Wan 2.1 / 2.2 T2V, I2V, FLF2V, V2V, VACE)

  • --model-type wan-animate (Wan-Animate)

  • --model-type wan-animate-2 (Wan-Animate-2)

Generation modes by --model-type

Model Type

Txt2Img

Img2Img

Inpainting

sd

✅

✅

✅

pix2pix

❌

✅

🚧

sdxl

✅

✅

✅

kolors

✅

✅

✅

if

✅

✅

✅

ifs

❌

✅

✅

ifs-img2img

❌

✅

✅

sdxl-pix2pix

❌

✅

🚧

upscaler-x2

❌

✅

❌

upscaler-x4

❌

✅

❌

s-cascade

✅

✅

❌

sd3

✅

✅

✅

sd3-pix2pix

❌

✅

✅

flux

✅

✅

✅

flux-fill

❌

❌

✅

flux-kontext

❌

✅

✅

flux2

✅

❌

🚧

flux2-klein-kv

✅

❌

❌

z-image

✅

✅

✅

z-image-omni

✅

❌

❌

qwen-image

✅

✅

✅

qwen-image-edit

✅

❌

🚧

qwen-image-layered

✅

❌

❌

Guidance by --model-type

Model Type

LoRA

Textual Inversions

ControlNet

Perturbed Attention Guidance (PAG)

sd

✅

✅

✅

✅

pix2pix

✅

✅

❌

❌

sdxl

✅

✅

✅

✅

kolors

✅

❌

✅

✅

if

❌

❌

❌

❌

ifs

❌

❌

❌

❌

ifs-img2img

❌

❌

❌

❌

sdxl-pix2pix

✅

✅

❌

❌

upscaler-x2

❌

❌

❌

❌

upscaler-x4

❌

✅

❌

❌

s-cascade

❌

❌

❌

❌

sd3

✅

❌

✅

✅

sd3-pix2pix

✅

❌

❌

❌

flux

✅

✅

✅

❌

flux-fill

✅

✅

❌

❌

flux-kontext

✅

✅

❌

❌

flux2

✅

❌

❌

❌

flux2-klein-kv

✅

❌

❌

❌

z-image

✅

❌

✅

❌

z-image-omni

✅

❌

❌

❌

qwen-image

✅

❌

✅

❌

qwen-image-edit

✅

❌

❌

❌

qwen-image-layered

✅

❌

❌

❌

Adapters by --model-type

Model Type

T2I Adapter

IP Adapter

sd

✅

✅

pix2pix

❌

✅

sdxl

✅

✅

kolors

❌

✅

if

❌

❌

ifs

❌

❌

ifs-img2img

❌

❌

sdxl-pix2pix

❌

❌

upscaler-x2

❌

❌

upscaler-x4

❌

❌

s-cascade

❌

❌

sd3

❌

❌

sd3-pix2pix

❌

❌

flux

❌

✅

flux-fill

❌

❌

flux-kontext

❌

✅

flux2

❌

❌

flux2-klein-kv

❌

❌

z-image

❌

❌

z-image-omni

❌

❌

qwen-image

❌

❌

qwen-image-edit

❌

❌

qwen-image-layered

❌

❌

Prompt enhancement by --model-type

Model Type

sd-embed Prompt Weighting

compel Prompt Weighting

llm4gen Prompt Weighting

sd

✅

✅

✅

pix2pix

✅

✅

✅

sdxl

✅

✅

❌

kolors

❌

❌

❌

if

❌

❌

❌

ifs

❌

❌

❌

ifs-img2img

❌

❌

❌

sdxl-pix2pix

✅

✅

❌

upscaler-x2

❌

❌

❌

upscaler-x4

✅

✅

✅

s-cascade

✅

✅

❌

sd3

✅

❌

❌

sd3-pix2pix

✅

❌

❌

flux

✅

❌

❌

flux-fill

✅

❌

❌

flux-kontext

✅

❌

❌

flux2

❌

❌

❌

flux2-klein-kv

❌

❌

❌

z-image

❌

❌

❌

z-image-omni

❌

❌

❌

qwen-image

❌

❌

❌

qwen-image-edit

❌

❌

❌

qwen-image-layered

❌

❌

❌

Generation Features by --model-type

Model Type

DyPE

Cache-DiT

ADetailer

FreeU

Hi-Diffusion

DeepCache

Microsoft RAS

SADA

TeaCache

Spectrum

sd

❌

❌

✅

✅

✅

✅

❌

✅

❌

❌

pix2pix

❌

❌

❌

✅

❌

✅

❌

❌

❌

❌

sdxl

❌

❌

✅

✅

✅

✅

❌

✅

❌

✅

kolors

❌

❌

✅

✅

✅

✅

❌

✅

❌

✅

if

❌

❌

❌

❌

❌

❌

❌

❌

❌

❌

ifs

❌

❌

❌

❌

❌

❌

❌

❌

❌

❌

ifs-img2img

❌

❌

❌

❌

❌

❌

❌

❌

❌

❌

sdxl-pix2pix

❌

❌

❌

✅

❌

✅

❌

❌

❌

✅

upscaler-x2

❌

❌

❌

✅

❌

❌

❌

❌

❌

❌

upscaler-x4

❌

❌

❌

✅

❌

✅

❌

❌

❌

❌

s-cascade

❌

❌

❌

❌

❌

❌

❌

❌

❌

❌

sd3

❌

✅

✅

❌

❌

❌

✅

❌

❌

✅

sd3-pix2pix

❌

✅

❌

❌

❌

❌

✅

❌

❌

✅

flux

✅

✅

✅

❌

❌

❌

❌

✅

✅

✅

flux-fill

✅

✅

✅

❌

❌

❌

❌

✅

✅

✅

flux-kontext

✅

✅

❌

❌

❌

❌

❌

✅

✅

✅

flux2

✅

✅

✅

❌

❌

❌

❌

❌

❌

✅

flux2-klein-kv

✅

✅

❌

❌

❌

❌

❌

❌

❌

✅

z-image

✅

✅

✅

❌

❌

❌

❌

❌

❌

✅

z-image-omni

✅

✅

❌

❌

❌

❌

❌

❌

❌

✅

qwen-image

✅

✅

✅

❌

❌

❌

❌

❌

❌

✅

qwen-image-edit

✅

✅

✅

❌

❌

❌

❌

❌

❌

✅

qwen-image-layered

✅

✅

❌

❌

❌

❌

❌

❌

❌

✅

Video Model Feature Support

--model-type ltx generates a whole clip in one pipeline call. The checkpoint’s model_index.json selects LTX-2.5 (LTX2Pipeline) or the earlier LTX-Video (LTXPipeline).

Features by LTX checkpoint

Feature

LTX-2.5

LTX-Video

Text to video

✅

✅

First / last frame images

✅

✅

Video conditioning

✅

✅

Separate first / last frame processors

✅

✅

IC-LoRA control

✅

❌

LoRA with IC-LoRA

✅

❌

Length predicted from prompt

✅

❌

Audio

✅

❌

Sigmas and audio guidance

✅

❌

LoRA

✅

✅

Quantization

✅

✅

Replacement transformer

✅

✅

Cache-DiT

✅

✅

LTX does not support ControlNets, adapters, textual inversions, prompt weighters, or inpainting. Cache-DiT is supported; other acceleration features in the tables above are not. GGUF transformers are tested with LTX-Video. See the video generation section in the manual for LTX-2.5 and the earlier LTX-Video checkpoint.

--model-type wan, --model-type wan-animate, and --model-type wan-animate-2 also generate a whole clip in one pipeline call. Clip length and frame rate are the shared --video-lengths and --video-fps options.

Features by Wan mode

Feature

wan

wan-animate

wan-animate-2

Text to video

✅

❌

❌

Image to video

✅

❌

❌

First / last frame (last-frame=)

✅

❌

❌

Video to video

✅

❌

❌

VACE (control= / mask= / reference=)

✅

❌

❌

Character animation (wan-pose= / wan-face=)

❌

✅

❌

wan-driving= as the motion clip

❌

❌

✅

wan-driving= preprocess (openpose + yolo)

❌

✅

❌

Cache-DiT

✅

✅

✅

MoE second transformer

✅

❌

❌

LoRA

✅

✅

✅

Quantization / GGUF

✅

✅

✅

Spectrum

✅

✅

✅

DyPE

✅

✅

✅

Flow Image Model Notes

flux2, flux2-klein-kv, z-image-omni, qwen-image-edit, and qwen-image-layered take an --image-seeds value with no mask as a condition image. That is the text-to-image column above. There is no img2img strength.

flux2 inpainting is Flux.2 Klein only. Full Flux.2 has no inpaint pipeline.

qwen-image-edit inpainting is the edit pipeline with a mask. Edit-plus has no inpaint pipeline.

ControlNet on z-image and qwen-image is text-to-image and inpaint. z-image accepts one union model. qwen-image can take more than one.

These model types support LoRA, Cache-DiT, DyPE, and Spectrum. They do not support textual inversions, IP adapters, T2I adapters, prompt weighters, PAG, DeepCache, TeaCache, SADA, RAS, or HiDiffusion.

PAG Support Caveats

PAG is supported for txt2img in all cases, but there are some edge cases in which PAG is not supported.

There is no support for using T2I Adapters with PAG.

Stable Diffusion 3 does not currently support PAG with ControlNets at all.

Stable Diffusion XL does not support PAG in (inpaint + ControlNets) mode.

Stable Diffusion 1.5 - 2.* does not support PAG in img2img, inpaint, or (img2img + ControlNets) mode. It does however support PAG in (inpaint + ControlNets) mode.

Kolors only supports PAG in txt2img mode.

Generation Feature Notes

FreeU parameters differ by model type and can be specified using the --freeu-params option. The recommended parameters for SD1.4, SD1.5, SD2.1, and SDXL can be reviewed here. Kolors is compatible with FreeU’s SDXL settings.

--torch-compile compiles repeated denoiser, ControlNet, and VAE decoder blocks. The first use of each waits while the graph builds. A later change of resolution or frame count compiles once more, then reuses that graph. CUDA and XPU need Triton. On macOS, PyTorch 2.13 and newer compile these blocks to a Metal kernel. CPU and quantized weights stay eager, and dgenerate warns. Text encoders, image encoders, and the LTX diffusion decoder stay eager. Wan-Animate-2 compiles its transformer and VAE blocks on every load. DGENERATE_TORCH_COMPILE=0 leaves every model eager, including Wan-Animate-2.

Faster generation speeds can be achieved by using Cache-DiT, DyPE, DeepCache, Microsoft RAS, SADA, TeaCache, or Spectrum, but may lead to reduced image quality. The default values for each of these features are conservative, providing some speed increases without major impacts on quality.

The DeepCache branch ID and interval can be specified with the --deep-cache-branch-ids and --deep-cache-intervals options. Benchmarks for different parameters can be reviewed here.

Microsoft Region-Adaptive Sampling (RAS) has numerous configurable options that can be reviewed here. Note that the --ras-index-fusion parameter is not compatible with SD3.5.

The TeaCache threshold can be specified with the --tea-cache-rel-l1-thresholds parameter. Information about this parameter can be reviewed here.

SADA cannot be combined with Hi-Diffusion, DeepCache, or TeaCache.

DyPE (--dype) adapts spatial RoPE frequencies during denoising. Use --dype-methods to try yarn (default), ntk, or the base RoPE baseline as combinatoric values. The Flux.1 and Qwen-Image adapters follow the upstream architecture; Flux Fill/Kontext, Qwen Edit/Layered, Flux.2, Z-Image, and Wan are experimental adapters. Reference long-side defaults are 1024 pixels for Flux/Flux.2/Z-Image, 1328 for Qwen-Image, and 832 for Wan. --dype-mscales controls the yarn method’s attention magnitude scale: constant (default), decay, or off. Use decay or off if yarn produces a fine repeating texture, as it does with FLUX.1-dev. --dype-axis-scalings controls non-square images: shared (default) applies the long side’s scaling to both axes, as ComfyUI-DyPE does; independent scales each axis separately, as upstream DyPE does. DyPE cannot be combined with Cache-DiT, TeaCache, Spectrum, or SADA, because those features reuse or skip denoiser work from an earlier step. See the DyPE source and the vendored adapter notes under dgenerate/extras/dype.

Spectrum (--spectrum) forecasts denoiser block outputs and skips those blocks on later steps. Transformers skip their blocks. SDXL and Kolors skip the UNet down, mid, and up blocks and still run the output convolution. It is supported on SD3, SDXL, Kolors, Flux, Flux.2, Z-Image, Qwen-Image, and Wan. The moderate schedule is the default (window 2, flex 0.75). --spectrum-flex-windows 3 is the paper’s aggressive schedule. Details are at Spectrum.

Usage Manual

Indices and tables