diff options
author | AUTOMATIC <16777216c@gmail.com> | 2022-11-27 10:43:10 +0000 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2022-11-27 10:43:10 +0000 |
commit | 10923f9b3a10a9af20429e51242614e259fbd434 (patch) | |
tree | a8855751a8ff12ff71f60ddb7da678a7ad6f583c /scripts/xy_grid.py | |
parent | 40ca34b837b5068ec35b8d5681bae32cf28f5816 (diff) | |
download | stable-diffusion-webui-gfx803-10923f9b3a10a9af20429e51242614e259fbd434.tar.gz stable-diffusion-webui-gfx803-10923f9b3a10a9af20429e51242614e259fbd434.tar.bz2 stable-diffusion-webui-gfx803-10923f9b3a10a9af20429e51242614e259fbd434.zip |
calculate dictionary for sampler names only once
Diffstat (limited to 'scripts/xy_grid.py')
-rw-r--r-- | scripts/xy_grid.py | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/scripts/xy_grid.py b/scripts/xy_grid.py index 2517c47d..0f27deda 100644 --- a/scripts/xy_grid.py +++ b/scripts/xy_grid.py @@ -58,19 +58,10 @@ def apply_order(p, x, xs): prompt_tmp += part
prompt_tmp += x[idx]
p.prompt = prompt_tmp + p.prompt
-
-
-def build_samplers_dict():
- samplers_dict = {}
- for sampler in sd_samplers.all_samplers:
- samplers_dict[sampler.name.lower()] = sampler.name
- for alias in sampler.aliases:
- samplers_dict[alias.lower()] = sampler.name
- return samplers_dict
def apply_sampler(p, x, xs):
- sampler_name = build_samplers_dict().get(x.lower(), None)
+ sampler_name = sd_samplers.samplers_map.get(x.lower(), None)
if sampler_name is None:
raise RuntimeError(f"Unknown sampler: {x}")
@@ -78,9 +69,8 @@ def apply_sampler(p, x, xs): def confirm_samplers(p, xs):
- samplers_dict = build_samplers_dict()
for x in xs:
- if x.lower() not in samplers_dict:
+ if x.lower() not in sd_samplers.samplers_map:
raise RuntimeError(f"Unknown sampler: {x}")
|