feat: make lora min max weight editable in config (#2216)

* Initial commit

* Update README.md

* sync with original main Fooocus repo

* update with my gitignore setup

* add min max weight configs feature

* add max lora config feature

* Revert "add max lora config feature"

This reverts commit cfe7463fe2.

* Update README.md

* Update .gitignore

* update

* merge

* revert

---------

Co-authored-by: Manuel Schmid <manuel.schmid@odt.net>
This commit is contained in:
MindOfMatter 2024-02-25 15:36:25 -05:00 committed by GitHub
parent 18f9f7dc31
commit 3be76ef8a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 1 deletions

View File

@ -209,6 +209,16 @@ default_refiner_switch = get_config_item_or_set_default(
default_value=0.8,
validator=lambda x: isinstance(x, numbers.Number) and 0 <= x <= 1
)
default_loras_min_weight = get_config_item_or_set_default(
key='default_loras_min_weight',
default_value=-2,
validator=lambda x: isinstance(x, numbers.Number) and -10 <= x <= 10
)
default_loras_max_weight = get_config_item_or_set_default(
key='default_loras_max_weight',
default_value=2,
validator=lambda x: isinstance(x, numbers.Number) and -10 <= x <= 10
)
default_loras = get_config_item_or_set_default(
key='default_loras',
default_value=[
@ -368,6 +378,8 @@ possible_preset_keys = [
"default_model",
"default_refiner",
"default_refiner_switch",
"default_loras_min_weight",
"default_loras_max_weight",
"default_loras",
"default_max_lora_number",
"default_cfg_scale",

View File

@ -327,7 +327,8 @@ with shared.gradio_root:
lora_model = gr.Dropdown(label=f'LoRA {i + 1}',
choices=['None'] + modules.config.lora_filenames, value=n,
elem_classes='lora_model')
lora_weight = gr.Slider(label='Weight', minimum=-2, maximum=2, step=0.01, value=v,
lora_weight = gr.Slider(label='Weight', minimum=modules.config.default_loras_min_weight,
maximum=modules.config.default_loras_max_weight, step=0.01, value=v,
elem_classes='lora_weight')
lora_ctrls += [lora_enabled, lora_model, lora_weight]