Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combinatorial generation batch > 1 acting wrong #787

Open
Zantagor opened this issue May 31, 2024 · 5 comments
Open

Combinatorial generation batch > 1 acting wrong #787

Zantagor opened this issue May 31, 2024 · 5 comments

Comments

@Zantagor
Copy link

Not sure if it's a bug, or me not understanding how this should work. But let's say I have this basic prompt
Prompt: Beautiful {dog|house}
Negative: ugly
with a specific seed.

And I set that Dynamic Prompts On, and Combinatorial Generation on. And I set the Combinatorial Batches to 2
Fixed Seed: On, Unlink seed from Prompt: On

I would expect 4 images. House A, Dog A, House B, Dog B

But what I'm getting instead is
House A, House A, Dog A, Dog A, House B, House B, Dog B, Dog B.

basically I would be expecting (2 * 1) * 2 batches...
but what it seems to be doing is (2 * 2) * 2 batches.... (it counts the negative twice when building the final set.

I went and added a couple of log.info and dumped the all_prompts and all_negative_prompts, and as I thoughts, theres 8 entries for each. I would've expected at most 4.

To me, this sounds wrong. Or am I missing something?

@Zantagor
Copy link
Author

Zantagor commented May 31, 2024

I did end up making a temp fix that works for me
in helpers.py just before the generate_prompt_cross_product call, I clean up the negative prompts of duplicates
`
all_negative_prompts = list(dict.fromkeys(all_negative_prompts))

if num_prompts is None:
    return generate_prompt_cross_product(all_prompts, all_negative_prompts)`

it might have unforseen issues else where I guess, but for my own purpose, I do not plan on having dynamic negatives, so it fixes my main problem

@abctuba
Copy link

abctuba commented Jun 4, 2024

I concur with this, I have the same expectation but I am getting the same results.

@abctuba
Copy link

abctuba commented Jun 4, 2024

I did end up making a temp fix that works for me in helpers.py just before the generate_prompt_cross_product call, I clean up the negative prompts of duplicates ` all_negative_prompts = list(dict.fromkeys(all_negative_prompts))

if num_prompts is None:
    return generate_prompt_cross_product(all_prompts, all_negative_prompts)`

it might have unforseen issues else where I guess, but for my own purpose, I do not plan on having dynamic negatives, so it fixes my main problem

Could you clarify where this helpers.py file is likely located?

@Zantagor
Copy link
Author

Zantagor commented Jun 5, 2024

Sure,
https://github.com/adieyal/sd-dynamic-prompts/blob/main/sd_dynamic_prompts/helpers.py

in Automatic1111 that would be in /webui/extensions/sd-dynamic-prompts/sd_dynamic_prompts

I just put
all_negative_prompts = list(dict.fromkeys(all_negative_prompts))
before the code block
if num_prompts is None: return generate_prompt_cross_product(all_prompts, all_negative_prompts)

@SGrahambo
Copy link

SGrahambo commented Oct 25, 2024

I'm having this issue as well. The math appears to be all_prompts*combinatorial_batches*combinatorial_batches, regardless of if the prompts are in the negative or positive or both. So something with 5 total prompts and set to 4 combinatorial batches is 5*4*4=80 total images. So I think that's a good lead to go on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants