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

Fix sd-dynamic-prompts error with empty prompts #137

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

asoraruf
Copy link

This fix resolved the sd-dynamic-prompt issue 513 adieyal/sd-dynamic-prompts#513

Comment on lines 71 to 72
if gen:
prompts.append(str(next(iter(gen))))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why bother looking at if gen: inside the loop? If there are 10,000 seeds, this will end up just seeding the generator 10,000 times and do nothing with it.

It looks like gen = self._context.sample_prompts(template, num_images) should be before if seeds:, and if not gen: return [] after it.

The non-seeds branch should then also use the same gen: return [str(p) for p in gen].

@asoraruf
Copy link
Author

@akx you have right! gen check outside the loop it's much better.

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

Successfully merging this pull request may close these issues.

2 participants