Releases: Teriks/dgenerate
v4.1.0 (Stable Cascade prompt weighting, MacOS arm64 support)
v4.1.0 release with Windows installer.
Due to the size of the packaged python environment, the installer is within a multi-part zip file.
The multipart zip can be extracted using 7-Zip: https://www.7-zip.org/
Download both dgenerate_installer.zip.001
and dgenerate_installer.zip.002
to a folder.
Unzip dgenerate_installer.zip.001
to a directory (Right click, 7-Zip -> Extract to "dgenerate_installer") and then run dgenerate_installer\dgenerate.msi
to install.
dgenerate will be installed under C:\Program Files\dgenerate
by default with an isolated python environment provided.
The install directory will be added to PATH, and dgenerate will be available from the command line.
Portable Install
A portable install is provided via dgenerate_portable.zip.001
and dgenerate_portable.zip.002
, these contain
nothing but the dgenerate executable and a frozen python environment which can be placed anywhere.
4.1.0 Features
-
Stable Cascade can now use long prompts with weighting via the
compel
andsd-embed
prompt weighters, simply specify one of these two values to--prompt-weighter
to enable the feature when using Stable Cascade. -
Built and published wheels for MacOS on Apple Silicon, dgenerate can now be used with
--device mps
on MacOS (arm64). See install instructions here: MacOS Install (Apple Silicon Only). This is very experimental. -
Console UI hotkeys dynamically adjust for useability when the UI is running on MacOS, I am sure that the hotkeys are very abnormal when compared to typical MacOS convention for text editors, but they all function and do not overlap with important system hotkeys.
Insert
(for multiline input) changes toCommand+i
, andCtrl+Space
(for run) changes toCommand+r
. All other hotkeys remain the same, including copy, paste, and cut. -
Added template function
frange
which is justrange
but for float ranges. This is useful for stepping through guidance scale values or LoRA scale values for example. It uses identical logic torange
, but the step value may be a float, e.g.frange(0.1, 1.0, 0.2) -> [0.1, 0.3, 0.5, 0.7, 0.9]
. The default step value is:0.1
-
torch 2.4.1
v4.0.3 (Flux, IP Adapters, T2I Adapters, Input Batching)
v4.0.3 release with Windows installer.
Due to the size of the packaged python environment, the installer is within a multi-part zip file.
The multipart zip can be extracted using 7-Zip: https://www.7-zip.org/
Download both dgenerate_installer.zip.001
and dgenerate_installer.zip.002
to a folder.
Unzip dgenerate_installer.zip.001
to a directory (Right click, 7-Zip -> Extract to "dgenerate_installer") and then run dgenerate_installer\dgenerate.msi
to install.
dgenerate will be installed under C:\Program Files\dgenerate
by default with an isolated python environment provided.
The install directory will be added to PATH, and dgenerate will be available from the command line.
Portable Install
A portable install is provided via dgenerate_portable.zip.001
and dgenerate_portable.zip.002
, these contain
nothing but the dgenerate executable and a frozen python environment which can be placed anywhere.
4.0.3 Patch Fix
runwayml has removed their stable diffusion 1.5 repository from Hugging Face, breaking single file loads in the diffusers library and anything that uses it.
This release upgrades diffusers to 0.30.2 where the issue has been worked around by instead referencing Lykon/dreamshaper-8
All references to the runwayml model on Hugging Face have been removed from this project, including in documentation.
4.0.0 Features
The command line interface remains backwards compatible for all supported model types, the major version change is mostly due to breaking library API changes and the complete removal of Flax/Jax support.
All support for Flax/Jax has been removed because there is only minimal support or adoption of it anywhere currently, and seemingly no work being done on it in the diffusers library. Also this alleviates quite a bit of dependency hell and possible issues caused by having torch and Flax/Jax in the same package as dependencies.
-
Support for Flux in
txt2img
mode, add associated options:--flux-second-prompts
,--flux-max-sequence-length
. Single file loads from a.safetensor
file is partially supported for Flux, you must specify the VAE and Text Encoders manually. -
Add Flux support to
sd-embed
prompt weighter internal plugin, prompt weighting syntax can be used with Flux when--prompt-weighter sd-embed
is specified. -
New Console UI recipes for Flux that are optimized by default to run (slowly) on even old hardware or GPUs with less than 12gb of VRAM.
-
Stable Diffusion 3 now supports per LoRA scale values.
-
The option
--lora-fuse-scale
has been added to control the LoRA scale once all LoRA models have been fused together at their individual scale values. This controls at what scale the merged LoRA weights are fused into the main model, these weights possibly being merged from multiple LoRA models at different individual scales. -
Support loading a transformer model for new diffusion architectures based on transformer architecture (SD3 and Flux) via the argument
--transformer
, this new option is nearly identical to--unet/--unet2
. Transformers can be quantized via thequantize
URI argument usingoptimum.quanto
. The quantize argument accepts a string value which is the datatype for quantization, for exampleqint8
,qfloat8
, etc. Acceptable values are listed in the--help
text of the--transformer
argument. -
Text encoders specified with
--text-encoders/--text-encoders2
can now be quantized via thequantize
URI argument usingoptimum.quanto
. Acceptable values are listed in the--help
text of the--text-encoders
argument. -
Support loading multiple IP Adapter models with
--ip-adapters
. -
Support loading an image encoder with
--image-encoder
for use with IP Adapters and Stable Cascade. -
New
--image-seeds
syntax for specifying IP Adapter images, see: Specifying IP Adapters -
Support loading multiple T2I Adapter models with
--t2i-adapters
, T2I Adapters function identically to Control Nets in terms of image input specification with--image-seeds
. They are essentially another form of control guidance model, and support Open Pose / Depth inputs etc. similar to Control Nets. T2I Adapters are a bit less resource intensive, but do not currently supportimg2img
orinpainting
, onlytxt2img
. -
Support image input batching for
img2img
andinpainting
mask images, allowing multiple input images to be processed on the GPU at once. New--image-seeds
syntax feature added to support this, see: Batching Input Images and Inpaint Masks -
--seed-image-processors
and--mask-image-processors
now support the + syntax previously supported by--control-image-processors
in order to allow for selective processing of input images when multipleimg2img
orinpaint
masks are specified. This is covered in the Image Processors section: Multiple control net images, and input image batching -
Added the
resize
image processor which implements basic image resizing using the usual resampling algorithms in Pillow. This can be useful for resizing input images to Stable Cascade when multiple are provided, as there is not a mechanism to do so from--image-seeds
-
Stable Cascade can now use the new input batching syntax of
--image-seeds
to process multiple input images as a style reference, Stable Cascade does not use multiple images for batching like other pipelines, but as image prompts. -
Improved
--help
output formatting and readability fordgenerate
anddgenerate --sub-command image-process
-
torch 2.4.0 and diffusers 0.30.0
v4.0.2 (Flux, IP Adapters, T2I Adapters, Input Batching)
v4.0.2 release with Windows installer.
Due to the size of the packaged python environment, the installer is within a multi-part zip file.
The multipart zip can be extracted using 7-Zip: https://www.7-zip.org/
Download both dgenerate_installer.zip.001
and dgenerate_installer.zip.002
to a folder.
Unzip dgenerate_installer.zip.001
to a directory (Right click, 7-Zip -> Extract to "dgenerate_installer") and then run dgenerate_installer\dgenerate.msi
to install.
dgenerate will be installed under C:\Program Files\dgenerate
by default with an isolated python environment provided.
The install directory will be added to PATH, and dgenerate will be available from the command line.
Portable Install
A portable install is provided via dgenerate_portable.zip.001
and dgenerate_portable.zip.002
, these contain
nothing but the dgenerate executable and a frozen python environment which can be placed anywhere.
4.0.2 Patch Fix
Add the arguments --flux-second-prompts
, --flux-max-sequence-length
, and --lora-fuse-scale
to the argument
reconstruction used by --output-configs
and --output-metadata
. These arguments were not being replicated in config output.
4.0.0 Features
The command line interface remains backwards compatible for all supported model types, the major version change is mostly due to breaking library API changes and the complete removal of Flax/Jax support.
All support for Flax/Jax has been removed because there is only minimal support or adoption of it anywhere currently, and seemingly no work being done on it in the diffusers library. Also this alleviates quite a bit of dependency hell and possible issues caused by having torch and Flax/Jax in the same package as dependencies.
-
Support for Flux in
txt2img
mode, add associated options:--flux-second-prompts
,--flux-max-sequence-length
. Single file loads from a.safetensor
file is partially supported for Flux, you must specify the VAE and Text Encoders manually. -
Add Flux support to
sd-embed
prompt weighter internal plugin, prompt weighting syntax can be used with Flux when--prompt-weighter sd-embed
is specified. -
New Console UI recipes for Flux that are optimized by default to run (slowly) on even old hardware or GPUs with less than 12gb of VRAM.
-
Stable Diffusion 3 now supports per LoRA scale values.
-
The option
--lora-fuse-scale
has been added to control the LoRA scale once all LoRA models have been fused together at their individual scale values. This controls at what scale the merged LoRA weights are fused into the main model, these weights possibly being merged from multiple LoRA models at different individual scales. -
Support loading a transformer model for new diffusion architectures based on transformer architecture (SD3 and Flux) via the argument
--transformer
, this new option is nearly identical to--unet/--unet2
. Transformers can be quantized via thequantize
URI argument usingoptimum.quanto
. The quantize argument accepts a string value which is the datatype for quantization, for exampleqint8
,qfloat8
, etc. Acceptable values are listed in the--help
text of the--transformer
argument. -
Text encoders specified with
--text-encoders/--text-encoders2
can now be quantized via thequantize
URI argument usingoptimum.quanto
. Acceptable values are listed in the--help
text of the--text-encoders
argument. -
Support loading multiple IP Adapter models with
--ip-adapters
. -
Support loading an image encoder with
--image-encoder
for use with IP Adapters and Stable Cascade. -
New
--image-seeds
syntax for specifying IP Adapter images, see: Specifying IP Adapters -
Support loading multiple T2I Adapter models with
--t2i-adapters
, T2I Adapters function identically to Control Nets in terms of image input specification with--image-seeds
. They are essentially another form of control guidance model, and support Open Pose / Depth inputs etc. similar to Control Nets. T2I Adapters are a bit less resource intensive, but do not currently supportimg2img
orinpainting
, onlytxt2img
. -
Support image input batching for
img2img
andinpainting
mask images, allowing multiple input images to be processed on the GPU at once. New--image-seeds
syntax feature added to support this, see: Batching Input Images and Inpaint Masks -
--seed-image-processors
and--mask-image-processors
now support the + syntax previously supported by--control-image-processors
in order to allow for selective processing of input images when multipleimg2img
orinpaint
masks are specified. This is covered in the Image Processors section: Multiple control net images, and input image batching -
Added the
resize
image processor which implements basic image resizing using the usual resampling algorithms in Pillow. This can be useful for resizing input images to Stable Cascade when multiple are provided, as there is not a mechanism to do so from--image-seeds
-
Stable Cascade can now use the new input batching syntax of
--image-seeds
to process multiple input images as a style reference, Stable Cascade does not use multiple images for batching like other pipelines, but as image prompts. -
Improved
--help
output formatting and readability fordgenerate
anddgenerate --sub-command image-process
-
torch 2.4.0 and diffusers 0.30.0
v4.0.1 (Flux, IP Adapters, T2I Adapters, Input Batching)
v4.0.1 release with Windows installer.
Due to the size of the packaged python environment, the installer is within a multi-part zip file.
The multipart zip can be extracted using 7-Zip: https://www.7-zip.org/
Download both dgenerate_installer.zip.001
and dgenerate_installer.zip.002
to a folder.
Unzip dgenerate_installer.zip.001
to a directory (Right click, 7-Zip -> Extract to "dgenerate_installer") and then run dgenerate_installer\dgenerate.msi
to install.
dgenerate will be installed under C:\Program Files\dgenerate
by default with an isolated python environment provided.
The install directory will be added to PATH, and dgenerate will be available from the command line.
Portable Install
A portable install is provided via dgenerate_portable.zip.001
and dgenerate_portable.zip.002
, these contain
nothing but the dgenerate executable and a frozen python environment which can be placed anywhere.
4.0.1 Patch Fix
Add missing VAE tiling checkbox for Flux recipes in Console UI recipe form.
4.0.0 Features
The command line interface remains backwards compatible for all supported model types, the major version change is mostly due to breaking library API changes and the complete removal of Flax/Jax support.
All support for Flax/Jax has been removed because there is only minimal support or adoption of it anywhere currently, and seemingly no work being done on it in the diffusers library. Also this alleviates quite a bit of dependency hell and possible issues caused by having torch and Flax/Jax in the same package as dependencies.
-
Support for Flux in
txt2img
mode, add associated options:--flux-second-prompts
,--flux-max-sequence-length
. Single file loads from a.safetensor
file is partially supported for Flux, you must specify the VAE and Text Encoders manually. -
Add Flux support to
sd-embed
prompt weighter internal plugin, prompt weighting syntax can be used with Flux when--prompt-weighter sd-embed
is specified. -
New Console UI recipes for Flux that are optimized by default to run (slowly) on even old hardware or GPUs with less than 12gb of VRAM.
-
Stable Diffusion 3 now supports per LoRA scale values.
-
The option
--lora-fuse-scale
has been added to control the LoRA scale once all LoRA models have been fused together at their individual scale values. This controls at what scale the merged LoRA weights are fused into the main model, these weights possibly being merged from multiple LoRA models at different individual scales. -
Support loading a transformer model for new diffusion architectures based on transformer architecture (SD3 and Flux) via the argument
--transformer
, this new option is nearly identical to--unet/--unet2
. Transformers can be quantized via thequantize
URI argument usingoptimum.quanto
. The quantize argument accepts a string value which is the datatype for quantization, for exampleqint8
,qfloat8
, etc. Acceptable values are listed in the--help
text of the--transformer
argument. -
Text encoders specified with
--text-encoders/--text-encoders2
can now be quantized via thequantize
URI argument usingoptimum.quanto
. Acceptable values are listed in the--help
text of the--text-encoders
argument. -
Support loading multiple IP Adapter models with
--ip-adapters
. -
Support loading an image encoder with
--image-encoder
for use with IP Adapters and Stable Cascade. -
New
--image-seeds
syntax for specifying IP Adapter images, see: Specifying IP Adapters -
Support loading multiple T2I Adapter models with
--t2i-adapters
, T2I Adapters function identically to Control Nets in terms of image input specification with--image-seeds
. They are essentially another form of control guidance model, and support Open Pose / Depth inputs etc. similar to Control Nets. T2I Adapters are a bit less resource intensive, but do not currently supportimg2img
orinpainting
, onlytxt2img
. -
Support image input batching for
img2img
andinpainting
mask images, allowing multiple input images to be processed on the GPU at once. New--image-seeds
syntax feature added to support this, see: Batching Input Images and Inpaint Masks -
--seed-image-processors
and--mask-image-processors
now support the + syntax previously supported by--control-image-processors
in order to allow for selective processing of input images when multipleimg2img
orinpaint
masks are specified. This is covered in the Image Processors section: Multiple control net images, and input image batching -
Added the
resize
image processor which implements basic image resizing using the usual resampling algorithms in Pillow. This can be useful for resizing input images to Stable Cascade when multiple are provided, as there is not a mechanism to do so from--image-seeds
-
Stable Cascade can now use the new input batching syntax of
--image-seeds
to process multiple input images as a style reference, Stable Cascade does not use multiple images for batching like other pipelines, but as image prompts. -
Improved
--help
output formatting and readability fordgenerate
anddgenerate --sub-command image-process
-
torch 2.4.0 and diffusers 0.30.0
v3.10.4 Console Stability Fixes
v3.10.4 release with Windows installer.
Due to the size of the packaged python environment, the installer is within a multi-part zip file.
The multipart zip can be extracted using 7-Zip: https://www.7-zip.org/
Download both dgenerate_installer.zip.001
and dgenerate_installer.zip.002
to a folder.
Unzip dgenerate_installer.zip.001
to a directory (Right click, 7-Zip -> Extract to "dgenerate_installer") and then run dgenerate_installer\dgenerate.msi
to install.
dgenerate will be installed under C:\Program Files\dgenerate
by default with an isolated python environment provided.
The install directory will be added to PATH, and dgenerate will be available from the command line.
Portable Install
A portable install is provided via dgenerate_portable.zip.001
and dgenerate_portable.zip.002
, these contain
nothing but the dgenerate executable and a frozen python environment which can be placed anywhere.
v3.10.4 Patch Fix
Backport console shell process monitor from t2iadapter (4.0.0) branch.
This solves a console GUI hang when \exit
is used or when the shell process exits unexpectedly on its own.
v3.10.1 Features & Fixes
v3.10.3 release (Console UI broken stdin pipe fix)
v3.10.3 release with Windows installer.
Due to the size of the packaged python environment, the installer is within a multi-part zip file.
The multipart zip can be extracted using 7-Zip: https://www.7-zip.org/
Download both dgenerate_installer.zip.001
and dgenerate_installer.zip.002
to a folder.
Unzip dgenerate_installer.zip.001
to a directory (Right click, 7-Zip -> Extract to "dgenerate_installer") and then run dgenerate_installer\dgenerate.msi
to install.
dgenerate will be installed under C:\Program Files\dgenerate
by default with an isolated python environment provided.
The install directory will be added to PATH, and dgenerate will be available from the command line.
Portable Install
A portable install is provided via dgenerate_portable.zip.001
and dgenerate_portable.zip.002
, these contain
nothing but the dgenerate executable and a frozen python environment which can be placed anywhere.
v3.10.3 Patch Fix
The stdin buffer of the interpreter process in the Console UI could be easily flooded by running many commands one after another which do not execute quickly, for example, queuing up multiple diffusion or image processing commands in terminal mode.
This could have also happened with large commands, such as when pulling up a long script from the consoles history and accidentally running it twice in short succession :)
On windows the stdin buffer of a process is fairly small, and filling it up results in a broken pipe followed by a deadlock in the Console UI.
This is resolved by using a write thread, a non-blocking fifo queue, and a pre-created pipe.
The console will now warn you if the command / write fifo queue is full, and will not accept new input if the pipe being read by the interpreter process cannot accept any more data.
The maximum size of this fifo queue is 50 entries, you should not see this warning unless you are really trying to :)
v3.10.1 Features & Fixes
v3.10.2 release (Download directive caching fix)
v3.10.2 release with Windows installer.
Due to the size of the packaged python environment, the installer is within a multi-part zip file.
The multipart zip can be extracted using 7-Zip: https://www.7-zip.org/
Download both dgenerate_installer.zip.001
and dgenerate_installer.zip.002
to a folder.
Unzip dgenerate_installer.zip.001
to a directory (Right click, 7-Zip -> Extract to "dgenerate_installer") and then run dgenerate_installer\dgenerate.msi
to install.
dgenerate will be installed under C:\Program Files\dgenerate
by default with an isolated python environment provided.
The install directory will be added to PATH, and dgenerate will be available from the command line.
Portable Install
A portable install is provided via dgenerate_portable.zip.001
and dgenerate_portable.zip.002
, these contain
nothing but the dgenerate executable and a frozen python environment which can be placed anywhere.
v3.10.2 Patch Fix
The \download
directive and download()
template function now use the webcache database to store information about the paths of files downloaded to arbitrary locations on disk (not inside the cache folder). This removes the need to make a request to the URL to figure out the filename that is going to be served if the file has already been downloaded before to an arbitrary directory. At least up until the pointer file has expired in the cache.
This uses a pointer file in the webcache that undergoes normal cache expiry using the settings mentioned here in the readme: File Cache Control
This greatly improves the speed of the directive when the file it is trying to download already exists in the output location that you have defined, and is much nicer on servers than requesting the filename every time.
v3.10.1 Features & Fixes
v3.10.1 release (Generic NCNN Upscaler)
v3.10.1 release with Windows installer.
Due to the size of the packaged python environment, the installer is within a multi-part zip file.
The multipart zip can be extracted using 7-Zip: https://www.7-zip.org/
Download both dgenerate_installer.zip.001
and dgenerate_installer.zip.002
to a folder.
Unzip dgenerate_installer.zip.001
to a directory (Right click, 7-Zip -> Extract to "dgenerate_installer") and then run dgenerate_installer\dgenerate.msi
to install.
dgenerate will be installed under C:\Program Files\dgenerate
by default with an isolated python environment provided.
The install directory will be added to PATH, and dgenerate will be available from the command line.
Portable Install
A portable install is provided via dgenerate_portable.zip.001
and dgenerate_portable.zip.002
, these contain
nothing but the dgenerate executable and a frozen python environment which can be placed anywhere.
v3.10.1 Features & Fixes
1.) Generic NCNN upscaler
ncnn
has been added as a package extra. When ncnn
is installed, the new image processor upscaler-ncnn
is available for generic upscaling using NCNN, and should work with models converted from ONNX format. This is included by default in the Windows installer / portable install environment that is attached to each release.
This upscaler supports tiling just as the normal upscaler
image processor does, and essentially the same options in terms of tiling with slightly different defaults.
It does not use the device
argument, but instead a combination of use-gpu=True
and gpu-index=N
for enabling Vulkan accelerated GPU use on a specific GPU.
By default this processor runs on the CPU.
This is because the Vulkan allocator conflicts heavily with the torch CUDA allocator used for diffusion and other image processors when they are placed on the on the same GPU, and having both allocators on the same GPU can cause hard system lockups.
You can safely use this upscaler at the same time as torch based models by running it on another GPU that torch is not going to be using.
Once you have used this processor, be aware that the process will always exit with a non-zero return code, this is due to being unable to clean up the GPU context and certain ncnn
objects properly through ncnn
python bindings before the process shuts down. It will technically create an access violation / segfault inside ncnn
, I am not sure what bad behaviors this will cause on Linux, but on Windows the process exits with no side effects or hang ups other than a non-zero return code.
See: dgenerate --image-processor-help upscaler-ncnn
And also: Upscaling With NCNN Upscaler Models in the readme.
2.) Memory Management
Image processors now have size estimates which are used as a heuristic for clearing out CPU side memory belonging to the diffusion model cache, prior to them being loaded into memory. This should help prevent avoidable out of memory conditions due to an image processor model loading when the diffusion model cache is using most of the systems memory.
This size estimate is also used as a heuristic for freeing up VRAM, particularly the last called diffusion pipeline if it currently is still in VRAM.
If an image processor still runs out of memory, due to its actual execution allocating large amounts of VRAM, it will attempt to free memory and then try again, if an OOM occurs on the second try then the OOM is raised.
Diffusion invocations will now attempt to clear memory and try again in the same fashion for CUDA out of memory errors, but not for CPU side out of memory errors, which are already more easily prevented by the heuristics that are already in place.
The main current enemy of this application running for long periods of time is VRAM fragmentation, which is not avoidable with the default CUDA allocator.
The example runner script in the examples folder has been rewritten to isolate each top level folder in the examples directory to a subprocess when not running with the --subprocess-only
flag.
The only way to clear out the memory fragmentation after running so many models of different sizes is to end the process, so each directory is isolated to a sub process to take advantage of dgenerates caching behaviors for the directory, but to avoid excessive memory fragmentation by isolating a medium sized chunk of examples to a process.
There is also now an option --torch-debug
in the run.py
script which if enabled will try to dump information about objects stuck in VRAM after an OOM condition, and generate a Graphviz graph of possible reference cycles. Currently I cannot find any evidence of anything sticking around after dgenerate tries to clean up VRAM.
dgenerate now sets a PYTORCH_CUDA_ALLOC_CONF
value max_split_size_mb
of 512
before importing torch.
It also sets PYTORCH_CUDA_LAUNCH_BLOCKING
to 0
by default.
These can be overridden in your environment.
3. Fetch CivitAI model links with --sub-command civitai-links
CivitAI has made a change to their website UI (*had some sort of outage) which renders right click copying of direct API links to models no longer possible.
I have written a dgenerate sub-command that can fetch API hard links to CivitAI models on a model page and display them to you next to their model titles.
The links that this command generates can be given directly to dgenerate, or used with the \download
directive in order to download the model from CivitAI.
You can use dgenerate --sub-command civitai-links https://civitai.com/models/4384/dreamshaper
for example to list all available model links for that model using the CivitAI API.
You can use the --token
argument of the sub-command to append an API token to the generated links, which is sometimes needed for downloading specific models.
You can also use this sub-command as the directive \civitai_links
in a config / shell mode or the Console UI.
See: dgenerate --sub-command civitai-links --help
, or \civitai_links --help
from a config / shell mode or the Console UI.
4. Config / Shell - Environmental Variable Manipulation
You can now use the directives \env
and \unset_env
to manipulate environmental variables.
# using with no args prints the entire environment
\env
# you can set multiple environmental variables at once
\env MY_ENV_VAR=1 MY_ENV_VAR2=2
# undefine them in the same manner
\unset_env MY_ENV_VAR MY_ENV_VAR2
See: dgenerate --directives-help env unset_env
5.) Config / Shell - Indirect Assignment
The config / shell language that is built into dgenerate now supports indirect assignment.
You can use a basic template expansion or environmental variable expansion to select the name of a template variable.
This now works for \set
, \sete
, \setp
, and \env
.
It also works for \unset
and \unset_env
All other directives which accepted a variable name already supported this.
\set var_name foo
\set {{ var_name }} bar
# prints bar
\print {{ foo }}
\env VAR_NAME=BAZ
\env $VAR_NAME=qux
# prints qux
\print $BAZ
6.) Config / Shell - Feature Flags and Platform Detection
The config template functions have_feature(feature_name)
and platform()
have been added.
# have_feature returns bool
# Do we have Flax/Jax?
\print {{ have_feature('flax') }}
# Do we have NCNN?
\print {{ have_feature('ncnn') }}
# platform() returns platform.system() string from pythons platform module
# prints: Windows, Linux, or Darwin. etc...
\print {{ platform() }}
7.) Exception handing fixes in dgenerate.invoker
The methods in this library module were only capable of throwing dgenerate.DgenerateUsageError
when they should have been throwing more fine grained error types when requested to do so with throw=True
.
8.) Config / Shell - Parsing fixes
Streaming heredoc templates discarded newlines from the end of the jinja stream chunks, resulting in hard to notice issues with jinja control structures used as top level templates, mostly when the result of the heredoc template was being interpreted by the shell.
9.) Image processor library API improvements
Image processors will now throw when you pass a PIL image that possesses a mode value that the processor can not understand.
Currently, all image processors only understand RGB
images.
10.) Console UI updates
Removed antiquated recipes related to image upscaling in favor of Generic Image Process
and Generic Image Process (to directory)
From the generic image process recipes you can just select the upscaler
or upscaler-ncnn
processor from a drop down and fill out its parameters to preform upscaling.
All image processors now expose parameters provided by their base class in the UI, such as device
, output-file
, output-overwrite
, and model-offload
.
This allows the ability to select a debug image output location with a file select dialog. This is useful if you are trying to use an image processor as a pre-processor for diffusion and need to see the image that is being passed to diffusion for debugging purposes.
The device
argument is hidden in the UI where not applicable, such as the Generic Image Process
recipes where the UI selects the device for the whole command instead of via an image processor URI argument.
The device
URI argument for image processors is available when selecting pre / post processors for AI image generation from the UI as well as when using the Insert Image Processor URI
edit feature.
You can now specify the frame-start
and frame-end
...
v3.9.3 release (Prompt Weighting!)
v3.9.3 release with Windows installer.
Due to the size of the packaged python environment, the installer is within a multi-part zip file.
The multipart zip can be extracted using 7-Zip: https://www.7-zip.org/
Download both dgenerate_installer.zip.001
and dgenerate_installer.zip.002
to a folder.
Unzip dgenerate_installer.zip.001
to a directory (Right click, 7-Zip -> Extract to "dgenerate_installer") and then run dgenerate_installer\dgenerate.msi
to install.
dgenerate will be installed under C:\Program Files\dgenerate
by default with an isolated python environment provided.
The install directory will be added to PATH, and dgenerate will be available from the command line.
Portable Install
A portable install is provided via dgenerate_portable.zip.001
and dgenerate_portable.zip.002
, these contain
nothing but the dgenerate executable and a frozen python environment which can be placed anywhere.
3.9.3 Patch Fix
Fix unquoted $HF_TOKEN
value in Stable Diffusion 3 and DeepFloyd console UI recipe templates, causing issues
with the \setp
directive used in the template. Needed to have quotes around $HF_TOKEN
in the template due
to changes in how and when the template renderer decides to automatically shell quote a form value.
Fix syntax highlighter failing to immediately re-highlight after Undo/Redo, Cut/Paste, Delete operations
preformed from the UI menus without using hotkeys. Syntax highlighting would not resume until the next
keypress, temporarily displaying unhighlighted text.
Documentation typo fix for letterbox
image processor.
3.9.0 Features & Fixes
1.) Prompt weighting
Stable Diffusion Web UI / CivitAI / ComfyUI / InvokeAI style prompt weighting syntax is now implemented
through the argument --prompt-weighter
and a new plugin class PromptWeighter
.
This argument allows selecting a specific prompt weighter plugin to preform prompt parsing, token weighting, and prompt embed generation.
Prompt weighters circumvent restrictions on prompt length, which is typically 77
tokens.
Currently there are two prompt weighters implemented, compel
and sd-embed
.
Their documentation can be seen with: dgenerate --prompt-weighter-help compel sd-embed
The compel
prompt weighter plugin uses the compel library to support InvokeAI style prompt weighting syntax, and also supports automatically translating your prompt from Stable Diffusion Web UI syntax into compel
syntax via the plugin argument syntax=sdwui
.
The compel
prompt weighter supports Stable Diffusion 1/2, and Stable Diffusion XL model types:
--model-type torch
--model-type torch-pix2pix
--model-type torch-upscaler-x4
--model-type torch-sdxl
--model-type torch-sdxl-pix2pix
The sd-embed
prompt weighter uses the sd_embed library to support Stable Diffusion Web UI / CivitAI / ComfyUI prompt weighting syntax. This prompt weighter is currently using code from a fork I have VRAM optimized, found here
The sd-embed
prompt weighter supports Stable Diffusion 1/2, Stable Diffusion XL, and Stable Diffusion 3 model types:
--model-type torch
--model-type torch-pix2pix
--model-type torch-upscaler-x4
--model-type torch-sdxl
--model-type torch-sdxl-pix2pix
--model-type torch-sd3
For more information about prompt weighting with dgenerate, see: Prompt Weighting and Enhancement in the readme.
2.) Prompt length warnings
Warn the user about prompt truncation when not using a --prompt-weighter
implementation, this will warn you when your prompt is too long for the models tokenizer max sequence length. If you get this warning you should select a --prompt-weighter
implementation, or reduce the length of your prompt.
3.) New image processors & image processor fixes
Implemented new image processors:
anyline
(MistoLine Control Any Line preprocessor, see: https://huggingface.co/TheMistoAI/MistoLine)lineart-standard
(Basic non model based variant of lineart / lineart-anime)teed
(TEED tiny efficient edge detector)zoe
(ZoeDepth depth detector)
Fixed an issue with the detect-resolution
argument of various image processors not returning the image to its original size
after detection was preformed.
4.) Improved extensibility
All plugin types implemented by dgenerate can now be loaded through --plugin-modules
, and \import_plugins
inside config scripts.
Previously only image processors, config directives, and config template functions supported external extensibility, in a hard coded manner internally. Now sub-commands and prompt weighters can be written as external plugins as well.
An architecture change has been made so that going forward any plugin loader class can automatically discover classes through --plugin-modules
and \import_plugins
without any extra work having to be done internally to support it.
New plugin code examples for sub-commands and prompt weighters can be found in the writing_plugins examples folder
5.) Improved argument validation
Better argument validation when using plugin help arguments such as --image-processor-help
etc.. this corrects the problem
of the CLI allowing you to mistype something such as dgenerate --plugin-paths plugin.py --image-processor-help my-processor
, resulting in your plugin not being listed because the correct command is infact:
dgenerate --plugin-modules plugin.py --image-processor-help my-processor
Previously the only validated argument was the plugin help argument, with all unknown arguments being ignored. Now when one of these arguments is encountered, the other arguments are validated, meaning it will raise an error on --plugin-paths
for example as that is not a valid argument name.
6.) New template functions for image dimension manipulation
Added config template functions align_size
, pow2_size
, size_is_aligned
, and size_is_pow2
for checking and adjusting the alignment of image dimension values inside of config scripts.
See: dgenerate --functions-help align_size pow2_size size_is_aligned size_is_pow2
for their documentation.
Or: \functions_help align_size pow2_size size_is_aligned size_is_pow2
if you are working with a config file or the Console UI.
7.) Console UI, insert recipe form overhaul
The insert recipe form now scrolls to support more form fields, and now supports selecting image processor implementations by name where applicable.
Image processor selection includes dynamic form controls for specifying image processor argument values, and a help button that you can click to show the documentation for the selected image processor.
The insert recipe form can now be used to select dgenerate
argument values for --post-processors
, --seed-image-processors
, --control-image-processors
, and --mask-image-processors
using this new feature.
Two new recipes named Generic Image Process
and Generic Image Process (to directory)
have been added which make use of this feature to build an \image_process
directive that can be inserted into your config.
There have been many other changes to the insert recipe form, including additional fields / access to more options, toggles, drastically improved input validation, and the ability to select a file OR directory for applicable model arguments.
8.) Console UI, new insert / build URI options
Two new URI insertion features have been added to the Console UI.
Using Edit -> Insert Image Seed URI
will allow you to use a form with file select dialogs to build an --image-seeds
URI, you can specify each component of the URI (seed image, inpaint mask, control image) and a URI with proper syntax will be formatted for you and inserted into the config. You may also specify the per image-seed resize
& and aspect
correct resize argument values (the default value for aspect correct resizing is True
)
Using Edit -> Insert Image Processor URI
will allow you to insert an image processor URI in a similar fashion to inserting a Karras Scheduler URI (a previously existing feature).
A form is generated based on the selected image processors arguments.
Inserting with this form will insert an Image Processor URI formatted with all the provided arguments.
9.) Console UI, version info / latest version check
The Console UI now shows the current software version next to the Help -> Homepage
menu item.
If you are connected to the internet upon launch and github is reachable, a check for the latest release will occur,
if there is a newer release, a link to it will be added to the bottom section of the Help
menu.
It will be in the format Newer Release Available! (vX.X.X)
, and clicking it will open your web browser to the page
for the latest release on github.
This way you can check if there is a software update available from the UI.
10.) Image generation improvements.
Stable Cascade can now produce images with output dimensions aligned to 128
instead of only power of 2 images.
Stable Diffusion 3 can now preform VAE tiling --vae-tiling
on images with output dimensions aligned to 16
instead of only power of 2 images.
11.) Bugfix model loading from directories
Fix bug in determining diffusers model loading method, which caused loading diffusers models out of directories to stop working.
12.) Dependency updates
Diffusers: 0.29.2
controlnet_aux: 0.0.9
No longer vendoring most of controlnet_aux
, only vendoring the PidiNet
detector for a bugfix which...
v3.9.2 release (Prompt Weighting!)
v3.9.2 release with Windows installer.
Due to the size of the packaged python environment, the installer is within a multi-part zip file.
The multipart zip can be extracted using 7-Zip: https://www.7-zip.org/
Download both dgenerate_installer.zip.001
and dgenerate_installer.zip.002
to a folder.
Unzip dgenerate_installer.zip.001
to a directory (Right click, 7-Zip -> Extract to "dgenerate_installer") and then run dgenerate_installer\dgenerate.msi
to install.
dgenerate will be installed under C:\Program Files\dgenerate
by default with an isolated python environment provided.
The install directory will be added to PATH, and dgenerate will be available from the command line.
Portable Install
A portable install is provided via dgenerate_portable.zip.001
and dgenerate_portable.zip.002
, these contain
nothing but the dgenerate executable and a frozen python environment which can be placed anywhere.
3.9.2 Patch Fix
Handle out of memory conditions for pipelines / image processors / and prompt weighters more thoroughly.
Preform memory cleanup as best as possible so that dgenerate can continue to run in REPL mode without
VRAM memory leaks after an OOM condition occurs.
And a few documentation additions and corrections.
3.9.0 Features & Fixes
1.) Prompt weighting
Stable Diffusion Web UI / CivitAI / ComfyUI / InvokeAI style prompt weighting syntax is now implemented
through the argument --prompt-weighter
and a new plugin class PromptWeighter
.
This argument allows selecting a specific prompt weighter plugin to preform prompt parsing, token weighting, and prompt embed generation.
Prompt weighters circumvent restrictions on prompt length, which is typically 77
tokens.
Currently there are two prompt weighters implemented, compel
and sd-embed
.
Their documentation can be seen with: dgenerate --prompt-weighter-help compel sd-embed
The compel
prompt weighter plugin uses the compel library to support InvokeAI style prompt weighting syntax, and also supports automatically translating your prompt from Stable Diffusion Web UI syntax into compel
syntax via the plugin argument syntax=sdwui
.
The compel
prompt weighter supports Stable Diffusion 1/2, and Stable Diffusion XL model types:
--model-type torch
--model-type torch-pix2pix
--model-type torch-upscaler-x4
--model-type torch-sdxl
--model-type torch-sdxl-pix2pix
The sd-embed
prompt weighter uses the sd_embed library to support Stable Diffusion Web UI / CivitAI / ComfyUI prompt weighting syntax. This prompt weighter is currently using code from a fork I have VRAM optimized, found here
The sd-embed
prompt weighter supports Stable Diffusion 1/2, Stable Diffusion XL, and Stable Diffusion 3 model types:
--model-type torch
--model-type torch-pix2pix
--model-type torch-upscaler-x4
--model-type torch-sdxl
--model-type torch-sdxl-pix2pix
--model-type torch-sd3
For more information about prompt weighting with dgenerate, see: Prompt Weighting and Enhancement in the readme.
2.) Prompt length warnings
Warn the user about prompt truncation when not using a --prompt-weighter
implementation, this will warn you when your prompt is too long for the models tokenizer max sequence length. If you get this warning you should select a --prompt-weighter
implementation, or reduce the length of your prompt.
3.) New image processors & image processor fixes
Implemented new image processors:
anyline
(MistoLine Control Any Line preprocessor, see: https://huggingface.co/TheMistoAI/MistoLine)lineart-standard
(Basic non model based variant of lineart / lineart-anime)teed
(TEED tiny efficient edge detector)zoe
(ZoeDepth depth detector)
Fixed an issue with the detect-resolution
argument of various image processors not returning the image to its original size
after detection was preformed.
4.) Improved extensibility
All plugin types implemented by dgenerate can now be loaded through --plugin-modules
, and \import_plugins
inside config scripts.
Previously only image processors, config directives, and config template functions supported external extensibility, in a hard coded manner internally. Now sub-commands and prompt weighters can be written as external plugins as well.
An architecture change has been made so that going forward any plugin loader class can automatically discover classes through --plugin-modules
and \import_plugins
without any extra work having to be done internally to support it.
New plugin code examples for sub-commands and prompt weighters can be found in the writing_plugins examples folder
5.) Improved argument validation
Better argument validation when using plugin help arguments such as --image-processor-help
etc.. this corrects the problem
of the CLI allowing you to mistype something such as dgenerate --plugin-paths plugin.py --image-processor-help my-processor
, resulting in your plugin not being listed because the correct command is infact:
dgenerate --plugin-modules plugin.py --image-processor-help my-processor
Previously the only validated argument was the plugin help argument, with all unknown arguments being ignored. Now when one of these arguments is encountered, the other arguments are validated, meaning it will raise an error on --plugin-paths
for example as that is not a valid argument name.
6.) New template functions for image dimension manipulation
Added config template functions align_size
, pow2_size
, size_is_aligned
, and size_is_pow2
for checking and adjusting the alignment of image dimension values inside of config scripts.
See: dgenerate --functions-help align_size pow2_size size_is_aligned size_is_pow2
for their documentation.
Or: \functions_help align_size pow2_size size_is_aligned size_is_pow2
if you are working with a config file or the Console UI.
7.) Console UI, insert recipe form overhaul
The insert recipe form now scrolls to support more form fields, and now supports selecting image processor implementations by name where applicable.
Image processor selection includes dynamic form controls for specifying image processor argument values, and a help button that you can click to show the documentation for the selected image processor.
The insert recipe form can now be used to select dgenerate
argument values for --post-processors
, --seed-image-processors
, --control-image-processors
, and --mask-image-processors
using this new feature.
Two new recipes named Generic Image Process
and Generic Image Process (to directory)
have been added which make use of this feature to build an \image_process
directive that can be inserted into your config.
There have been many other changes to the insert recipe form, including additional fields / access to more options, toggles, drastically improved input validation, and the ability to select a file OR directory for applicable model arguments.
8.) Console UI, new insert / build URI options
Two new URI insertion features have been added to the Console UI.
Using Edit -> Insert Image Seed URI
will allow you to use a form with file select dialogs to build an --image-seeds
URI, you can specify each component of the URI (seed image, inpaint mask, control image) and a URI with proper syntax will be formatted for you and inserted into the config. You may also specify the per image-seed resize
& and aspect
correct resize argument values (the default value for aspect correct resizing is True
)
Using Edit -> Insert Image Processor URI
will allow you to insert an image processor URI in a similar fashion to inserting a Karras Scheduler URI (a previously existing feature).
A form is generated based on the selected image processors arguments.
Inserting with this form will insert an Image Processor URI formatted with all the provided arguments.
9.) Console UI, version info / latest version check
The Console UI now shows the current software version next to the Help -> Homepage
menu item.
If you are connected to the internet upon launch and github is reachable, a check for the latest release will occur,
if there is a newer release, a link to it will be added to the bottom section of the Help
menu.
It will be in the format Newer Release Available! (vX.X.X)
, and clicking it will open your web browser to the page
for the latest release on github.
This way you can check if there is a software update available from the UI.
10.) Image generation improvements.
Stable Cascade can now produce images with output dimensions aligned to 128
instead of only power of 2 images.
Stable Diffusion 3 can now preform VAE tiling --vae-tiling
on images with output dimensions aligned to 16
instead of only power of 2 images.
11.) Bugfix model loading from directories
Fix bug in determining diffusers model loading method, which caused loading diffusers models out of directories to stop working.
12.) Dependency updates
Diffusers: 0.29.2
controlnet_aux: 0.0.9
No longer vendoring most of controlnet_aux
, only vendoring the PidiNet
detector for a bugfix which allows it to run on
other GPUs besides GPU 0. See: huggingface/controlnet_aux#109
Known Issues
Diffusers
When auto downloading a ControlNet model using a https://huggingface.co/ model slug, such as `dif...