From 5194a58278c0a81b30981a9e3432a3cbdb4cbf4d Mon Sep 17 00:00:00 2001 From: achaiah Date: Sat, 24 Sep 2022 22:37:27 -0500 Subject: [PATCH 1/6] removing duplicates removing duplicated requirements (transformers, diffusers) and reorganizing alphabetically to be able to spot duplicates in the future. --- requirements.txt | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/requirements.txt b/requirements.txt index 52638333c..089355065 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,22 +1,20 @@ -transformers -diffusers basicsr -gfpgan -gradio -numpy -Pillow -realesrgan -torch -transformers -omegaconf -pytorch_lightning diffusers -invisible-watermark -scikit-image>=0.19 +fairscale==0.4.4 fonts font-roboto +gfpgan +gradio +invisible-watermark git+https://github.com/crowsonkb/k-diffusion.git +numpy +omegaconf +piexif +Pillow +pytorch_lightning +realesrgan +scikit-image>=0.19 git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379 timm==0.4.12 -fairscale==0.4.4 -piexif +transformers +torch From 714dcda068b2cbcef5078cc36fbd887683029c98 Mon Sep 17 00:00:00 2001 From: DepFA <35278260+dfaker@users.noreply.github.com> Date: Sun, 25 Sep 2022 03:42:56 +0100 Subject: [PATCH 2/6] Add attributes to checkboxes for persisting --- modules/ui.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/ui.py b/modules/ui.py index 19ed5002e..ebf521c0d 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -418,7 +418,9 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo): with gr.Row(): restore_faces = gr.Checkbox(label='Restore faces', value=False, visible=len(shared.face_restorers) > 1) + restore_faces.add_to_ui_config = True tiling = gr.Checkbox(label='Tiling', value=False) + tiling.add_to_ui_config = True enable_hr = gr.Checkbox(label='Highres. fix', value=False) with gr.Row(visible=False) as hr_options: @@ -575,6 +577,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo): with gr.Row(): inpaint_full_res = gr.Checkbox(label='Inpaint at full resolution', value=False) + inpaint_full_res.add_to_ui_config = True inpaint_full_res_padding = gr.Slider(label='Inpaint at full resolution padding, pixels', minimum=0, maximum=256, step=4, value=32) with gr.TabItem('Batch img2img', id='batch'): @@ -595,7 +598,9 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo): with gr.Row(): restore_faces = gr.Checkbox(label='Restore faces', value=False, visible=len(shared.face_restorers) > 1) + restore_faces.add_to_ui_config = True tiling = gr.Checkbox(label='Tiling', value=False) + tiling.add_to_ui_config = True with gr.Row(): batch_count = gr.Slider(minimum=1, maximum=cmd_opts.max_batch_count, step=1, label='Batch count', value=1) @@ -1054,6 +1059,9 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo): if type(x) == gr.Radio: apply_field(x, 'value', lambda val: val in x.choices) + if type(x) == gr.Checkbox and getattr(x,'add_to_ui_config',False): + apply_field(x, 'value') + visit(txt2img_interface, loadsave, "txt2img") visit(img2img_interface, loadsave, "img2img") visit(extras_interface, loadsave, "extras") From b1320d79b5816e229eac0602f2e7e18141b088aa Mon Sep 17 00:00:00 2001 From: DepFA <35278260+dfaker@users.noreply.github.com> Date: Sun, 25 Sep 2022 06:31:02 +0100 Subject: [PATCH 3/6] Apply to all checkboxes and textboxes --- modules/ui.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/modules/ui.py b/modules/ui.py index ebf521c0d..662396e97 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -418,9 +418,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo): with gr.Row(): restore_faces = gr.Checkbox(label='Restore faces', value=False, visible=len(shared.face_restorers) > 1) - restore_faces.add_to_ui_config = True tiling = gr.Checkbox(label='Tiling', value=False) - tiling.add_to_ui_config = True enable_hr = gr.Checkbox(label='Highres. fix', value=False) with gr.Row(visible=False) as hr_options: @@ -577,7 +575,6 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo): with gr.Row(): inpaint_full_res = gr.Checkbox(label='Inpaint at full resolution', value=False) - inpaint_full_res.add_to_ui_config = True inpaint_full_res_padding = gr.Slider(label='Inpaint at full resolution padding, pixels', minimum=0, maximum=256, step=4, value=32) with gr.TabItem('Batch img2img', id='batch'): @@ -598,9 +595,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo): with gr.Row(): restore_faces = gr.Checkbox(label='Restore faces', value=False, visible=len(shared.face_restorers) > 1) - restore_faces.add_to_ui_config = True tiling = gr.Checkbox(label='Tiling', value=False) - tiling.add_to_ui_config = True with gr.Row(): batch_count = gr.Slider(minimum=1, maximum=cmd_opts.max_batch_count, step=1, label='Batch count', value=1) @@ -1059,7 +1054,10 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo): if type(x) == gr.Radio: apply_field(x, 'value', lambda val: val in x.choices) - if type(x) == gr.Checkbox and getattr(x,'add_to_ui_config',False): + if type(x) == gr.Checkbox: + apply_field(x, 'value') + + if type(x) == gr.Textbox: apply_field(x, 'value') visit(txt2img_interface, loadsave, "txt2img") From ca13264609e9c2667358461be52cf782895841dd Mon Sep 17 00:00:00 2001 From: DepFA <35278260+dfaker@users.noreply.github.com> Date: Sun, 25 Sep 2022 06:34:03 +0100 Subject: [PATCH 4/6] Add attr to skip --- modules/ui.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/ui.py b/modules/ui.py index 662396e97..228b3905f 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -1038,7 +1038,10 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo): def loadsave(path, x): def apply_field(obj, field, condition=None): key = path + "/" + field - + + if getattr(obj,'do_not_save_to_config',False): + return + saved_value = ui_settings.get(key, None) if saved_value is None: ui_settings[key] = getattr(obj, field) From ab5a472556782801b275bd317790dae7a2cd4a98 Mon Sep 17 00:00:00 2001 From: DepFA <35278260+dfaker@users.noreply.github.com> Date: Sun, 25 Sep 2022 06:39:22 +0100 Subject: [PATCH 5/6] Persist default Number values --- modules/ui.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/ui.py b/modules/ui.py index 228b3905f..4862a2678 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -1062,7 +1062,10 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo): if type(x) == gr.Textbox: apply_field(x, 'value') - + + if type(x) == gr.Number: + apply_field(x, 'value') + visit(txt2img_interface, loadsave, "txt2img") visit(img2img_interface, loadsave, "img2img") visit(extras_interface, loadsave, "extras") From 72e2a96284e0cbc11ebea7e8cd6739175dbc63af Mon Sep 17 00:00:00 2001 From: DepFA <35278260+dfaker@users.noreply.github.com> Date: Sun, 25 Sep 2022 06:40:37 +0100 Subject: [PATCH 6/6] Correct indent --- modules/ui.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/ui.py b/modules/ui.py index 4862a2678..87803ac28 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -1058,13 +1058,13 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo): apply_field(x, 'value', lambda val: val in x.choices) if type(x) == gr.Checkbox: - apply_field(x, 'value') + apply_field(x, 'value') if type(x) == gr.Textbox: - apply_field(x, 'value') + apply_field(x, 'value') if type(x) == gr.Number: - apply_field(x, 'value') + apply_field(x, 'value') visit(txt2img_interface, loadsave, "txt2img") visit(img2img_interface, loadsave, "img2img")