Skip to content

Commit 97ba01a

Browse files
Merge pull request #7081 from EllangoK/xy-hires
Adds Hires Steps to X/Y Plot, and updates step calculation
2 parents 6633530 + 8a3f85c commit 97ba01a

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

scripts/xy_grid.py

+15-3
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ def __init__(self, *args, **kwargs):
184184
AxisOption("Var. seed", int, apply_field("subseed")),
185185
AxisOption("Var. strength", float, apply_field("subseed_strength")),
186186
AxisOption("Steps", int, apply_field("steps")),
187+
AxisOptionTxt2Img("Hires steps", int, apply_field("hr_second_pass_steps")),
187188
AxisOption("CFG Scale", float, apply_field("cfg_scale")),
188189
AxisOption("Prompt S/R", str, apply_prompt, format_value=format_value),
189190
AxisOption("Prompt order", str_permutations, apply_order, format_value=format_value_join_list),
@@ -426,10 +427,21 @@ def fix_axis_seeds(axis_opt, axis_list):
426427
total_steps = p.steps * len(xs) * len(ys)
427428

428429
if isinstance(p, StableDiffusionProcessingTxt2Img) and p.enable_hr:
429-
total_steps *= 2
430+
if x_opt.label == "Hires steps":
431+
total_steps += sum(xs) * len(ys)
432+
elif y_opt.label == "Hires steps":
433+
total_steps += sum(ys) * len(xs)
434+
elif p.hr_second_pass_steps:
435+
total_steps += p.hr_second_pass_steps * len(xs) * len(ys)
436+
else:
437+
total_steps *= 2
438+
439+
total_steps *= p.n_iter
430440

431-
print(f"X/Y plot will create {len(xs) * len(ys) * p.n_iter} images on a {len(xs)}x{len(ys)} grid. (Total steps to process: {total_steps * p.n_iter})")
432-
shared.total_tqdm.updateTotal(total_steps * p.n_iter)
441+
image_cell_count = p.n_iter * p.batch_size
442+
cell_console_text = f"; {image_cell_count} images per cell" if image_cell_count > 1 else ""
443+
print(f"X/Y plot will create {len(xs) * len(ys) * image_cell_count} images on a {len(xs)}x{len(ys)} grid{cell_console_text}. (Total steps to process: {total_steps})")
444+
shared.total_tqdm.updateTotal(total_steps)
433445

434446
grid_infotext = [None]
435447

0 commit comments

Comments
 (0)