mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2024-12-29 19:05:05 +08:00
xyz util confirm_range
This commit is contained in:
parent
501ac016da
commit
969a462ac9
@ -95,6 +95,17 @@ def confirm_checkpoints_or_none(p, xs):
|
||||
raise RuntimeError(f"Unknown checkpoint: {x}")
|
||||
|
||||
|
||||
def confirm_range(min_val, max_val, axis_label):
|
||||
"""Generates a AxisOption.confirm() function that checks all values are within the specified range."""
|
||||
|
||||
def confirm_range_fun(p, xs):
|
||||
for x in xs:
|
||||
if not (max_val >= x >= min_val):
|
||||
raise ValueError(f'{axis_label} value "{x}" out of range [{min_val}, {max_val}]')
|
||||
|
||||
return confirm_range_fun
|
||||
|
||||
|
||||
def apply_clip_skip(p, x, xs):
|
||||
opts.data["CLIP_stop_at_last_layers"] = x
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user