sd-dynamic-prompts: Combinations does not work when using Wildcard files
Describe the bug
https://github.com/adieyal/sd-dynamic-prompts/blob/main/docs/SYNTAX.md
According to this page, the following notations are permitted I have used this to make sure it works as intended.
{2$$opt1|opt2|opt3}
{1-3$$opt1|opt2|opt3}
I checked the “Need help?” in the web UI. The wildcard should be available as follows
{2$$__artist__}
I would expect this method to call two rows, but in fact it could only call one row.
To Reproduce
Prepare “quality_tags.txt”.
masterpiece
best quality
high quality
ultra-detailed
This was then described and generated in the prompt. The output is only one line from the file.
{2$$__quality_tags__}
Also mention which checkboxes have been set.
Only the next two are chucked.
- Attention grabber
- Don’t apply to negative prompts
Are you using a local install or a colab?
I am using a local install and the commit hash for the Web UI is as follows Commit hash: 3715ece0adce7bf7c5e9c5ab3710b2fdc3848f39
Expected behaviour A clear and concise description of what you expected to happen.
In the above example, two lines are expected to be read from the next four lines.
masterpiece
best quality
high quality
ultra-detailed
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 15 (7 by maintainers)
Commits related to this issue
- Updated dynamicprompts to 0.10.5 which fixes #307 — committed to adieyal/sd-dynamic-prompts by adieyal a year ago
- Merge pull request #334 from adieyal/bug/wildcard-variants Updated dynamicprompts to 0.10.5 which fixes #307 — committed to adieyal/sd-dynamic-prompts by adieyal a year ago
I appreciate your response. The reason it is currently broken is that we made changes to the parser which were somewhat complicated. Re-implementing this feature immediately was not trivial at the time. Now that the updated parser has been released, I’ll be able to get to fixing it.
@adieyal Thank you for your work! Thanks again everyone for the discussion. sd-dynamic-prompts is something that can help me find my own style in creating illustrations with AI and make AI more powerful to generate unexpected and interesting illustrations. I will enjoy using it.😊
the ‘~’ operator was exactly what I was looking for, thanks for adding it, love your work!
would it be possible (in the future) to select one(!) random value and then use/repeat it in multiple places in the whole prompt? for example, I want to add a specific
__~colors__
for flowers and decorations writing__~colors__ flowers, __~colors__ decorations
will yield two random colors from the wildcard file I want both values to be the same random value from the wildcard file, smth like__*colors__
Creating a variable like__#flowers__ = __~flowers__
and then use__#flowers__
where needed would be nice, but maybe to much.with best regards
You can “git checkout 7bb4029” which is v2.5.0. The
{2$$__wildcard__}
format works there.I am a little confused how there’s been so many updates, and that core functionality has been broken the entire time. With that version I can do
{10$$__enhance__},
instead of__enhance__ __enhance__ __enhance__ __enhance__ __enhance__ __enhance__ __enhance__ __enhance__ __enhance__ __enhance__
, lol.also the suggestion of
"{__wildcard__|__wildcard__}"
wouldn’t work in their case because that just picks 1 of the 2 options, and they are both the same option. They would have to do"__wildcard__, __wildcard__"
, and at that point, the dynamic prompt extension is no different from the standard https://github.com/AUTOMATIC1111/stable-diffusion-webui-wildcards extension.Sounds like it is working as expected, combinatorial mode generates every possible prompt, including all values in wildcard files. There is however new syntax which I think will achieve what you want.
In combinatorial mode, try something like this
__~test2__ [old:dirty:0.5] {__test1__|__test1__}
note the added~
That will choose a random value from test2.txt while iterating through every value in test1.txt.
Similar syntax is available for variants,
{~random_value1|random_value2} [old:dirty:0.5] {__test1__|__test1__}
Okay, this seems to have to do with limiting the max generations under the Dynamic Prompts settings in the main UI page (in Automatic1111). I tried just setting it to 0, and now it seems to create every possible combination of the above wildcards as expected.
However it seems with combinatorial mode enabled (whether using the squiggly brackets or not), wildcards no longer behave as “wildcard” files (in the sense that the selections are no longer randomized), and instead will be run through as a list with the goal to make every combination in order they are listed in the text files. It will stop making these combinations when it either reaches the end of the possible combinations, or it reaches what is set for max generations (in my earlier examples, this is why it never got passed the color blue).
I’m not sure this is related to the actual top level issue here, but wanted to make sure I clarified my situation. Maybe this is solved somehow in the Jinja template portion, though I’m not sure. Mainly I’m hoping for a way to call multiple wildcards initially, and then on subsequent generations/batches only randomize some of the called wildcards. Ideally something like;
Where test2 will randomly select a value from its associated wildcard text, and then generate combinatoric batches while still randomly choosing entries from test1’s text file until it reaches the max generations limit (or total possible limit, but preferably a way to limit it and also have it retain the randomization and not become programmatic with each combination). Maybe not possible? Am I missing something?
Anyway, love the extension, thank you so much for everything you’ve done so far. 😃