sd-webui-hires-fix-tweaks
sd-webui-hires-fix-tweaks copied to clipboard
Add additional options and features to hires fix of Stable Diffusion web UI
sd webui hires fix tweaks
Add additional options and features to hires fix for Stable Diffusion web UI

Features
-
Hires pass CFG scale
- Set a different CFG scale for hires pass
this is particularly useful if you're working with LCM, can also a achieve interesting effects
- Set a different CFG scale for hires pass
-
Hires Batch and Seed
- Generate multiple hires pass form first pass image
- Specify different seed for hires pass
-
Hires prompt mode and Remove First Pass Extra Networks
- Changes how the hires prompt is created based on the first pass prompt
Default: Webui default behavior:
if blank same as first pass else use hires promptAppend: Append hires prompt after first pass promptPrepend: Prepend hires prompt before first pass promptPrompt S/R: Prompt Search and Replace:
replace or insert first pass prompt with hires prompt
Remove First Pass Extra Networks: When check will remove extra networks from first pass prompt before creating hires prompt
-
Hires output directory
- Specify a different output directory for hires pass
Settings > Paths for saving > Output directory for hires. fix images
Remove First Pass Extra Networks
Remove First Pass Extra Networksoperates by removing all extra networks in prompt (every thin matching<xxxx:extra-network-name:weight>) in the first pass prompt, this means it only works withLoRAandHypernetworksand dose not work withTextual Inversion Embeddingsor if the extra networks are added by later by other means such asSettingorStyles.- As it only touches the first pass prompt it will not have an affect if
Hires prompt modeisDefaultand the hires prompt is not blank, as the user input hires prompt will take precedence. -
- The default behavior of the webui is If
hires prompt is not specfied (when blank)thenuse the same first pass prompt for hires passelseuse the user input hires prompt. if the first pass prompt is not use theRemove First Pass Extra Networkswill not have an affect. Usage case example:
- The default behavior of the webui is If
- You wish the hires prompt to be the same as the first pass prompt but without the extra networks
- Combining with other
Hires prompt modesuch asAppendto change the extra networks used during hires pass
Note: the
DefaultHires prompt mode has priority overRemove First Pass Extra Networks, in other words ifDefaultis selectedRemove First Pass Extra Networkswill be ignored if hires prompt is not blank
Prompt Search and Replace syntax
When in Prompt Search and Replace mode the first pass prompt will be used as the base template to perform a search and replace on to create the hires prompt.
the first pass can be any regular prompt, or you can insert @insert_marker@ anywhere in the prompt to indicate where the hires prompt should be inserted.
the @insert_marker@ will be removed from the prompt before image generation.
example first pass prompt
this is an example prompt @insert_marker@, and replace prompt some more replace with blank prompt,
prompt to
replace can be
multil-ine
like so
the hires prompt is used as instructions for the search and replace
each instruction is entry starts with a key_word enclosed by @ at the start of the line, everything after this until the next @key_word@ is the replacement or inserted prompt
Example hires prompt (instructions)
@insert_marker@ insert something here
@replace prompt@ replace something here
@replace with blank@
@can be
multil-ine@replacement can
be multi-line
-
@insert_marker@exists in the prompt it will perform insert modeinsert something herewill be inserted in its place of@insert_marker@the@insert_marker@itself will be removed from the prompt -
@replace prompt@dose not in the prompt it will perform replace mode, the prompt will be unchanged but the hires prompt will havereplace promptreplaced withreplace something here -
@replace with blank@similar to@replace prompt@but the replacement is"empty", this effectively this removes thereplace with blankfrom the hires prompt -
both search phrase and replacement can be multi-line
if you need a literal @ in the instructions then you can escape it by doubling it @@
you can also change the character used to enclose the key_word by setting the @ to some other character
This is the resulting using the above prompt and hires prompt resulting prompt
this is an example prompt , and replace prompt some more replace with blank prompt,
prompt to
replace can be
multil-ine
like so
Resulting hires prompt
this is an example prompt insert something here
, and replace something here
some more prompt,
prompt to
replace replacement can
be multi-line
like so
Notes
Remove First Pass Extra NetworksandHires prompt modeare performed very early in the image generation pipline, even beforeStylesis applied to prompts, which means that it will not affect the prompt added byStyles. it should only affect the style you can visibly see in the prompt input box.-
- Features added can be hidden in settings if you do use them
- If you would like to suggest a feature feel free to open an issue or pull request
- I position this extension as "Workflow improvement" tool, in general, this extensions functionality should be possible to do without this extension, even if might require multiple steps
-
Hires pass CFG scaleandHires Batch and Seedcan be archived by manually performing img2img on the txt2img output.
-
Hires prompt modeandRemove First Pass Extra Networkscan be archived by manually editing the prompt before generating the hires pass.
-
Hires output directorycan be archived by manually changing the output directory in the webui settings