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

allow randomized seeds in prompt_matrix #5438

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
allow randomized seeds in prompt_matrix
  • Loading branch information
David Vorick committed Dec 5, 2022
commit fa6478796a5c794b4141fce3e8cdb9ec5ea2b71f
13 changes: 10 additions & 3 deletions scripts/prompt_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ def title(self):

def ui(self, is_img2img):
put_at_start = gr.Checkbox(label='Put variable parts at start of prompt', value=False)
random_seeds = gr.Checkbox(label='Keep -1 for seeds', value=False)

return [put_at_start]
return [put_at_start, random_seeds]

def run(self, p, put_at_start):
def run(self, p, put_at_start, random_seeds):
modules.processing.fix_seed(p)

original_prompt = p.prompt[0] if type(p.prompt) == list else p.prompt
Expand All @@ -73,7 +74,13 @@ def run(self, p, put_at_start):
print(f"Prompt matrix will create {len(all_prompts)} images using a total of {p.n_iter} batches.")

p.prompt = all_prompts
p.seed = [p.seed for _ in all_prompts]
if random_seeds:
base = p.seed
p.seed = []
for i in range(len(all_prompts)):
p.seed.append(base+1)
else:
p.seed = [p.seed for _ in all_prompts]
p.prompt_for_display = original_prompt
processed = process_images(p)

Expand Down