From 31ac0baba069f4b9470b4c0812c1e2b7583df512 Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Sat, 24 Sep 2022 08:23:01 +0300 Subject: [PATCH] Reformat some changes from the previous commit. --- modules/processing.py | 2 +- scripts/xy_grid.py | 19 ++++++++----------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/modules/processing.py b/modules/processing.py index a899566..0246e09 100644 --- a/modules/processing.py +++ b/modules/processing.py @@ -338,7 +338,7 @@ def process_images(p: StableDiffusionProcessing) -> Processed: comments[comment] = 1 if p.n_iter > 1: - shared.state.job = f"Image {n+1} out of {p.n_iter}; Batch {(shared.state.job_no // p.n_iter) + 1} of {shared.state.job_count // p.n_iter}" + shared.state.job = f"Batch {n+1} out of {p.n_iter}" samples_ddim = p.sample(conditioning=c, unconditional_conditioning=uc, seeds=seeds, subseeds=subseeds, subseed_strength=p.subseed_strength) if state.interrupted: diff --git a/scripts/xy_grid.py b/scripts/xy_grid.py index cb1312a..3a2e103 100644 --- a/scripts/xy_grid.py +++ b/scripts/xy_grid.py @@ -102,7 +102,7 @@ def draw_xy_grid(p, xs, ys, x_labels, y_labels, cell, draw_legend): for iy, y in enumerate(ys): for ix, x in enumerate(xs): - state.job = f"Image {ix + iy * len(xs) + 1} out of {state.job_count}" + state.job = f"{ix + iy * len(xs) + 1} out of {len(xs) * len(ys)}" processed = cell(x, y) if first_pocessed is None: @@ -141,11 +141,11 @@ class Script(scripts.Script): y_values = gr.Textbox(label="Y values", visible=False, lines=1) draw_legend = gr.Checkbox(label='Draw legend', value=True) - fixed_seeds = gr.Checkbox(label='Resolve random seeds before plotting (only applies when plotting "-1" seed values for X or Y axis)', value=False) + no_fixed_seeds = gr.Checkbox(label='Keep -1 for seeds', value=False) - return [x_type, x_values, y_type, y_values, draw_legend, fixed_seeds] + return [x_type, x_values, y_type, y_values, draw_legend, no_fixed_seeds] - def run(self, p, x_type, x_values, y_type, y_values, draw_legend, fixed_seeds): + def run(self, p, x_type, x_values, y_type, y_values, draw_legend, no_fixed_seeds): modules.processing.fix_seed(p) p.batch_size = 1 @@ -170,7 +170,7 @@ class Script(scripts.Script): end = int(mc.group(2)) num = int(mc.group(3)) if mc.group(3) is not None else 1 - valslist_ext += [int(x) for x in np.linspace(start = start, stop = end, num = num).tolist()] + valslist_ext += [int(x) for x in np.linspace(start=start, stop=end, num=num).tolist()] else: valslist_ext.append(val) @@ -192,7 +192,7 @@ class Script(scripts.Script): end = float(mc.group(2)) num = int(mc.group(3)) if mc.group(3) is not None else 1 - valslist_ext += np.linspace(start = start, stop = end, num = num).tolist() + valslist_ext += np.linspace(start=start, stop=end, num=num).tolist() else: valslist_ext.append(val) @@ -214,7 +214,7 @@ class Script(scripts.Script): else: return axis_list - if fixed_seeds == True: + if not no_fixed_seeds: xs = fix_axis_seeds(x_opt, xs) ys = fix_axis_seeds(y_opt, ys) @@ -225,10 +225,7 @@ class Script(scripts.Script): else: total_steps = p.steps * len(xs) * len(ys) - if p.n_iter > 1: - print(f"Number of seeds/images per prompt is {p.n_iter}.") - - 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})") + 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})") shared.total_tqdm.updateTotal(total_steps * p.n_iter) def cell(x, y):