[Stable Diffusion] Prompt Sharing and Learning Thread

Mr-Fox

Well-Known Member
Jan 24, 2020
1,401
3,793
The "problem" with giving specific examples is that it's likely to be "case dependent". The model used with have its biases, the order of things in the prompt itself has an obvious impact (which is why i'm suggesting keeping them clean/clear/organized). If i come across an example at some point i'll try to remember to post it
I meant to do a hands on example, take his prompt and do with it as you suggested, it would be a better learning aid and also a generated image so we can see the end result. I understand if you don't have time or the will. It would just be even better.
 

Jimwalrus

Active Member
Sep 15, 2021
895
3,303
Afaik the ( ) are just multiplicators, so it's a quick way to emphasise what's more important and what's not. If I write:

(apples), oranges, ((carrots))

then the importance-ratio between those 3 would be 2:1:3.

If you wrap everything into braces, everything is equally important, which means you could've just not used them at all. No?
Not quite. In SD, the braces are 0.1 additions.
So "plump" is plump at 1 strength.
"(plump)" is plump at 1.1 strength.
"((((plump))))" is plump at 1.4 strength.
"(plump:1.2)" is plump at either 1.2, 1.21 or 1.3 (it depends who you ask!)

"big tits" is big and tits SEPARATELY at strength 1. SD sort of realises they are together, especially with commas before & after, but not reliably.
"(big tits)" is big tits at strength 1.1 - the braces help SD lump them together as a single token.

So your example of "(apples), oranges, ((carrots))" is actually apples at 1.1, oranges at 1 and carrots at 1.2.
 

Fuchsschweif

Active Member
Sep 24, 2019
954
1,514
The special symbols works differently in SD compared to MJ. You need to try forget some things that you learned with using MJ.
Brackets in SD is the equivalent of weight not a multiplier. ( ) means 1.0 +0.1 =1.1 in weight and attention.
This is what I was referring to:

1697226497758.png

 
  • Like
Reactions: Mr-Fox and devilkkw

me3

Member
Dec 31, 2016
316
708
The special symbols works differently in SD compared to MJ. You need to try forget some things that you learned with using MJ.
Brackets in SD is the equivalent of weight not a multiplier. ( ) means 1.0 +0.1 =1.1 in weight and attention. Square brackets only works in some ways and then it means the opposite of the normal brackets in that they reduce weight = to 0.1 .
I don't think me3 meant to use brackets on everything. If you did it too much, yeas then it could become pointless. This was what he was getting at though, using words in the prompt that would contradict each other and cancel each other out. I didn't see much of that though, just a some more structure and simplification needed.
I don't have prompt for easy c/p atm, but i believe part of it was "<something>, upper body shot closeup:1.5, <something more>".
So not only is this slightly confusing to a reader, is the intention to apply the weight to just "closeup" or everything between the commas.
The same "confusion" can apply to the parser too, i haven't been digging around in that so see how it works in detail, but i have had a fair bit of dealings with other parsers and they are all "fragile" at best so as a general rule you don't want to push the limits. So simply wrapping everything that's intended to be weighted is a much simpler option for everyone involved.

It wouldn't surprise me if :1.5 outside of parenthesis doesn't actually weight given that the behaviour of the "editor" is to apply both () and :1.1 in the same action. But the parser in a1111 is different that comfy and i'm sure other "frontends" can have their own parser so despite all of them being SD, some behaviour might not be completely consistent
 
  • Like
Reactions: Mr-Fox and devilkkw

Fuchsschweif

Active Member
Sep 24, 2019
954
1,514
But it's actually a multiplier of 1.1, not an addition of 1 which would result in n:1, n:2, n:3 etc.
That's why I wrote "importance-ratio", to undermine that it's not an absolute ratio :p

The point was that putting everything into parantheses is pointless as everything gets the same multiplier and therefore importance.
 

Jimwalrus

Active Member
Sep 15, 2021
895
3,303
That's why I wrote "importance-ratio", to undermine that it's not an absolute ratio :p

The point was that putting everything into parantheses is pointless as everything gets the same multiplier and therefore importance.
Ah, OK. Wasn't clear - if anything it did seem like you were implying a strength ratio of 1:2:3
But yes, if you weight everything equally it will basically treat everything the same. Unless it feels like fucking you around that day...
Another rabbit hole to go into is prompt order - there's a huge debate as to whether the prompts should be in strict order of importance, or whether it's just the first 75 tokens are equal, then the next 75 and so on.
 
  • Like
Reactions: Mr-Fox

Mr-Fox

Well-Known Member
Jan 24, 2020
1,401
3,793
I don't have prompt for easy c/p atm, but i believe part of it was "<something>, upper body shot closeup:1.5, <something more>".
So not only is this slightly confusing to a reader, is the intention to apply the weight to just "closeup" or everything between the commas.
The same "confusion" can apply to the parser too, i haven't been digging around in that so see how it works in detail, but i have had a fair bit of dealings with other parsers and they are all "fragile" at best so as a general rule you don't want to push the limits. So simply wrapping everything that's intended to be weighted is a much simpler option for everyone involved.

It wouldn't surprise me if :1.5 outside of parenthesis doesn't actually weight given that the behaviour of the "editor" is to apply both () and :1.1 in the same action. But the parser in a1111 is different that comfy and i'm sure other "frontends" can have their own parser so despite all of them being SD, some behaviour might not be completely consistent
(y)
 

Fuchsschweif

Active Member
Sep 24, 2019
954
1,514
Another rabbit hole to go into is prompt order - there's a huge debate as to whether the prompts should be in strict order of importance, or whether it's just the first 75 tokens are equal, then the next 75 and so on.
Shouldn't that be clarified in the official documentation?
 

Mr-Fox

Well-Known Member
Jan 24, 2020
1,401
3,793
Ah, OK. Wasn't clear - if anything it did seem like you were implying a strength ratio of 1:2:3
But yes, if you weight everything equally it will basically treat everything the same. Unless it feels like fucking you around that day...
Another rabbit hole to go into is prompt order - there's a huge debate as to whether the prompts should be in strict order of importance, or whether it's just the first 75 tokens are equal, then the next 75 and so on.
Yes I have also read that the order has an importance ranking effect. If anyone else than just me feel the need to read up on prompting, I often come back to this guide:


BTW, fudge I was wrong about ( ) [ ] syntax. Impossible.. :LOL:
 
  • Like
Reactions: Jimwalrus

Jimwalrus

Active Member
Sep 15, 2021
895
3,303
Shouldn't that be clarified in the official documentation?
The magic word there being "Should" ;)

If it's there, and written in a way that it's understandable. And it hasn't been superseded in the last 12 months or so.
This is all cutting edge and mostly open source, so don't expect documentation to be good!
 

me3

Member
Dec 31, 2016
316
708
Example was requested so i guess this might work.
I added () to the prompt, first just for the closeup, then for the face lighting as well.
00005-2549670335.png 00021-2549670335.png 00022-2549670335.png

This does seem to suggest that the weighting isn't applied when it's not wrapped in (), or at the very least, not applied correctly.
Granted, the prompt gets "altered" by adding this but i don't think the changes are random enough as they seem to follow the intention in the prompt
 

Mr-Fox

Well-Known Member
Jan 24, 2020
1,401
3,793
Example was requested so i guess this might work.
I added () to the prompt, first just for the closeup, then for the face lighting as well.
View attachment 3003580 View attachment 3003581 View attachment 3003582

This does seem to suggest that the weighting isn't applied when it's not wrapped in (), or at the very least, not applied correctly.
Granted, the prompt gets "altered" by adding this but i don't think the changes are random enough as they seem to follow the intention in the prompt
(y)
 

me3

Member
Dec 31, 2016
316
708
So i went through the parser code and found the weight handling, then ran the prompt through with and without the ()

Without the () the whole prompt is assigned a weight of 1.0, meaning the :1.5 and :1.4 is ignored as weighting and more considered "part of the text" along with the word infront, so "closeup:1.5" is seemingly treated as one belonging together.

Python:
[['1 girl in a black matrix coat, standing on a rooftop, upper body shot closeup:1.5, cinematic shot, golden sidelight on her face:1.4, foggy atmosphere, neon glowing in the back, rainy day, cloudy, cyberpunk cityscape in the back, blade runner style, cyberpunk style, serious look, rough and moody atmosphere, gritty style, photoshooting', 1.0]]

With () the weighting is done more as expected and those two sections get their 1.5 and 1.4 weighting, rest is assigned 1.0

Python:
[['1 girl in a black matrix coat, standing on a rooftop, ', 1.0], ['upper body shot closeup', 1.5], [', cinematic shot, ', 1.0], ['golden sidelight on her face', 1.4], [', foggy atmosphere, neon glowing in the back, rainy day, cloudy, cyberpunk cityscape in the back, blade runner style, cyberpunk style, serious look, rough and moody atmosphere, gritty style, photoshooting', 1.0]]

Just to test how things are handled i ran this as well:
(This) (is:1.1) ((a)) ((test:1.1)) (prompt:1.2)
Python:
[
    ['This', 1.1],
    [' ', 1.0],
    ['is', 1.1],
    [' ', 1.0],
    ['a', 1.2100000000000002],
    [' ', 1.0],
    ['test', 1.2100000000000002],
    [' ', 1.0],
    ['prompt', 1.2]
]
 

Mr-Fox

Well-Known Member
Jan 24, 2020
1,401
3,793
So i went through the parser code and found the weight handling, then ran the prompt through with and without the ()

Without the () the whole prompt is assigned a weight of 1.0, meaning the :1.5 and :1.4 is ignored as weighting and more considered "part of the text" along with the word infront, so "closeup:1.5" is seemingly treated as one belonging together.

Python:
[['1 girl in a black matrix coat, standing on a rooftop, upper body shot closeup:1.5, cinematic shot, golden sidelight on her face:1.4, foggy atmosphere, neon glowing in the back, rainy day, cloudy, cyberpunk cityscape in the back, blade runner style, cyberpunk style, serious look, rough and moody atmosphere, gritty style, photoshooting', 1.0]]

With () the weighting is done more as expected and those two sections get their 1.5 and 1.4 weighting, rest is assigned 1.0

Python:
[['1 girl in a black matrix coat, standing on a rooftop, ', 1.0], ['upper body shot closeup', 1.5], [', cinematic shot, ', 1.0], ['golden sidelight on her face', 1.4], [', foggy atmosphere, neon glowing in the back, rainy day, cloudy, cyberpunk cityscape in the back, blade runner style, cyberpunk style, serious look, rough and moody atmosphere, gritty style, photoshooting', 1.0]]

Just to test how things are handled i ran this as well:
(This) (is:1.1) ((a)) ((test:1.1)) (prompt:1.2)
Python:
[
    ['This', 1.1],
    [' ', 1.0],
    ['is', 1.1],
    [' ', 1.0],
    ['a', 1.2100000000000002],
    [' ', 1.0],
    ['test', 1.2100000000000002],
    [' ', 1.0],
    ['prompt', 1.2]
]
Awesome stuff.:) (y)
 

Mr-Fox

Well-Known Member
Jan 24, 2020
1,401
3,793
Another way to keep the pose and composition is to use openposer in controlnet. I thought I should just mention this.
You need to install controlnet ofc. Load the original image in controlnet and select openpose, choose "open pose full " and then press "preprocessor" (small explosion cymbol). This will detect the image and create a pose, you can adjust it in the editor if you need. Then press "send pose to controlnet" . Now you can generate image after image and change the background, the clothes or what ever you want while the pose reamains the same. Openpose.png
Openpose editor.png
The image I generated with this pose:

00000-2549670335.png

Or something different..
00004-2549670335.png

Link for the editor:
 
Last edited:

Fuchsschweif

Active Member
Sep 24, 2019
954
1,514
This does seem to suggest that the weighting isn't applied when it's not wrapped in (), or at the very least, not applied correctly.
Granted, the prompt gets "altered" by adding this but i don't think the changes are random enough as they seem to follow the intention in the prompt
Interesting, thanks!

It makes sense in terms that it makes it easier to isolate desired parts of a prompt. So one could write:

A city with a park (and tall skyscrapers:1.5), and since the whole part is put in parantheses, SD doesn't have to take the whole prompt until the comma into consideration.

I found a website stating that adding + or - (also multiple times possible, like "forest++++") would add or subtract importance to a word, but a little simple test with "trees++++, buildings--" and vice versa didn't prove that.
 

Jimwalrus

Active Member
Sep 15, 2021
895
3,303
So i went through the parser code and found the weight handling, then ran the prompt through with and without the ()

Without the () the whole prompt is assigned a weight of 1.0, meaning the :1.5 and :1.4 is ignored as weighting and more considered "part of the text" along with the word infront, so "closeup:1.5" is seemingly treated as one belonging together.

Python:
[['1 girl in a black matrix coat, standing on a rooftop, upper body shot closeup:1.5, cinematic shot, golden sidelight on her face:1.4, foggy atmosphere, neon glowing in the back, rainy day, cloudy, cyberpunk cityscape in the back, blade runner style, cyberpunk style, serious look, rough and moody atmosphere, gritty style, photoshooting', 1.0]]

With () the weighting is done more as expected and those two sections get their 1.5 and 1.4 weighting, rest is assigned 1.0

Python:
[['1 girl in a black matrix coat, standing on a rooftop, ', 1.0], ['upper body shot closeup', 1.5], [', cinematic shot, ', 1.0], ['golden sidelight on her face', 1.4], [', foggy atmosphere, neon glowing in the back, rainy day, cloudy, cyberpunk cityscape in the back, blade runner style, cyberpunk style, serious look, rough and moody atmosphere, gritty style, photoshooting', 1.0]]

Just to test how things are handled i ran this as well:
(This) (is:1.1) ((a)) ((test:1.1)) (prompt:1.2)
Python:
[
    ['This', 1.1],
    [' ', 1.0],
    ['is', 1.1],
    [' ', 1.0],
    ['a', 1.2100000000000002],
    [' ', 1.0],
    ['test', 1.2100000000000002],
    [' ', 1.0],
    ['prompt', 1.2]
]
This is gold dust, thank you so much.
I wondered why sometimes my single word prompts with decimal weighting didn't work.
 
  • Like
Reactions: Sepheyer

Sepheyer

Well-Known Member
Dec 21, 2020
1,528
3,598
So i went through the parser code and found the weight handling, then ran the prompt through with and without the ()

Without the () the whole prompt is assigned a weight of 1.0, meaning the :1.5 and :1.4 is ignored as weighting and more considered "part of the text" along with the word infront, so "closeup:1.5" is seemingly treated as one belonging together.

Python:
[['1 girl in a black matrix coat, standing on a rooftop, upper body shot closeup:1.5, cinematic shot, golden sidelight on her face:1.4, foggy atmosphere, neon glowing in the back, rainy day, cloudy, cyberpunk cityscape in the back, blade runner style, cyberpunk style, serious look, rough and moody atmosphere, gritty style, photoshooting', 1.0]]

With () the weighting is done more as expected and those two sections get their 1.5 and 1.4 weighting, rest is assigned 1.0

Python:
[['1 girl in a black matrix coat, standing on a rooftop, ', 1.0], ['upper body shot closeup', 1.5], [', cinematic shot, ', 1.0], ['golden sidelight on her face', 1.4], [', foggy atmosphere, neon glowing in the back, rainy day, cloudy, cyberpunk cityscape in the back, blade runner style, cyberpunk style, serious look, rough and moody atmosphere, gritty style, photoshooting', 1.0]]

Just to test how things are handled i ran this as well:
(This) (is:1.1) ((a)) ((test:1.1)) (prompt:1.2)
Python:
[
    ['This', 1.1],
    [' ', 1.0],
    ['is', 1.1],
    [' ', 1.0],
    ['a', 1.2100000000000002],
    [' ', 1.0],
    ['test', 1.2100000000000002],
    [' ', 1.0],
    ['prompt', 1.2]
]
Would you know why it doesn't drop the blank tokens altogether, i.e. the spaces? I am surprised those are even added to the list. Also, if you have the code still up, can you please let us know how this gets converted: (((test:1.3))).