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](https://github.com/damian0815/compel) to support [InvokeAI](https://github.com/invoke-ai/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](https://github.com/xhinker/sd_embed) 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](https://github.com/Teriks/sd_embed)
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](https://github.com/Teriks/dgenerate/tree/master?tab=readme-ov-file#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](https://github.com/Teriks/dgenerate/tree/master/examples/writing_plugins)
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