adieyal / sd-dynamic-prompts

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

[Feature Request] Cascading Wildcards #311

Open Mistborn-First-Era opened 1 year ago

Mistborn-First-Era commented 1 year ago

I would really like a way to have wildcard cascades.

For example the prompt: 1girl, eating food with utensil

I would like to be able to create a vlookup-like effect where the utensil is based on the food selected.

My guess is the utensil.txt would look something like.

__food__ lookup
spaghetti = a fork
soup = a spoon
pizza = their hands

Currently the work around is to have the full longer prompt in the food file, however this has limitations as prompts become more complex.

adieyal commented 1 year ago

Try using the cyclical sampler with two wildcard files something like

# food.txt
spaghetti
soup
pizza

and

# utensil.txt
a fork
a spoon
their hands

Then use this prompt: 1girl, eating __@food__ with __@utensil__

It's not a vlookup but might address your problem. You may encounter an issue if you have duplicate values in food.txt - see #317

Mistborn-First-Era commented 1 year ago

Awesome. Thank you for the info. I didn't even know about the different sampling methods. That's what I get for not reading the readme since the original wildcards extension came out.

adieyal commented 1 year ago

It's a relatively new feature - let me know if you find it useful

Mistborn-First-Era commented 1 year ago

Have been messing with it for a while now.

I have some weird bug where at "equal to or greater than 107, Max generations" I only make one picture. Not sure if it is specific to my wildcard or what. Will do some more debugging.

I would prefer if the randomization "\~" was the default method that way I could just add a "!" to the wildcard I want to completely iterate through. At the moment I need to add "~" to each wildcard which is a little annoying, but not terrible.

I am really liking the cyclical method though. Very fun, I still need to test that edge case with repeating words in a wildcard list.

adieyal commented 1 year ago

The way the samplers have been implemented, it isn't possible to have the default being random and then choose one element to be combinatorial. In fact, you can't have any combinatorial inside a random. It starts to not make sense.

e.g. {~__!food__|__!utensil__}

Unfortunately, this means that ! is pretty useless, for now at least. It may have purpose in future.

I am really liking the cyclical method though. Very fun, I still need to test that edge case with repeating words in a wildcard list.

Cyclical is surprisingly useful especially if you need to keep two wildcards in sync like you are doing.

Mistborn-First-Era commented 1 year ago

In fact, you can't have any combinatorial inside a random.

I was doing something more like, Prompt: __!randomlora__, __~hairstyle__, __~clothing__, __~eyecolor__

It iterates through my lora randomizer (to select each style lora) and then makes a random character template with: hair, clothes, and eye color.

maybe I am using it wrong?

adieyal commented 1 year ago

looks fine - but that will only work in combinatorial mode - in standard mode, the ! will be ignored.