aboutsummaryrefslogtreecommitdiff
path: root/scripts/xy_grid.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/xy_grid.py')
-rw-r--r--scripts/xy_grid.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/scripts/xy_grid.py b/scripts/xy_grid.py
index 26ae2199..07040886 100644
--- a/scripts/xy_grid.py
+++ b/scripts/xy_grid.py
@@ -145,7 +145,7 @@ def draw_xy_grid(p, xs, ys, x_labels, y_labels, cell, draw_legend):
ver_texts = [[images.GridAnnotation(y)] for y in y_labels]
hor_texts = [[images.GridAnnotation(x)] for x in x_labels]
- first_pocessed = None
+ first_processed = None
state.job_count = len(xs) * len(ys) * p.n_iter
@@ -154,8 +154,8 @@ def draw_xy_grid(p, xs, ys, x_labels, y_labels, cell, draw_legend):
state.job = f"{ix + iy * len(xs) + 1} out of {len(xs) * len(ys)}"
processed = cell(x, y)
- if first_pocessed is None:
- first_pocessed = processed
+ if first_processed is None:
+ first_processed = processed
try:
res.append(processed.images[0])
@@ -166,9 +166,9 @@ def draw_xy_grid(p, xs, ys, x_labels, y_labels, cell, draw_legend):
if draw_legend:
grid = images.draw_grid_annotations(grid, res[0].width, res[0].height, hor_texts, ver_texts)
- first_pocessed.images = [grid]
+ first_processed.images = [grid]
- return first_pocessed
+ return first_processed
re_range = re.compile(r"\s*([+-]?\s*\d+)\s*-\s*([+-]?\s*\d+)(?:\s*\(([+-]\d+)\s*\))?\s*")
@@ -216,7 +216,6 @@ class Script(scripts.Script):
m = re_range.fullmatch(val)
mc = re_range_count.fullmatch(val)
if m is not None:
-
start = int(m.group(1))
end = int(m.group(2))+1
step = int(m.group(3)) if m.group(3) is not None else 1
@@ -258,6 +257,16 @@ class Script(scripts.Script):
valslist = list(permutations(valslist))
valslist = [opt.type(x) for x in valslist]
+
+ # Confirm options are valid before starting
+ if opt.label == "Sampler":
+ for sampler_val in valslist:
+ if sampler_val.lower() not in samplers_dict.keys():
+ raise RuntimeError(f"Unknown sampler: {sampler_val}")
+ elif opt.label == "Checkpoint name":
+ for ckpt_val in valslist:
+ if modules.sd_models.get_closet_checkpoint_match(ckpt_val) is None:
+ raise RuntimeError(f"Checkpoint for {ckpt_val} not found")
return valslist