w-e-w / sd-webui-hires-fix-tweaks

Add additional options and features to hires fix of Stable Diffusion web UI
GNU Affero General Public License v3.0
36 stars 1 forks source link
stable-diffusion-webui

sd webui hires fix tweaks

Add additional options and features to hires fix for Stable Diffusion web UI screenshot

Features

  1. 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
  2. Hires Batch and Seed

    • Generate multiple hires pass form first pass image
    • Specify different seed for hires pass
  3. Hires prompt mode and Remove First Pass Extra Networks

    • Changes how the hires prompt is created based on the first pass prompt
      1. Default: Webui default behavior:
        if blank same as first pass else use hires prompt
      2. Append: Append hires prompt after first pass prompt
      3. Prepend: Prepend hires prompt before first pass prompt
      4. Prompt 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
  4. Hires styles

    • Allows you to specify a different styles for hires pass
      • Enable and with no styles specified will effectively remove styles from hires pass
  5. Hires output directory

    • Specify a different output directory for hires pass
    • Settings > Paths for saving > Output directory for hires. fix images
  6. Override "Checkpoint dropdown: use filenames without paths" for other dropdowns

    • Control if the Checkpoint dropdowns are listed with or without paths
    • Settings > UI alternatives > Override "Checkpoint dropdown: use filenames without paths" for other dropdowns
      1. Default: No change
      2. With paths (Hires fix): Hires fix checkpoint dropdown will be shown with paths
      3. Without paths (Hires fix): Hires fix checkpoint dropdown will be shown without paths
      4. With paths (Global): Most checkpoint dropdown will be shown with paths
      5. Without paths (Global): Most checkpoint dropdown will be shown without paths
        • Global variant will affect everything* which can potentially cause issues depending on how the checkpoint value is used
        • *Everything using the modules.sd_models.checkpoint_tiles to get the checkpoint list, which is used in most places in the webui

Remove First Pass Extra Networks

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

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