dreambooth-template icon indicating copy to clipboard operation
dreambooth-template copied to clipboard

support for "prompt attention"

Open anotherjesse opened this issue 2 years ago • 1 comments

To fully customize prompts, there is a "hack" that popular versions of stable diffusion use to allow you to increase/decrease the strength of each token using parens/square brakets

lpw_stable_diffusion.py is an implementation for this within diffusers.

def parse_prompt_attention(text):
    """
    Parses a string with attention tokens and returns a list of pairs: text and its associated weight.
    Accepted tokens are:
      (abc) - increases attention to abc by a multiplier of 1.1
      (abc:3.12) - increases attention to abc by a multiplier of 3.12
      [abc] - decreases attention to abc by a multiplier of 1.1
      \( - literal character '('
      \[ - literal character '['
      \) - literal character ')'
      \] - literal character ']'
      \\ - literal character '\'
      anything else - just text

This might be fairly straightforward to add to the default template

anotherjesse avatar Jan 12 '23 22:01 anotherjesse

looks like the code mentioned in #26 also supports this ... it might be a good combo

anotherjesse avatar Jan 31 '23 02:01 anotherjesse