Reformat some changes from the previous commit.

This commit is contained in:
AUTOMATIC 2022-09-24 08:23:01 +03:00
parent ed8b8b3b8c
commit 31ac0baba0
2 changed files with 9 additions and 12 deletions

View File

@ -338,7 +338,7 @@ def process_images(p: StableDiffusionProcessing) -> Processed:
comments[comment] = 1 comments[comment] = 1
if p.n_iter > 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) samples_ddim = p.sample(conditioning=c, unconditional_conditioning=uc, seeds=seeds, subseeds=subseeds, subseed_strength=p.subseed_strength)
if state.interrupted: if state.interrupted:

View File

@ -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 iy, y in enumerate(ys):
for ix, x in enumerate(xs): 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) processed = cell(x, y)
if first_pocessed is None: if first_pocessed is None:
@ -141,11 +141,11 @@ class Script(scripts.Script):
y_values = gr.Textbox(label="Y values", visible=False, lines=1) y_values = gr.Textbox(label="Y values", visible=False, lines=1)
draw_legend = gr.Checkbox(label='Draw legend', value=True) 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) modules.processing.fix_seed(p)
p.batch_size = 1 p.batch_size = 1
@ -170,7 +170,7 @@ class Script(scripts.Script):
end = int(mc.group(2)) end = int(mc.group(2))
num = int(mc.group(3)) if mc.group(3) is not None else 1 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: else:
valslist_ext.append(val) valslist_ext.append(val)
@ -192,7 +192,7 @@ class Script(scripts.Script):
end = float(mc.group(2)) end = float(mc.group(2))
num = int(mc.group(3)) if mc.group(3) is not None else 1 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: else:
valslist_ext.append(val) valslist_ext.append(val)
@ -214,7 +214,7 @@ class Script(scripts.Script):
else: else:
return axis_list return axis_list
if fixed_seeds == True: if not no_fixed_seeds:
xs = fix_axis_seeds(x_opt, xs) xs = fix_axis_seeds(x_opt, xs)
ys = fix_axis_seeds(y_opt, ys) ys = fix_axis_seeds(y_opt, ys)
@ -225,10 +225,7 @@ class Script(scripts.Script):
else: else:
total_steps = p.steps * len(xs) * len(ys) total_steps = p.steps * len(xs) * len(ys)
if p.n_iter > 1: 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"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})")
shared.total_tqdm.updateTotal(total_steps * p.n_iter) shared.total_tqdm.updateTotal(total_steps * p.n_iter)
def cell(x, y): def cell(x, y):