feat: add backwards compatibility for presets without disable/enable LoRA boolean

https://github.com/lllyasviel/Fooocus/pull/2507
This commit is contained in:
Manuel Schmid 2024-03-18 17:40:37 +01:00
parent 6b44c101db
commit c08518abae
No known key found for this signature in database
GPG Key ID: 32C4F7569B40B84B

View File

@ -323,8 +323,12 @@ default_loras = get_config_item_or_set_default(
1.0 1.0
] ]
], ],
validator=lambda x: isinstance(x, list) and all(len(y) == 3 and isinstance(y[0], bool) and isinstance(y[1], str) and isinstance(y[2], numbers.Number) for y in x) validator=lambda x: isinstance(x, list) and all(
len(y) == 3 and isinstance(y[0], bool) and isinstance(y[1], str) and isinstance(y[2], numbers.Number)
or len(y) == 2 and isinstance(y[0], str) and isinstance(y[1], numbers.Number)
for y in x)
) )
default_loras = [(y[0], y[1], y[2]) if len(y) == 3 else (True, y[0], y[1]) for y in default_loras]
default_max_lora_number = get_config_item_or_set_default( default_max_lora_number = get_config_item_or_set_default(
key='default_max_lora_number', key='default_max_lora_number',
default_value=len(default_loras) if isinstance(default_loras, list) and len(default_loras) > 0 else 5, default_value=len(default_loras) if isinstance(default_loras, list) and len(default_loras) > 0 else 5,