mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
improve documentation of "attention weighting" syntax
This commit is contained in:
parent
245cf606a3
commit
d43167ac0b
0
docs/assets/prompt_syntax/apricots--1.png
Normal file
0
docs/assets/prompt_syntax/apricots--1.png
Normal file
0
docs/assets/prompt_syntax/apricots--2.png
Normal file
0
docs/assets/prompt_syntax/apricots--2.png
Normal file
0
docs/assets/prompt_syntax/apricots--3.png
Normal file
0
docs/assets/prompt_syntax/apricots--3.png
Normal file
0
docs/assets/prompt_syntax/apricots-0.png
Normal file
0
docs/assets/prompt_syntax/apricots-0.png
Normal file
0
docs/assets/prompt_syntax/apricots-1.png
Normal file
0
docs/assets/prompt_syntax/apricots-1.png
Normal file
0
docs/assets/prompt_syntax/apricots-2.png
Normal file
0
docs/assets/prompt_syntax/apricots-2.png
Normal file
0
docs/assets/prompt_syntax/apricots-3.png
Normal file
0
docs/assets/prompt_syntax/apricots-3.png
Normal file
0
docs/assets/prompt_syntax/apricots-4.png
Normal file
0
docs/assets/prompt_syntax/apricots-4.png
Normal file
0
docs/assets/prompt_syntax/apricots-5.png
Normal file
0
docs/assets/prompt_syntax/apricots-5.png
Normal file
0
docs/assets/prompt_syntax/mountain-man.png
Normal file
0
docs/assets/prompt_syntax/mountain-man.png
Normal file
0
docs/assets/prompt_syntax/mountain-man1.png
Normal file
0
docs/assets/prompt_syntax/mountain-man1.png
Normal file
0
docs/assets/prompt_syntax/mountain-man2.png
Normal file
0
docs/assets/prompt_syntax/mountain-man2.png
Normal file
0
docs/assets/prompt_syntax/mountain-man3.png
Normal file
0
docs/assets/prompt_syntax/mountain-man3.png
Normal file
0
docs/assets/prompt_syntax/mountain-man4.png
Normal file
0
docs/assets/prompt_syntax/mountain-man4.png
Normal file
0
docs/assets/prompt_syntax/mountain1-man.png
Normal file
0
docs/assets/prompt_syntax/mountain1-man.png
Normal file
0
docs/assets/prompt_syntax/mountain2-man.png
Normal file
0
docs/assets/prompt_syntax/mountain2-man.png
Normal file
0
docs/assets/prompt_syntax/mountain3-man.png
Normal file
0
docs/assets/prompt_syntax/mountain3-man.png
Normal file
@ -91,7 +91,7 @@ The InvokeAI prompting language has the following features:
|
|||||||
### Attention weighting
|
### Attention weighting
|
||||||
Append a word or phrase with `-` or `+`, or a weight between `0` and `2` (`1`=default), to decrease or increase "attention" (= a mix of per-token CFG weighting multiplier and, for `-`, a weighted blend with the prompt without the term).
|
Append a word or phrase with `-` or `+`, or a weight between `0` and `2` (`1`=default), to decrease or increase "attention" (= a mix of per-token CFG weighting multiplier and, for `-`, a weighted blend with the prompt without the term).
|
||||||
|
|
||||||
The following will be recognised:
|
The following syntax is recognised:
|
||||||
* single words without parentheses: `a tall thin man picking apricots+`
|
* single words without parentheses: `a tall thin man picking apricots+`
|
||||||
* single or multiple words with parentheses: `a tall thin man picking (apricots)+` `a tall thin man picking (apricots)-` `a tall thin man (picking apricots)+` `a tall thin man (picking apricots)-`
|
* single or multiple words with parentheses: `a tall thin man picking (apricots)+` `a tall thin man picking (apricots)-` `a tall thin man (picking apricots)+` `a tall thin man (picking apricots)-`
|
||||||
* more effect with more symbols `a tall thin man (picking apricots)++`
|
* more effect with more symbols `a tall thin man (picking apricots)++`
|
||||||
@ -99,6 +99,40 @@ The following will be recognised:
|
|||||||
* all of the above with explicit numbers `a tall thin man picking (apricots)1.1` `a tall thin man (picking (apricots)1.3)1.1`. (`+` is equivalent to 1.1, `++` is pow(1.1,2), `+++` is pow(1.1,3), etc; `-` means 0.9, `--` means pow(0.9,2), etc.)
|
* all of the above with explicit numbers `a tall thin man picking (apricots)1.1` `a tall thin man (picking (apricots)1.3)1.1`. (`+` is equivalent to 1.1, `++` is pow(1.1,2), `+++` is pow(1.1,3), etc; `-` means 0.9, `--` means pow(0.9,2), etc.)
|
||||||
* attention also applies to `[unconditioning]` so `a tall thin man picking apricots [(ladder)0.01]` will *very gently* nudge SD away from trying to draw the man on a ladder
|
* attention also applies to `[unconditioning]` so `a tall thin man picking apricots [(ladder)0.01]` will *very gently* nudge SD away from trying to draw the man on a ladder
|
||||||
|
|
||||||
|
You can use this to increase or decrease the amount of something:
|
||||||
|
|
||||||
|
`a man picking apricots from a tree`
|
||||||
|

|
||||||
|
|
||||||
|
Using `-` to reduce apricot-ness:
|
||||||
|
|
||||||
|
| `a man picking apricots- from a tree` | `a man picking apricots-- from a tree` | `a man picking apricots--- from a tree` |
|
||||||
|
| -- | -- | -- |
|
||||||
|
|  |  |  |
|
||||||
|
|
||||||
|
Using `+` to increase apricot-ness:
|
||||||
|
|
||||||
|
| `a man picking apricots+ from a tree` | `a man picking apricots++ from a tree` | `a man picking apricots+++ from a tree` | `a man picking apricots++++ from a tree` | `a man picking apricots+++++ from a tree` |
|
||||||
|
| -- | -- | -- |
|
||||||
|
|  |  |  |  |  |
|
||||||
|
|
||||||
|
You can also change the balance between different parts of a prompt:
|
||||||
|
|
||||||
|
`mountain man`
|
||||||
|

|
||||||
|
|
||||||
|
More mountain:
|
||||||
|
|
||||||
|
| `mountain+ man` | `mountain++ man` | `mountain+++ man` |
|
||||||
|
| -- | -- | -- |
|
||||||
|
|  |  |  |
|
||||||
|
|
||||||
|
More man:
|
||||||
|
|
||||||
|
| `mountain man+` | `mountain man++` | `mountain man+++` | `mountain man++++` |
|
||||||
|
| -- | -- | -- | -- |
|
||||||
|
|  |  |  |  |
|
||||||
|
|
||||||
### Blending between prompts
|
### Blending between prompts
|
||||||
|
|
||||||
* `("a tall thin man picking apricots", "a tall thin man picking pears").blend(1,1)`
|
* `("a tall thin man picking apricots", "a tall thin man picking pears").blend(1,1)`
|
||||||
@ -119,7 +153,6 @@ Generate an image with a given prompt, record the seed of the image,
|
|||||||
and then use the `prompt2prompt` syntax to substitute words in the
|
and then use the `prompt2prompt` syntax to substitute words in the
|
||||||
original prompt for words in a new prompt. This works for `img2img` as well.
|
original prompt for words in a new prompt. This works for `img2img` as well.
|
||||||
|
|
||||||
|
|
||||||
* `a ("fluffy cat").swap("smiling dog") eating a hotdog`.
|
* `a ("fluffy cat").swap("smiling dog") eating a hotdog`.
|
||||||
* quotes optional: `a (fluffy cat).swap(smiling dog) eating a hotdog`.
|
* quotes optional: `a (fluffy cat).swap(smiling dog) eating a hotdog`.
|
||||||
* for single word substitutions parentheses are also optional: `a cat.swap(dog) eating a hotdog`.
|
* for single word substitutions parentheses are also optional: `a cat.swap(dog) eating a hotdog`.
|
||||||
@ -130,6 +163,8 @@ original prompt for words in a new prompt. This works for `img2img` as well.
|
|||||||
* Convenience option `shape_freedom` (0-1) to specify how much "freedom" Stable Diffusion should have to change the shape of the subject being swapped.
|
* Convenience option `shape_freedom` (0-1) to specify how much "freedom" Stable Diffusion should have to change the shape of the subject being swapped.
|
||||||
* `a (cat).swap(dog, shape_freedom=0.5) eating a hotdog`.
|
* `a (cat).swap(dog, shape_freedom=0.5) eating a hotdog`.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
The `prompt2prompt` code is based off [bloc97's
|
The `prompt2prompt` code is based off [bloc97's
|
||||||
colab](https://github.com/bloc97/CrossAttentionControl).
|
colab](https://github.com/bloc97/CrossAttentionControl).
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user