Use these Settings work for multi-lora now

This commit is contained in:
cmdr2 2023-08-18 17:18:01 +05:30
parent 894f34678e
commit 767d8fc35d

View File

@ -293,6 +293,7 @@ const TASK_MAPPING = {
name: "LoRA model", name: "LoRA model",
setUI: (use_lora_model) => { setUI: (use_lora_model) => {
let modelPaths = [] let modelPaths = []
use_lora_model = Array.isArray(use_lora_model) ? use_lora_model : [use_lora_model]
use_lora_model.forEach((m) => { use_lora_model.forEach((m) => {
if (m.includes("models\\lora\\")) { if (m.includes("models\\lora\\")) {
m = m.split("models\\lora\\")[1] m = m.split("models\\lora\\")[1]
@ -329,6 +330,7 @@ const TASK_MAPPING = {
lora_alpha: { lora_alpha: {
name: "LoRA Strength", name: "LoRA Strength",
setUI: (lora_alpha) => { setUI: (lora_alpha) => {
lora_alpha = Array.isArray(lora_alpha) ? lora_alpha : [lora_alpha]
loraModelField.modelWeights = lora_alpha loraModelField.modelWeights = lora_alpha
}, },
readUI: () => { readUI: () => {
@ -454,11 +456,8 @@ function restoreTaskToUI(task, fieldsToSkip) {
} }
if (!("use_lora_model" in task.reqBody)) { if (!("use_lora_model" in task.reqBody)) {
loraModels.forEach((e) => { loraModelField.modelNames = []
e[0].value = "" loraModelField.modelWeights = []
e[1].value = 0
e[0].dispatchEvent(new Event("change"))
})
} }
// restore the original prompt if provided (e.g. use settings), fallback to prompt as needed (e.g. copy/paste or d&d) // restore the original prompt if provided (e.g. use settings), fallback to prompt as needed (e.g. copy/paste or d&d)