From 3e453501f702a7d419dd4b4a2067ab6a7daca495 Mon Sep 17 00:00:00 2001 From: Manuel Schmid <9307310+mashb1t@users.noreply.github.com> Date: Sun, 16 Jun 2024 16:52:58 +0200 Subject: [PATCH 1/4] fix: correctly identify and remove performance LoRA (#3150) --- modules/meta_parser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/meta_parser.py b/modules/meta_parser.py index 0d509a193..02dfc1809 100644 --- a/modules/meta_parser.py +++ b/modules/meta_parser.py @@ -61,7 +61,7 @@ def load_parameter_button_click(raw_metadata: dict | str, is_generating: bool): # prevent performance LoRAs to be added twice, by performance and by lora performance_filename = None - if performance is not None and performance in Performance.list(): + if performance is not None and performance in Performance.values(): performance = Performance(performance) performance_filename = performance.lora_filename() @@ -232,7 +232,7 @@ def parse_meta_from_preset(preset_content): loras = getattr(modules.config, settings_key) if settings_key in items: loras = items[settings_key] - for index, lora in enumerate(loras[:5]): + for index, lora in enumerate(loras[:modules.config.default_max_lora_number]): preset_prepared[f'lora_combined_{index + 1}'] = ' : '.join(map(str, lora)) elif settings_key == "default_aspect_ratio": if settings_key in items and items[settings_key] is not None: From 9d41c9521bcac2aa5d59e423ad576da3922ede07 Mon Sep 17 00:00:00 2001 From: Manuel Schmid <9307310+mashb1t@users.noreply.github.com> Date: Sun, 16 Jun 2024 18:44:16 +0200 Subject: [PATCH 2/4] fix: add workaround for same value in Steps IntEnum (#3153) --- modules/flags.py | 4 ++++ modules/meta_parser.py | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/flags.py b/modules/flags.py index adaea1d19..8b35daea3 100644 --- a/modules/flags.py +++ b/modules/flags.py @@ -131,6 +131,10 @@ class Steps(IntEnum): LIGHTNING = 4 HYPER_SD = 4 + @classmethod + def keys(cls) -> list: + return list(map(lambda c: c, Steps.__members__)) + class StepsUOV(IntEnum): QUALITY = 36 diff --git a/modules/meta_parser.py b/modules/meta_parser.py index 02dfc1809..ff930cc0b 100644 --- a/modules/meta_parser.py +++ b/modules/meta_parser.py @@ -119,8 +119,9 @@ def get_steps(key: str, fallback: str | None, source_dict: dict, results: list, assert h is not None h = int(h) # if not in steps or in steps and performance is not the same - if h not in iter(Steps) or Steps(h).name.casefold() != source_dict.get('performance', '').replace(' ', - '_').casefold(): + performance_name = source_dict.get('performance', '').replace(' ', '_').replace('-', '_').casefold() + performance_candidates = [key for key in Steps.keys() if key.casefold() == performance_name and Steps[key] == h] + if len(performance_candidates) == 0: results.append(h) return results.append(-1) From 7c1a101c0f4bffc7b596cd7c0cb258a6fb843145 Mon Sep 17 00:00:00 2001 From: Manuel Schmid <9307310+mashb1t@users.noreply.github.com> Date: Sun, 16 Jun 2024 18:53:20 +0200 Subject: [PATCH 3/4] hotfix: add missing method in performance enum (#3154) --- modules/flags.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/flags.py b/modules/flags.py index 8b35daea3..29ac4615f 100644 --- a/modules/flags.py +++ b/modules/flags.py @@ -155,6 +155,10 @@ class Performance(Enum): def list(cls) -> list: return list(map(lambda c: c.value, cls)) + @classmethod + def values(cls) -> list: + return list(map(lambda c: c.value, cls)) + @classmethod def by_steps(cls, steps: int | str): return cls[Steps(int(steps)).name] From 9178aa8ebba5d7595554ef3adfe8ca995cf32ee0 Mon Sep 17 00:00:00 2001 From: Manuel Schmid <9307310+mashb1t@users.noreply.github.com> Date: Fri, 21 Jun 2024 20:24:11 +0200 Subject: [PATCH 4/4] feat: add vae to possible preset keys (#3177) set default_vae in any preset to use it --- modules/config.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/config.py b/modules/config.py index e3c427d2c..a6767c370 100644 --- a/modules/config.py +++ b/modules/config.py @@ -546,7 +546,8 @@ def init_temp_path(path: str | None, default_path: str) -> str: "default_save_metadata_to_images": "default_save_metadata_to_images", "checkpoint_downloads": "checkpoint_downloads", "embeddings_downloads": "embeddings_downloads", - "lora_downloads": "lora_downloads" + "lora_downloads": "lora_downloads", + "default_vae": "vae" } REWRITE_PRESET = False