From 0d1ef296b9f7c4e78060ce167bb784246fa09de1 Mon Sep 17 00:00:00 2001 From: w-e-w <40751091+w-e-w@users.noreply.github.com> Date: Mon, 1 May 2023 05:22:53 +0900 Subject: [PATCH 1/6] checkpoint override enhancement --- modules/processing.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/processing.py b/modules/processing.py index a48fff99..e8808beb 100644 --- a/modules/processing.py +++ b/modules/processing.py @@ -498,6 +498,11 @@ def process_images(p: StableDiffusionProcessing) -> Processed: stored_opts = {k: opts.data[k] for k in p.override_settings.keys()} try: + # if no checkpoint override or the override checkpoint can't be found, remove override entry and load opts checkpoint + if sd_models.checkpoint_alisases.get(p.override_settings.get('sd_model_checkpoint')) is None: + p.override_settings.pop('sd_model_checkpoint', None) + sd_models.reload_model_weights() + for k, v in p.override_settings.items(): setattr(opts, k, v) @@ -514,8 +519,6 @@ def process_images(p: StableDiffusionProcessing) -> Processed: if p.override_settings_restore_afterwards: for k, v in stored_opts.items(): setattr(opts, k, v) - if k == 'sd_model_checkpoint': - sd_models.reload_model_weights() if k == 'sd_vae': sd_vae.reload_vae_weights() From cfbe68184c6e0659f92a6a91a9dd6249959270b1 Mon Sep 17 00:00:00 2001 From: w-e-w <40751091+w-e-w@users.noreply.github.com> Date: Mon, 1 May 2023 17:47:31 +0900 Subject: [PATCH 2/6] use override to apply checkpoint --- scripts/xyz_grid.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/xyz_grid.py b/scripts/xyz_grid.py index 398065d9..cfc7737b 100644 --- a/scripts/xyz_grid.py +++ b/scripts/xyz_grid.py @@ -86,7 +86,7 @@ def apply_checkpoint(p, x, xs): info = modules.sd_models.get_closet_checkpoint_match(x) if info is None: raise RuntimeError(f"Unknown checkpoint: {x}") - modules.sd_models.reload_model_weights(shared.sd_model, info) + p.override_settings['sd_model_checkpoint'] = info.hash def confirm_checkpoints(p, xs): From 94754c60c5e4b63e0a656efcdd886ee5c34c24f2 Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Sat, 29 Apr 2023 23:02:23 +0300 Subject: [PATCH 3/6] attempt to fix broken github CI --- launch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launch.py b/launch.py index e043e156..1dc12dae 100644 --- a/launch.py +++ b/launch.py @@ -222,7 +222,7 @@ def run_extensions_installers(settings_file): def prepare_environment(): - torch_command = os.environ.get('TORCH_COMMAND', "pip install torch==2.0.0 torchvision==0.15.1 --index-url https://download.pytorch.org/whl/cu118") + torch_command = os.environ.get('TORCH_COMMAND', "pip install torch==2.0.0 torchvision==0.15.1 --extra-index-url https://download.pytorch.org/whl/cu118") requirements_file = os.environ.get('REQS_FILE', "requirements_versions.txt") xformers_package = os.environ.get('XFORMERS_PACKAGE', 'xformers==0.0.17') From f15b7e52e33de1f0e2fcd99c9d4204ebb0fef536 Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Mon, 1 May 2023 13:47:46 +0300 Subject: [PATCH 4/6] Add a comment and partial fix for the issue when the inpaint UI is unresponsive after using it. --- modules/ui.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/ui.py b/modules/ui.py index 9ff4bcd9..7b45f131 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -810,7 +810,10 @@ def create_ui(): scale_by.release(**on_change_args) button_update_resize_to.click(**on_change_args) - for component in img2img_image_inputs: + # the code below is meant to update the resolution label after the image in the image selection UI has changed. + # as it is now the event keeps firing continuously for inpaint edits, which ruins the page with constant requests. + # I assume this must be a gradio bug and for now we'll just do it for non-inpaint inputs. + for component in [init_img, sketch]: component.change(fn=lambda: None, _js="updateImg2imgResizeToTextAfterChangingImage", inputs=[], outputs=[], show_progress=False) tab_scale_to.select(fn=lambda: 0, inputs=[], outputs=[selected_scale_tab]) From 67f5c2abb0a9293245de5f00f0b8cd82e2a7cdd0 Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Mon, 1 May 2023 13:58:10 +0300 Subject: [PATCH 5/6] make it impossible to press the restore progress button after pressing it once --- javascript/ui.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/javascript/ui.js b/javascript/ui.js index e14b33f5..42de9114 100644 --- a/javascript/ui.js +++ b/javascript/ui.js @@ -208,6 +208,8 @@ function submit_img2img(){ } function restoreProgressTxt2img(x){ + showRestoreProgressButton("txt2img", false) + id = localStorage.getItem("txt2img_task_id") if(id) { @@ -219,6 +221,8 @@ function restoreProgressTxt2img(x){ return [id] } function restoreProgressImg2img(x){ + showRestoreProgressButton("img2img", false) + id = localStorage.getItem("img2img_task_id") if(id) { From 33e6bc34ff4f826060489f0f76e6653672c8f1aa Mon Sep 17 00:00:00 2001 From: w-e-w <40751091+w-e-w@users.noreply.github.com> Date: Mon, 1 May 2023 19:59:52 +0900 Subject: [PATCH 6/6] restore_progress fix id wrong type --- javascript/ui.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/javascript/ui.js b/javascript/ui.js index e14b33f5..33a48b9a 100644 --- a/javascript/ui.js +++ b/javascript/ui.js @@ -216,7 +216,7 @@ function restoreProgressTxt2img(x){ }, null, 0) } - return [id] + return id } function restoreProgressImg2img(x){ id = localStorage.getItem("img2img_task_id") @@ -227,7 +227,7 @@ function restoreProgressImg2img(x){ }, null, 0) } - return [id] + return id }