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
- dgenerate module
BatchProcessErrorDgenerateHelpExceptionDgenerateUsageErrorFrameStartOutOfBoundsImageProcessorArgumentErrorImageProcessorErrorImageProcessorImageModeErrorImageProcessorNotFoundErrorImageSeedErrorInvalidModelFileErrorInvalidModelUriErrorInvalidSchedulerNameErrorLatentsProcessorArgumentErrorLatentsProcessorErrorLatentsProcessorNotFoundErrorMediaIdentificationErrorModelNotFoundErrorModelUriLoadErrorModuleFileNotFoundErrorNonHFConfigDownloadErrorNonHFDownloadErrorNonHFModelDownloadErrorOutOfMemoryErrorPluginArgumentErrorPluginNotFoundErrorPromptEmbeddedArgumentErrorPromptUpscalerProcessingErrorPromptWeightingUnsupportedRenderLoopConfigErrorSchedulerArgumentErrorSchedulerLoadErrorSpacyModelNotFoundErrorUnknownMimetypeErrorUnsupportedPipelineConfigErrorWebFileCacheOfflineModeExceptionAnimationETAEventAnimationFileFinishedEventAnimationFinishedEventConfigRunnerConfigRunnerPluginConfigRunnerPluginLoaderDataTypeDgenerateArgumentsDiffusionArgumentsDiffusionPipelineWrapperImageFileSavedEventImageGeneratedEventModelTypePipelineTypePromptRenderLoopRenderLoopConfigStartingAnimationEventStartingAnimationFileEventStartingGenerationStepEventclear_device_cache()default_device()disable_offline_mode()enable_offline_mode()format_image_seed_uri()gen_seeds()invoke_dgenerate()invoke_dgenerate_events()is_offline_mode()main()offline_mode_context()parse_args()
- dgenerate submodules
- dgenerate.arguments module
- dgenerate.auto1111_metadata module
- dgenerate.batchprocess module
- dgenerate.devicecache module
- dgenerate.eval module
- dgenerate.filecache module
- dgenerate.filelock module
- dgenerate.files module
- dgenerate.globalconfig module
- dgenerate.hfhub module
- dgenerate.image module
- dgenerate.image_process module
- dgenerate.imageprocessors module
- dgenerate.imageprocessors.constants module
- dgenerate.invoker module
- dgenerate.mediainput module
- dgenerate.mediaoutput module
- dgenerate.memoize module
- dgenerate.memory module
- dgenerate.messages module
- dgenerate.pipelinewrapper module
- dgenerate.pipelinewrapper.constants module
- dgenerate.plugin module
- dgenerate.prompt module
- dgenerate.promptupscalers module
- dgenerate.promptupscalers.constants module
- dgenerate.promptweighters module
- dgenerate.promptweighters.constants module
- dgenerate.pygments module
- dgenerate.spacycache module
- dgenerate.resources module
- dgenerate.renderloop module
- dgenerate.textprocessing module
- dgenerate.torchutil module
- dgenerate.translators module
- dgenerate.types module
- dgenerate.webcache module
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 |
Txt2Img |
Img2Img |
Inpainting |
|---|---|---|---|
|
✅ |
✅ |
✅ |
|
❌ |
✅ |
🚧 |
|
✅ |
✅ |
✅ |
|
✅ |
✅ |
✅ |
|
✅ |
✅ |
✅ |
|
❌ |
✅ |
✅ |
|
❌ |
✅ |
✅ |
|
❌ |
✅ |
🚧 |
|
❌ |
✅ |
❌ |
|
❌ |
✅ |
❌ |
|
✅ |
✅ |
❌ |
|
✅ |
✅ |
✅ |
|
❌ |
✅ |
✅ |
|
✅ |
✅ |
✅ |
|
❌ |
❌ |
✅ |
|
❌ |
✅ |
✅ |
Model Type |
LoRA |
Textual Inversions |
ControlNet |
Perturbed Attention Guidance (PAG) |
|---|---|---|---|---|
|
✅ |
✅ |
✅ |
✅ |
|
✅ |
✅ |
❌ |
❌ |
|
✅ |
✅ |
✅ |
✅ |
|
✅ |
❌ |
✅ |
✅ |
|
❌ |
❌ |
❌ |
❌ |
|
❌ |
❌ |
❌ |
❌ |
|
❌ |
❌ |
❌ |
❌ |
|
✅ |
✅ |
❌ |
❌ |
|
❌ |
❌ |
❌ |
❌ |
|
❌ |
✅ |
❌ |
❌ |
|
❌ |
❌ |
❌ |
❌ |
|
✅ |
❌ |
✅ |
✅ |
|
✅ |
❌ |
❌ |
❌ |
|
✅ |
✅ |
✅ |
❌ |
|
✅ |
✅ |
❌ |
❌ |
|
✅ |
✅ |
❌ |
❌ |
Model Type |
T2I Adapter |
IP Adapter |
|---|---|---|
|
✅ |
✅ |
|
❌ |
✅ |
|
✅ |
✅ |
|
❌ |
✅ |
|
❌ |
❌ |
|
❌ |
❌ |
|
❌ |
❌ |
|
❌ |
❌ |
|
❌ |
❌ |
|
❌ |
❌ |
|
❌ |
❌ |
|
❌ |
❌ |
|
❌ |
❌ |
|
❌ |
✅ |
|
❌ |
❌ |
|
❌ |
✅ |
Model Type |
sd-embed Prompt Weighting |
compel Prompt Weighting |
llm4gen Prompt Weighting |
|---|---|---|---|
|
✅ |
✅ |
✅ |
|
✅ |
✅ |
✅ |
|
✅ |
✅ |
❌ |
|
❌ |
❌ |
❌ |
|
❌ |
❌ |
❌ |
|
❌ |
❌ |
❌ |
|
❌ |
❌ |
❌ |
|
✅ |
✅ |
❌ |
|
❌ |
❌ |
❌ |
|
✅ |
✅ |
✅ |
|
✅ |
✅ |
❌ |
|
✅ |
❌ |
❌ |
|
✅ |
❌ |
❌ |
|
✅ |
❌ |
❌ |
|
✅ |
❌ |
❌ |
|
✅ |
❌ |
❌ |
Model Type |
ADetailer |
FreeU |
Hi-Diffusion |
DeepCache |
Microsoft RAS |
TeaCache |
|---|---|---|---|---|---|---|
|
✅ |
✅ |
✅ |
✅ |
❌ |
❌ |
|
❌ |
❌ |
❌ |
✅ |
❌ |
❌ |
|
✅ |
✅ |
✅ |
✅ |
❌ |
❌ |
|
✅ |
✅ |
✅ |
✅ |
❌ |
❌ |
|
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|
❌ |
❌ |
❌ |
✅ |
❌ |
❌ |
|
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|
❌ |
❌ |
❌ |
✅ |
❌ |
❌ |
|
❌ |
❌ |
❌ |
❌ |
❌ |
❌ |
|
✅ |
❌ |
❌ |
❌ |
✅ |
❌ |
|
❌ |
❌ |
❌ |
❌ |
✅ |
❌ |
|
✅ |
❌ |
❌ |
❌ |
❌ |
✅ |
|
❌ |
❌ |
❌ |
❌ |
❌ |
✅ |
|
❌ |
❌ |
❌ |
❌ |
❌ |
✅ |
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.
Faster generation speeds can be achieved by using DeepCache, Microsoft RAS, or TeaCache, 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.
Usage Manual
- Help Output
- Windows Install
- Linux or WSL Install
- Linux with ROCm (AMD Cards)
- Linux with opencv-python-headless (libGL.so.1 issues)
- MacOS Install (Apple Silicon Only)
- Google Colab Install
- Install with XPU support
- Installing From Development Branches
- Basic Usage
- Negative Prompt
- Multiple Prompts
- Image Seeds
- Inpainting
- Inpainting With Auto Crop
- Per Image Seed Resizing
- Animated Output
- Animation Slicing
- Inpainting Animations
- Latents Interchange
- Deterministic Output
- Specifying a specific GPU for CUDA
- Specifying a Scheduler (sampler)
- Specifying Sigmas (denoising schedule)
- Specifying a VAE
- VAE Tiling and Slicing
- Specifying a UNet
- Specifying a Transformer (SD3 and Flux)
- Specifying an SDXL Refiner
- Specifying a Stable Cascade Decoder
- Specifying LoRAs
- Specifying Textual Inversions (embeddings)
- Specifying ControlNets
- Specifying T2I Adapters
- Specifying IP Adapters
- Specifying Text Encoders
- Prompt Upscaling
- Prompt Weighting
- Embedded Prompt Arguments
- Utilizing CivitAI links and Other Hosted Models
- Specifying Generation Batch Size
- Batching Input Images and Inpaint Masks
- Image Processors
- Latents Processors
- Sub Commands
- Upscaling Images
- Adetailer (YOLO based inpainting)
- Segment Anything Mask Generation
- YOLO + SAM Automated Segmentation
- Quantization
- Writing and Running Configs
- Basic config syntax
- Built in template variables
- Built in template functions
- Directives, and applying templating
- Setting template variables, in depth
- Setting environmental variables, in depth
- Globbing and path manipulation
- Importing arbitrary python modules
- String and text escaping behavior
- The \print and \echo directive
- The \image_process directive
- The \exec directive
- The \download directive
- The download() template function
- The \exit directive
- Running configs from the command line
- Config argument injection
- Setting template variables from the CLI
- Console UI
- Writing Plugins
- Utilizing the Python Environment for Training
- Auth Tokens
- File Cache Control
- Enable / Disable Torch Compile
- Startup Configuration