adieyal / sd-dynamic-prompts

A custom script for AUTOMATIC1111/stable-diffusion-webui to implement a tiny template language for random prompt generation
MIT License
1.96k stars 253 forks source link

Variables do not regenerate for each prompt #717

Open spooji opened 5 months ago

spooji commented 5 months ago

"Immediate evaluation" of variables using the ! as in ${season=!{summer|autumn|winter|spring}} results in all generations in a Batch Count to use the same value (i.e. 10 images using 'summer').

Without the !, the variable is evaluated every time the variable is mentioned in a prompt so there will be three random seasons in one prompt when ${season} is called three times.

I cannot find documentation which explains how to get the same value in throughout each generation and then reevaluate on the next generation (i.e. each of the 10 batch count only uses a single season for all instances of ${season} in that generation so image 1 might be summer whereas image 2 might be autumn).

Is this a bug or by design?

dxnxz commented 2 months ago

Same issue here

dxnxz commented 2 months ago

I did a workaround in ComfyUI using some find and replace magic. Unfortunately I had to add another find and replace thingy to remove the line breaks. But at least the variables keep being regenerated for each run.

grafik

Hunt3rseeker commented 2 months ago

Same problem for me, using Forge.

crkinard commented 3 days ago

Having the same issue here,

Prompt example:

${color=!__color__}, 
$(color) shirt, $(color) pants, $(color) boots

Output: if batch set to 1: red shirt, red pants, red boots

Output: if batch set to 1+:

red shirt, red pants, red boots
red shirt, red pants, red boots
red shirt, red pants, red boots

Output excepted set to 1+:

red shirt, red pants, red boots
blue shirt, blue pants, blue boots
green shirt, green pants, green boots