From db55064bb218842a14773d17a96edddd417d2835 Mon Sep 17 00:00:00 2001 From: Olivia Godone-Maresca Date: Sun, 9 Jul 2023 16:54:25 -0400 Subject: [PATCH 01/10] Add Restart needed to diffusers-only fields if you enable diffusers then refresh without restarting EasyDiffusion --- ui/easydiffusion/app.py | 15 ++++++++++++-- ui/index.html | 43 +++++++++++++++++++++++---------------- ui/media/css/main.css | 13 ++++++++++++ ui/media/js/main.js | 5 ++++- ui/media/js/parameters.js | 12 ++++++++++- 5 files changed, 67 insertions(+), 21 deletions(-) diff --git a/ui/easydiffusion/app.py b/ui/easydiffusion/app.py index 8e317d83..40a9792f 100644 --- a/ui/easydiffusion/app.py +++ b/ui/easydiffusion/app.py @@ -5,7 +5,7 @@ import shutil import socket import sys import traceback -import shlex +import copy from ruamel.yaml import YAML import urllib @@ -102,7 +102,6 @@ def init_render_threads(): update_render_threads() - def getConfig(default_val=APP_CONFIG_DEFAULTS): config_yaml_path = os.path.join(CONFIG_DIR, "..", "config.yaml") @@ -111,6 +110,11 @@ def getConfig(default_val=APP_CONFIG_DEFAULTS): if os.path.isfile(config_legacy_yaml): shutil.move(config_legacy_yaml, config_yaml_path) + def set_default_config(config: dict): + if (getConfig.__config_on_startup is None): + getConfig.__config_on_startup = copy.deepcopy(config) + config["config_on_startup"] = getConfig.__config_on_startup + if os.path.isfile(config_yaml_path): try: yaml = YAML() @@ -126,9 +130,13 @@ def getConfig(default_val=APP_CONFIG_DEFAULTS): config["net"]["listen_to_network"] = os.getenv("SD_UI_BIND_IP") == "0.0.0.0" else: config["net"]["listen_to_network"] = True + + set_default_config(config) + return config except Exception as e: log.warn(traceback.format_exc()) + set_default_config(default_val) return default_val else: try: @@ -149,8 +157,11 @@ def getConfig(default_val=APP_CONFIG_DEFAULTS): return getConfig(default_val) except Exception as e: log.warn(traceback.format_exc()) + set_default_config(default_val) return default_val +getConfig.__config_on_startup = None + def setConfig(config): try: # config.yaml diff --git a/ui/index.html b/ui/index.html index 47b05240..1ebde256 100644 --- a/ui/index.html +++ b/ui/index.html @@ -142,7 +142,7 @@ - + Click to learn more about Clip Skip @@ -227,12 +227,15 @@
- - - + + + + + + - + -2 2  
@@ -244,18 +247,24 @@
- - - - - - Click to learn more about Seamless Tiling - + + + + + + + + + + + Click to learn more about Seamless Tiling + + diff --git a/ui/media/css/main.css b/ui/media/css/main.css index 0297228f..b22a45d4 100644 --- a/ui/media/css/main.css +++ b/ui/media/css/main.css @@ -906,6 +906,10 @@ div.img-preview img { white-space: nowrap; } +#editor-settings-entries table { + width: 93%; +} + #negative_prompt { width: 100%; } @@ -1680,5 +1684,5 @@ body.wait-pause { } .model_entry .model_name { - width: 70%; + width: 65%; } \ No newline at end of file diff --git a/ui/media/js/auto-save.js b/ui/media/js/auto-save.js index 1ff51e2e..670fee0d 100644 --- a/ui/media/js/auto-save.js +++ b/ui/media/js/auto-save.js @@ -16,9 +16,6 @@ const SETTINGS_IDS_LIST = [ "clip_skip", "vae_model", "hypernetwork_model", - "lora_model_0", - "lora_model_1", - "lora_model_2", "sampler_name", "width", "height", @@ -26,9 +23,6 @@ const SETTINGS_IDS_LIST = [ "guidance_scale", "prompt_strength", "hypernetwork_strength", - "lora_alpha_0", - "lora_alpha_1", - "lora_alpha_2", "tiling", "output_format", "output_quality", diff --git a/ui/media/js/dnd.js b/ui/media/js/dnd.js index 7128bc69..3cca985d 100644 --- a/ui/media/js/dnd.js +++ b/ui/media/js/dnd.js @@ -292,6 +292,11 @@ const TASK_MAPPING = { use_lora_model: { name: "LoRA model", setUI: (use_lora_model) => { + // create rows + for (let i = loraModels.length; i < use_lora_model.length; i++) { + createLoraEntry() + } + use_lora_model.forEach((model_name, i) => { let field = loraModels[i][0] const oldVal = field.value @@ -304,9 +309,13 @@ const TASK_MAPPING = { }) // clear the remaining entries + let container = document.querySelector("#lora_model_container .model_entries") for (let i = use_lora_model.length; i < loraModels.length; i++) { - loraModels[i][0].value = "" + let modelEntry = loraModels[i][2] + container.removeChild(modelEntry) } + + loraModels.splice(use_lora_model.length) }, readUI: () => { let values = loraModels.map((e) => e[0].value) @@ -323,15 +332,23 @@ const TASK_MAPPING = { lora_alpha: { name: "LoRA Strength", setUI: (lora_alpha) => { + for (let i = loraModels.length; i < lora_alpha.length; i++) { + createLoraEntry() + } + lora_alpha.forEach((model_strength, i) => { let field = loraModels[i][1] field.value = model_strength }) // clear the remaining entries + let container = document.querySelector("#lora_model_container .model_entries") for (let i = lora_alpha.length; i < loraModels.length; i++) { - loraModels[i][1].value = 0 + let modelEntry = loraModels[i][2] + container.removeChild(modelEntry) } + + loraModels.splice(lora_alpha.length) }, readUI: () => { let models = loraModels.filter((e) => e[0].value.trim() !== "") diff --git a/ui/media/js/main.js b/ui/media/js/main.js index c31a890b..d2412a43 100644 --- a/ui/media/js/main.js +++ b/ui/media/js/main.js @@ -2242,31 +2242,59 @@ promptField.focus() promptField.selectionStart = promptField.value.length // multi-models -function addModelEntry(i, modelContainer, modelsList, modelType, defaultValue, strengthStep) { - let nameId = modelType + "_model_" + i - let strengthId = modelType + "_alpha_" + i +let modelCount = 0 - const modelEntry = document.createElement("div") - modelEntry.className = "model_entry" - modelEntry.innerHTML = ` +function addModelEntry(modelContainer, modelsList, modelType, defaultValue, strengthStep) { + let idx = modelCount++ + let nameId = modelType + "_model_" + idx + let strengthId = modelType + "_alpha_" + idx + + const modelElement = document.createElement("div") + modelElement.className = "model_entry" + modelElement.innerHTML = ` -
+ ` + modelContainer.appendChild(modelElement) - let modelName = new ModelDropdown(modelEntry.querySelector(".model_name"), modelType, "None") - let modelStrength = modelEntry.querySelector(".model_strength") + let modelName = new ModelDropdown(modelElement.querySelector(".model_name"), modelType, "None") + let modelStrength = modelElement.querySelector(".model_strength") + let entry = [modelName, modelStrength, modelElement] - modelContainer.appendChild(modelEntry) - modelsList.push([modelName, modelStrength]) -} + let removeBtn = document.createElement("button") + removeBtn.innerHTML = '' -function createLoRAEntries() { - let container = document.querySelector("#lora_model_container .model_entries") - for (let i = 0; i < 3; i++) { - addModelEntry(i, container, loraModels, "lora", 0.5, 0.02) + if (modelsList.length === 0) { + removeBtn.classList.add("displayNone") } + + removeBtn.addEventListener("click", function() { + let entryIdx = modelsList.indexOf(entry) + modelsList.splice(entryIdx, 1) + modelContainer.removeChild(modelElement) + }) + + modelElement.appendChild(removeBtn) + + modelsList.push(entry) + + return modelElement } -createLoRAEntries() + +function createLoraEntry() { + let container = document.querySelector("#lora_model_container .model_entries") + return addModelEntry(container, loraModels, "lora", 0.5, 0.02) +} + +function createLoraEntries() { + let firstEntry = createLoraEntry() + + let addLoraBtn = document.querySelector("#lora_model_container .add_model_entry") + addLoraBtn.addEventListener("click", () => { + createLoraEntry() + }) +} +createLoraEntries() // chrome-like spinners only on hover // function showSpinnerOnlyOnHover(e) { From b58b7660ab67a4d3ca1b917e2f9ba21824a2f38d Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Sun, 16 Jul 2023 02:27:32 +0530 Subject: [PATCH 06/10] sdkit 1.0.129 - 1.6x multiplier for lora --- scripts/check_modules.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/check_modules.py b/scripts/check_modules.py index c2b50796..392f7344 100644 --- a/scripts/check_modules.py +++ b/scripts/check_modules.py @@ -18,7 +18,7 @@ os_name = platform.system() modules_to_check = { "torch": ("1.11.0", "1.13.1", "2.0.0"), "torchvision": ("0.12.0", "0.14.1", "0.15.1"), - "sdkit": "1.0.128", + "sdkit": "1.0.129", "stable-diffusion-sdkit": "2.1.4", "rich": "12.6.0", "uvicorn": "0.19.0", From 66624f40115b308954c8f08d682991b4fa1e3998 Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Sun, 16 Jul 2023 02:31:01 +0530 Subject: [PATCH 07/10] sdkit 1.0.130 - 2x multiplier for lora --- scripts/check_modules.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/check_modules.py b/scripts/check_modules.py index 392f7344..fa83d9a9 100644 --- a/scripts/check_modules.py +++ b/scripts/check_modules.py @@ -18,7 +18,7 @@ os_name = platform.system() modules_to_check = { "torch": ("1.11.0", "1.13.1", "2.0.0"), "torchvision": ("0.12.0", "0.14.1", "0.15.1"), - "sdkit": "1.0.129", + "sdkit": "1.0.130", "stable-diffusion-sdkit": "2.1.4", "rich": "12.6.0", "uvicorn": "0.19.0", From 812fc20c39a248d90b8d9d6865fc4203a43b8989 Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Sun, 16 Jul 2023 12:58:01 +0530 Subject: [PATCH 08/10] sdkit 1.0.131 - Fix loras ignoring several layers --- scripts/check_modules.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/check_modules.py b/scripts/check_modules.py index fa83d9a9..8de1ff09 100644 --- a/scripts/check_modules.py +++ b/scripts/check_modules.py @@ -18,7 +18,7 @@ os_name = platform.system() modules_to_check = { "torch": ("1.11.0", "1.13.1", "2.0.0"), "torchvision": ("0.12.0", "0.14.1", "0.15.1"), - "sdkit": "1.0.130", + "sdkit": "1.0.131", "stable-diffusion-sdkit": "2.1.4", "rich": "12.6.0", "uvicorn": "0.19.0", From ace53d211f84b593f1e220d831c72dc170b9a533 Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Sun, 16 Jul 2023 12:59:18 +0530 Subject: [PATCH 09/10] changelog --- CHANGES.md | 1 + ui/index.html | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index df8a7b80..09af93d3 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -22,6 +22,7 @@ Our focus continues to remain on an easy installation experience, and an easy user-interface. While still remaining pretty powerful, in terms of features and speed. ### Detailed changelog +* 2.5.45 - 16 Jul 2023 - (beta-only) Fix the image quality of LoRAs, which had degraded in v2.5.44. * 2.5.44 - 15 Jul 2023 - (beta-only) Support for multiple LoRA files. * 2.5.43 - 9 Jul 2023 - (beta-only) Support for loading Textual Inversion embeddings. You can find the option in the Image Settings panel. Thanks @JeLuf. * 2.5.43 - 9 Jul 2023 - Improve the startup time of the UI. diff --git a/ui/index.html b/ui/index.html index e1177a56..3688a08c 100644 --- a/ui/index.html +++ b/ui/index.html @@ -31,7 +31,7 @@

Easy Diffusion - v2.5.44 + v2.5.45

From 47b157c24a12aacbc87d681fb3acd11e28c33e86 Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Sun, 16 Jul 2023 13:28:54 +0530 Subject: [PATCH 10/10] wording --- ui/media/css/main.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/media/css/main.css b/ui/media/css/main.css index afe5726a..b2014252 100644 --- a/ui/media/css/main.css +++ b/ui/media/css/main.css @@ -1696,6 +1696,6 @@ body.wait-pause { } .diffusers-disabled-on-startup .diffusers-restart-needed::after { - content: "Restart needed"; + content: "Please restart Easy Diffusion!"; font-size: 10pt; }