Change to how the prompt is concatenated with the interrogation. This will prevent excessive commas when concatenating prompt and interrogation like f"{prompt}, {interrogation}"
WD extension has the ability to rate interrogated images. This allows users to append that rating to the end of their preliminary WD interrogations so that SD might have a better understanding of the image.
- Pruned some emojis from experimental tool `no_punctuation_mode`.
- Changed the save button to red, to highlight the destructive capabilities of overwriting a file.
- Changed all `custom_filter` read/write functions to encode in `utf-8`
- Added print statements for finding and hooking to extensions.
**BASED ON PULL REQUEST #10**
Converted Script for AlwaysVisible Use.
- Changed to `process_batch` method.
- This should run even if only one image is in queue.
- Implemented a prompt cleaner for batch job p.prompt contamination.
- It resets when `job_no` is less than or equal to 0, as the start of a batch job is uncontaminated.
- Disabled all settings, to ensure user can operate without script, without needing to disable script, if they choose to
- Script requires user to select a model to ensure script runs during img2img job.
- `prompt_weight` is no longer on by default.
Experimental Tools:
- Implemented a verbose development mode, to output to console debugging prints
- Moved the `prompt_weight` into the experimental tools section.
- Implemented a tool to remove all punctuation from prompt, except for commas, `'s`, `...`. and a variety of emojis as `no_puncuation_mode`
- Added a toggle to the exaggeration filters, as `exaggeration_mode`
- Added a toggle to place interrogations in the negative prompt instead of the prompt (thought it would be interesting), as `reverse_mode`
Changes to Filter:
- Changed custom filter to be saved manually, instead of during runtime.
- Changed custom filter to encode as `UTF-8`, in the event that custom filter prompt includes unusual characters.
- Added a save confirmation.
Other Changes:
- p.init_images[0] is saved prior to conversion and reassigned after interrogation. This is to allow img2img or other scripts to handle the Alpha channel.
- Split the `prompt_weight_mode` from the `in_front` logic, so that they operate independently, allowing for contamination cleaner's interrogation collection at the end of a job.
Bug was introduced that caused extra "CLIP (EXT)" and "WD (EXT)" to be left out of the interrogation. This happened when user added multiple "CLIP (EXT)" or "WD (EXT)" models to the job, as their nested loops were overwriting the interrogation. Fixed by adding concatenation to all interrogator statements, instead of at the end of loop.
Fixed a known quirk with the model_selector, where the models "CLIP (EXT)" and "WD (EXT)" will still appear the first time users click on the model_selector drop down menu, even if the associated extensions are not installed or enabled.
- An bug was occurring that caused over exaggeration of tags. This notably happened when using the tagger models (WD and Deepbooru). Multiple models would coincidentally output the same tags, so the interrogations could have multiple instances of the same tag causing exaggeration of the tag. Fixed by making preliminary interrogations filter itself by the interrogation before adding to interrogation.
- An bug was occurring with the underscore remover. It would break underscore emojis that the WD tagger produced. Created a function to identify emoji patterns before determining if underscore should be replaced with a space.
- Added some documentation.
- Changed some UI wordings.
Major overhaul to this patch. I was unsatisfied with the performance and restraints that working through the API caused. So API has been removed in favor of direct extension interactions.
While the line `return scripts.AlwaysVisible if is_img2img else False` correctly makes the script always visible in the img2img tab, for some reason A1111 is not using the script. This requires further investigation and troubleshooting, however, the other features of this script patch is ready for use. So the AlwaysVisible feature is being rolled back while the other features are kept.
UI Changes:
- Made extension always visible on the img2img tab. This will allow for other scripts to be run alongside extension.
- Added triggers to determine if the script should run. Triggers are if a model is selected or if an image is present.
- Removed "Deepbooru (Native)" from being the default model, so that script is not active by default.
- Set `clip_api_mode` to "best" to better align with 'clip-interrogator-ext' defaults
Optimizations:
- Library declarations needed to be organized and cleaned of repetition.
- Script will no longer run if there is no image to interrogate, (I think that img2img probably should not run if there is no images anyways...)
The more I thought about unloading models after they are used, the more I liked it.
Anyways, my reasoning is that many systems might need the VRAM that the model uses up for the generation of their image. So it would be better to unload the WD model when it is not in use. CLIP model needs to be unloaded from the CLIP interrogator tab.
New API Interaction Suite:
-Added API awareness.
-Added Interaction Hooks for:
-CLIP Interrogator Ext ('clip-interrogator-ext')
-WD14 Tagger ('stable-diffusion-webui-wd14-tagger')
UI Overhaul:
-Clutter Cleanup, now unused options and sliders are hidden
-Changed the `up_front` checkbox to a radio.
-Created dynamically visible options accordion for:
-CLIP Interrogator Ext
-WD14 Tagger
-Users that do not have the API interrogators will not see the option to use them in the `model_selector`.
Bug Fixes:
-Replaced the backward slashes `\` with forward slashes `/` for better OS compatibility.
-Fixed some typos in the comments
Allows users to filter out content from the interrogation without having to put it in the prompt or negative prompt. This also allows users to reuse their custom filters from a previous run, allowing users to keep their filters through different sessions.
There are also some UI cleanup items. Such as moving the model select dropdown to the top of the UI, instead of being at the bottom. Changed "Deepbooru Tools" to "Filtering Tools" since it is being applied to CLIP too. I also changed my user name.
Enables script to run both of the natively supported interrogation models. Deepbooru and CLIP can now be run sequentially. The dropdown menu allows users to determine the order of interrogation models.
The default for interrogation model is set to Deepbooru, to maintain original operation.
Two new toggles to filter prompt content from interrogator prompt output.
1. Negative prompt content filtered from the interrogator prompt output (Removes contradictions from the prompt)
2. Prompt content filtered from the interrogator prompt output (Removes duplicates from the prompt)
Additional housekeeping change, Script.interrogator changed to interrogator, as Script.interrogator no longer exists.
Added a toggle to enable or disable the prompt weighting. Prompt weighting is enabled by default, which is the vanilla behavior.
I found that prompt weighting sometimes caused problems and thought that it would be nice if users could choose whether interrogator prompts were weighted or not.