From a7b427c5ff41291c1c42c7edf4b27e6afe57015c Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Sun, 16 Jul 2023 14:51:50 +0530 Subject: [PATCH 1/8] Fix for rabbit hole --- ui/media/js/plugins.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ui/media/js/plugins.js b/ui/media/js/plugins.js index 972f0d7b..59af8edc 100644 --- a/ui/media/js/plugins.js +++ b/ui/media/js/plugins.js @@ -76,12 +76,23 @@ async function loadUIPlugins() { } const plugins = await res.json() const loadingPromises = plugins.map(loadScript) - return await Promise.allSettled(loadingPromises) + let x = await Promise.allSettled(loadingPromises) + + runPluginHacks() + + return x } catch (e) { console.log("error fetching plugin paths", e) } } +function runPluginHacks() { + // hacks to make existing plugins work when changing the interface + + // 16 Jul 2023 - v2.5.45 - hack for rabbit hole, lora field + window.LORA_slider = document.querySelector("#lora_model_container .model_strength") +} + /* PLUGIN MANAGER */ /* plugin tab */ From 5bd98d4aa07ad27c35aceaed624f182011f1a4b8 Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Sun, 16 Jul 2023 15:17:46 +0530 Subject: [PATCH 2/8] Revert "Fix for rabbit hole" This reverts commit a7b427c5ff41291c1c42c7edf4b27e6afe57015c. --- ui/media/js/plugins.js | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/ui/media/js/plugins.js b/ui/media/js/plugins.js index 59af8edc..972f0d7b 100644 --- a/ui/media/js/plugins.js +++ b/ui/media/js/plugins.js @@ -76,23 +76,12 @@ async function loadUIPlugins() { } const plugins = await res.json() const loadingPromises = plugins.map(loadScript) - let x = await Promise.allSettled(loadingPromises) - - runPluginHacks() - - return x + return await Promise.allSettled(loadingPromises) } catch (e) { console.log("error fetching plugin paths", e) } } -function runPluginHacks() { - // hacks to make existing plugins work when changing the interface - - // 16 Jul 2023 - v2.5.45 - hack for rabbit hole, lora field - window.LORA_slider = document.querySelector("#lora_model_container .model_strength") -} - /* PLUGIN MANAGER */ /* plugin tab */ From 14c1d17632a4daea1bed5cb0662efe11810bc530 Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Sun, 16 Jul 2023 15:46:24 +0530 Subject: [PATCH 3/8] Move the remove button to the left side of the lora, to increase the space for the model name --- ui/media/css/main.css | 12 +++++++++++- ui/media/js/main.js | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ui/media/css/main.css b/ui/media/css/main.css index b2014252..79cbc3b9 100644 --- a/ui/media/css/main.css +++ b/ui/media/css/main.css @@ -1684,7 +1684,17 @@ body.wait-pause { } .model_entry .model_name { - width: 65%; + width: 73%; +} + +.model_entry { + position: relative; +} + +.model_entry .remove_model_btn { + position: absolute; + left: -23pt; + top: 4pt; } .diffusers-disabled-on-startup .diffusers-restart-needed { diff --git a/ui/media/js/main.js b/ui/media/js/main.js index d2412a43..20359640 100644 --- a/ui/media/js/main.js +++ b/ui/media/js/main.js @@ -2262,6 +2262,8 @@ function addModelEntry(modelContainer, modelsList, modelType, defaultValue, stre let entry = [modelName, modelStrength, modelElement] let removeBtn = document.createElement("button") + removeBtn.className = "remove_model_btn" + removeBtn.setAttribute("title", "Remove model") removeBtn.innerHTML = '' if (modelsList.length === 0) { From 6ec7b78d969e8789bc7282d2bc3a8a354b82de8b Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Mon, 17 Jul 2023 20:44:30 +0530 Subject: [PATCH 4/8] sdkit 1.0.132 - fix for some loras - #1417 --- 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 8de1ff09..2a99af75 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.131", + "sdkit": "1.0.132", "stable-diffusion-sdkit": "2.1.4", "rich": "12.6.0", "uvicorn": "0.19.0", From 4832c67167bc99e74ce6203010978155bf52d80a Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Mon, 17 Jul 2023 21:35:06 +0530 Subject: [PATCH 5/8] sdkit 1.0.133 - some more keys 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 2a99af75..7a868578 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.132", + "sdkit": "1.0.133", "stable-diffusion-sdkit": "2.1.4", "rich": "12.6.0", "uvicorn": "0.19.0", From ca59866d529462f97c08c6e370437a8ed2e8bd91 Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Mon, 17 Jul 2023 23:30:36 +0530 Subject: [PATCH 6/8] sdkit 1.0.134 - don't prevent a lycoris from loading, use it partially, and warn the user in the logs --- 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 7a868578..03e50db0 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.133", + "sdkit": "1.0.134", "stable-diffusion-sdkit": "2.1.4", "rich": "12.6.0", "uvicorn": "0.19.0", From 7debd2cd972364f2c5037d1e63ffe30f636faafc Mon Sep 17 00:00:00 2001 From: JeLuF Date: Tue, 18 Jul 2023 00:08:38 +0200 Subject: [PATCH 7/8] Collapsibles for the embeddings dialog Harmonization with the modifiers dialog --- ui/index.html | 4 +++ ui/media/css/main.css | 30 ++++++++++++++++++- ui/media/js/image-modifiers.js | 20 ++----------- ui/media/js/main.js | 53 ++++++++++++++++++++++++++++++++-- ui/media/js/utils.js | 25 ++++++++++++++++ 5 files changed, 111 insertions(+), 21 deletions(-) diff --git a/ui/index.html b/ui/index.html index 490af689..4374c5ee 100644 --- a/ui/index.html +++ b/ui/index.html @@ -582,6 +582,10 @@
+   diff --git a/ui/media/css/main.css b/ui/media/css/main.css index 79cbc3b9..73ba6e31 100644 --- a/ui/media/css/main.css +++ b/ui/media/css/main.css @@ -1670,7 +1670,11 @@ body.wait-pause { #embeddings-list { height: 70vH; - width: 40vW; + width: 50vW; + margin-left: 0px; + margin-right: 0px; + padding-left: 0px; + padding-right: 0px; overflow-y: scroll; } @@ -1679,6 +1683,30 @@ body.wait-pause { margin-bottom: 2px; } +#embeddings-list .collapsible { + background: var(--background-color3); + margin: 0px; + padding: 0.5em; + position: sticky; +} + +#embeddings-list .embedding-category:nth-child(odd) .collapsible::before { + content: ''; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(255, 255, 255, 0.02); + opacity: 1; + pointer-events: none; +} + +#embeddings-list .collapsible-content { + padding-top: 0.4em; + padding-bottom: 0.4em; +} + #embeddings-list::-webkit-scrollbar-thumb { background: var(--background-color3); } diff --git a/ui/media/js/image-modifiers.js b/ui/media/js/image-modifiers.js index 03dc8b56..12952cad 100644 --- a/ui/media/js/image-modifiers.js +++ b/ui/media/js/image-modifiers.js @@ -425,27 +425,11 @@ function checkIfClickedOutsideDropdownElem(e) { } function collapseAllModifierCategory() { - const collapsibleElems = editorModifierEntries.querySelectorAll(".modifier-category .collapsible"); // needs to have ";" - - [...collapsibleElems].forEach((elem) => { - const isActive = elem.classList.contains("active") - - if(isActive) { - elem?.click() - } - }) + collapseAll(".modifier-category .collapsible") } function expandAllModifierCategory() { - const collapsibleElems = editorModifierEntries.querySelectorAll(".modifier-category .collapsible"); // needs to have ";" - - [...collapsibleElems].forEach((elem) => { - const isActive = elem.classList.contains("active") - - if (!isActive) { - elem?.click() - } - }) + expandAll(".modifier-category .collapsible") } customModifiersTextBox.addEventListener("change", saveCustomModifiers) diff --git a/ui/media/js/main.js b/ui/media/js/main.js index 20359640..023eb7b6 100644 --- a/ui/media/js/main.js +++ b/ui/media/js/main.js @@ -119,6 +119,7 @@ let embeddingsDialogCloseBtn = embeddingsDialog.querySelector("#embeddings-dialo let embeddingsSearchBox = document.querySelector("#embeddings-search-box") let embeddingsList = document.querySelector("#embeddings-list") let embeddingsModeField = document.querySelector("#embeddings-mode") +let embeddingsCollapsiblesBtn = document.querySelector("#embeddings-action-collapsibles-btn") let makeImageBtn = document.querySelector("#makeImage") let stopImageBtn = document.querySelector("#stopImage") @@ -2150,7 +2151,7 @@ function updateEmbeddingsList(filter = "") { } else { let subdir = html(m[1], prefix + m[0] + "/", filter) if (subdir != "") { - folders += `

${prefix}${m[0]}

` + subdir + folders += `

${prefix}${m[0]}

` + subdir + '
' } } }) @@ -2159,7 +2160,6 @@ function updateEmbeddingsList(filter = "") { function onButtonClick(e) { let text = e.target.dataset["embedding"] - console.log(e.shiftKey, text) if (embeddingsModeField.value == "insert") { if (e.shiftKey) { @@ -2197,6 +2197,10 @@ function updateEmbeddingsList(filter = "") { embeddingsList.querySelectorAll("button").forEach((b) => { b.addEventListener("click", onButtonClick) }) + createCollapsibles(embeddingsList) + if (filter != "") { + embeddingsExpandAll() + } } embeddingsButton.addEventListener("click", () => { @@ -2214,6 +2218,51 @@ embeddingsSearchBox.addEventListener("input", (e) => { modalDialogCloseOnBackdropClick(embeddingsDialog) makeDialogDraggable(embeddingsDialog) +const collapseText = "Collapse Categories" +const expandText = "Expand Categories" + +const collapseIconClasses = ["fa-solid", "fa-square-minus"] +const expandIconClasses = ["fa-solid", "fa-square-plus"] + +function embeddingsCollapseAll() { + const btnElem = embeddingsCollapsiblesBtn + + const iconElem = btnElem.querySelector(".embeddings-action-icon") + const textElem = btnElem.querySelector(".embeddings-action-text") + collapseAll("#embeddings-list .collapsible") + + collapsiblesBtnState = false + + collapseIconClasses.forEach((c) => iconElem.classList.remove(c)) + expandIconClasses.forEach((c) => iconElem.classList.add(c)) + + textElem.innerText = expandText +} + +function embeddingsExpandAll() { + const btnElem = embeddingsCollapsiblesBtn + + const iconElem = btnElem.querySelector(".embeddings-action-icon") + const textElem = btnElem.querySelector(".embeddings-action-text") + expandAll("#embeddings-list .collapsible") + + collapsiblesBtnState = true + + expandIconClasses.forEach((c) => iconElem.classList.remove(c)) + collapseIconClasses.forEach((c) => iconElem.classList.add(c)) + + textElem.innerText = collapseText +} + +embeddingsCollapsiblesBtn.addEventListener("click", (e) => { + if (collapsiblesBtnState) { + embeddingsCollapseAll() + } else { + embeddingsExpandAll() + } +}) + + if (testDiffusers.checked) { document.getElementById("embeddings-container").classList.remove("displayNone") } diff --git a/ui/media/js/utils.js b/ui/media/js/utils.js index bbacbb47..9db0d1cc 100644 --- a/ui/media/js/utils.js +++ b/ui/media/js/utils.js @@ -129,6 +129,31 @@ function tryLoadOldCollapsibles() { return null } +function collapseAll(selector) { + const collapsibleElems = document.querySelectorAll(selector); // needs to have ";" + + [...collapsibleElems].forEach((elem) => { + const isActive = elem.classList.contains("active") + + if(isActive) { + elem?.click() + } + }) +} + +function expandAll(selector) { + const collapsibleElems = document.querySelectorAll(selector); // needs to have ";" + + [...collapsibleElems].forEach((elem) => { + const isActive = elem.classList.contains("active") + + if (!isActive) { + elem?.click() + } + }) +} + + function permute(arr) { let permutations = [] let n = arr.length From fa2a929796d57209e7cf624f3a04a64eda0e914c Mon Sep 17 00:00:00 2001 From: JeLuF Date: Tue, 18 Jul 2023 00:41:47 +0200 Subject: [PATCH 8/8] Help texts for common errors - Using an Embedding on 'Low' - Using LORAs and models with mismatching versions --- ui/media/js/main.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ui/media/js/main.js b/ui/media/js/main.js index 20359640..494e6d4b 100644 --- a/ui/media/js/main.js +++ b/ui/media/js/main.js @@ -904,6 +904,22 @@ function onTaskCompleted(task, reqBody, instance, outputContainer, stepUpdate) { Windows or Linux.
3. Try restarting your computer.
` + } else if (msg.includes("RuntimeError: output with shape [320, 320] doesn't match the broadcast shape")) { + msg += `

+ Reason: You tried to use a LORA that was trained for a different Stable Diffusion model version! +

+ Suggestions: +
+ Try to use a different model or a different LORA.` + } else if (msg.includes("Tensor on device cuda:0 is not on the expected device meta")) { + msg += `

+ Reason: Due to some software issues, embeddings currently don't work with the "Low" memory profile. +

+ Suggestions: +
+ 1. Set the memory profile to "Balanced"
+ 2. Remove the embeddings from the prompt and the negative prompt
+ 3. Check whether the plugins you're using change the memory profile automatically.` } } else { msg = `Unexpected Read Error:
StepUpdate: ${JSON.stringify(stepUpdate, undefined, 4)}
`