Skip to content

Commit

Permalink
Merge branch 'lllyasviel:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
metercai authored Jun 22, 2024
2 parents b449e34 + 9178aa8 commit 48b4568
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
3 changes: 2 additions & 1 deletion modules/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions modules/flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -151,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]
Expand Down
9 changes: 5 additions & 4 deletions modules/meta_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -232,7 +233,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:
Expand Down

0 comments on commit 48b4568

Please sign in to comment.