mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2024-11-22 00:03:20 +01:00
Merge beta
This commit is contained in:
commit
de36489444
@ -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.
|
||||
|
@ -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.131",
|
||||
"stable-diffusion-sdkit": "2.1.4",
|
||||
"rich": "12.6.0",
|
||||
"uvicorn": "0.19.0",
|
||||
|
@ -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_config_on_startup(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_config_on_startup(config)
|
||||
|
||||
return config
|
||||
except Exception as e:
|
||||
log.warn(traceback.format_exc())
|
||||
set_config_on_startup(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_config_on_startup(default_val)
|
||||
return default_val
|
||||
|
||||
getConfig.__config_on_startup = None
|
||||
|
||||
|
||||
def setConfig(config):
|
||||
try: # config.yaml
|
||||
|
@ -192,7 +192,14 @@ def get_metadata_entries_for_request(req: GenerateImageRequest, task_data: TaskD
|
||||
# if text, format it in the text format expected by the UI
|
||||
is_txt_format = task_data.metadata_output_format and "txt" in task_data.metadata_output_format.lower().split(",")
|
||||
if is_txt_format:
|
||||
metadata = {TASK_TEXT_MAPPING[key]: val for key, val in metadata.items() if key in TASK_TEXT_MAPPING}
|
||||
def format_value(value):
|
||||
if isinstance(value, list):
|
||||
return ", ".join([ str(it) for it in value ])
|
||||
return value
|
||||
|
||||
metadata = {
|
||||
TASK_TEXT_MAPPING[key]: format_value(val) for key, val in metadata.items() if key in TASK_TEXT_MAPPING
|
||||
}
|
||||
|
||||
entries = [metadata.copy() for _ in range(req.num_outputs)]
|
||||
for i, entry in enumerate(entries):
|
||||
@ -232,7 +239,7 @@ def get_printable_request(req: GenerateImageRequest, task_data: TaskData):
|
||||
used_embeddings.extend(scan_directory(entry.path))
|
||||
return used_embeddings
|
||||
used_embeddings = scan_directory(os.path.join(app.MODELS_DIR, "embeddings"))
|
||||
metadata["use_embedding_models"] = ", ".join(used_embeddings) if len(used_embeddings) > 0 else None
|
||||
metadata["use_embedding_models"] = used_embeddings if len(used_embeddings) > 0 else None
|
||||
|
||||
# Clean up the metadata
|
||||
if req.init_image is None and "prompt_strength" in metadata:
|
||||
|
@ -31,7 +31,7 @@
|
||||
<h1>
|
||||
<img id="logo_img" src="/media/images/icon-512x512.png" >
|
||||
Easy Diffusion
|
||||
<small><span id="version">v2.5.44</span> <span id="updateBranchLabel"></span></small>
|
||||
<small><span id="version">v2.5.45</span> <span id="updateBranchLabel"></span></small>
|
||||
</h1>
|
||||
</div>
|
||||
<div id="server-status">
|
||||
@ -147,7 +147,7 @@
|
||||
</td></tr>
|
||||
<tr class="pl-5 displayNone" id="clip_skip_config">
|
||||
<td><label for="clip_skip">Clip Skip:</label></td>
|
||||
<td>
|
||||
<td class="diffusers-restart-needed">
|
||||
<input id="clip_skip" name="clip_skip" type="checkbox">
|
||||
<a href="https://github.com/easydiffusion/easydiffusion/wiki/Clip-Skip" target="_blank"><i class="fa-solid fa-circle-question help-btn"><span class="simple-tooltip top-left">Click to learn more about Clip Skip</span></i></a>
|
||||
</td>
|
||||
@ -237,7 +237,10 @@
|
||||
<td>
|
||||
<label for="lora_model">LoRA:</label>
|
||||
</td>
|
||||
<td class="model_entries"></td>
|
||||
<td class="diffusers-restart-needed">
|
||||
<div class="model_entries"></div>
|
||||
<button class="add_model_entry"><i class="fa-solid fa-plus"></i> add another LoRA</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="pl-5"><td><label for="hypernetwork_model">Hypernetwork:</label></td><td>
|
||||
<input id="hypernetwork_model" type="text" spellcheck="false" autocomplete="off" class="model-filter" data-path="" />
|
||||
@ -246,15 +249,18 @@
|
||||
<td><label for="hypernetwork_strength_slider">Hypernetwork Strength:</label></td>
|
||||
<td> <input id="hypernetwork_strength_slider" name="hypernetwork_strength_slider" class="editor-slider" value="100" type="range" min="0" max="100"> <input id="hypernetwork_strength" name="hypernetwork_strength" size="4" pattern="^[0-9\.]+$" onkeypress="preventNonNumericalInput(event)"><br/></td>
|
||||
</tr>
|
||||
<tr id="tiling_container" class="pl-5"><td><label for="tiling">Seamless Tiling:</label></td><td>
|
||||
<select id="tiling" name="tiling">
|
||||
<option value="none" selected>None</option>
|
||||
<option value="x">Horizontal</option>
|
||||
<option value="y">Vertical</option>
|
||||
<option value="xy">Both</option>
|
||||
</select>
|
||||
<a href="https://github.com/easydiffusion/easydiffusion/wiki/Seamless-Tiling" target="_blank"><i class="fa-solid fa-circle-question help-btn"><span class="simple-tooltip top-left">Click to learn more about Seamless Tiling</span></i></a>
|
||||
</td></tr>
|
||||
<tr id="tiling_container" class="pl-5">
|
||||
<td><label for="tiling">Seamless Tiling:</label></td>
|
||||
<td class="diffusers-restart-needed">
|
||||
<select id="tiling" name="tiling">
|
||||
<option value="none" selected>None</option>
|
||||
<option value="x">Horizontal</option>
|
||||
<option value="y">Vertical</option>
|
||||
<option value="xy">Both</option>
|
||||
</select>
|
||||
<a href="https://github.com/easydiffusion/easydiffusion/wiki/Seamless-Tiling" target="_blank"><i class="fa-solid fa-circle-question help-btn"><span class="simple-tooltip top-left">Click to learn more about Seamless Tiling</span></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="pl-5"><td><label for="output_format">Output Format:</label></td><td>
|
||||
<select id="output_format" name="output_format">
|
||||
<option value="jpeg" selected>jpeg</option>
|
||||
|
@ -900,6 +900,10 @@ div.img-preview img {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
#editor-settings-entries table {
|
||||
width: 93%;
|
||||
}
|
||||
|
||||
#negative_prompt {
|
||||
width: 100%;
|
||||
}
|
||||
@ -1666,7 +1670,7 @@ body.wait-pause {
|
||||
}
|
||||
|
||||
.model_entry .model_name {
|
||||
width: 70%;
|
||||
width: 65%;
|
||||
}
|
||||
|
||||
.split-toolbar { display: grid;
|
||||
@ -1692,3 +1696,16 @@ body.wait-pause {
|
||||
#negative-embeddings-button {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.diffusers-disabled-on-startup .diffusers-restart-needed {
|
||||
font-size: 0;
|
||||
}
|
||||
|
||||
.diffusers-disabled-on-startup .diffusers-restart-needed * {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.diffusers-disabled-on-startup .diffusers-restart-needed::after {
|
||||
content: "Please restart Easy Diffusion!";
|
||||
font-size: 10pt;
|
||||
}
|
||||
|
@ -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",
|
||||
|
@ -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() !== "")
|
||||
|
@ -2255,31 +2255,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 = `
|
||||
<input id="${nameId}" class="model_name" type="text" spellcheck="false" autocomplete="off" class="model-filter" data-path="" />
|
||||
<input id="${strengthId}" class="model_strength" type="number" step="${strengthStep}" style="width: 50pt" value="${defaultValue}" pattern="^-?[0-9]*\.?[0-9]*$" onkeypress="preventNonNumericalInput(event)"><br/>
|
||||
<input id="${strengthId}" class="model_strength" type="number" step="${strengthStep}" style="width: 50pt" value="${defaultValue}" pattern="^-?[0-9]*\.?[0-9]*$" onkeypress="preventNonNumericalInput(event)">
|
||||
`
|
||||
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 = '<i class="fa-solid fa-minus"></i>'
|
||||
|
||||
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) {
|
||||
|
@ -424,6 +424,16 @@ async function getAppConfig() {
|
||||
const testDiffusersEnabled = config.test_diffusers && config.update_branch !== "main"
|
||||
testDiffusers.checked = testDiffusersEnabled
|
||||
|
||||
if (config.config_on_startup) {
|
||||
if (config.config_on_startup?.test_diffusers && config.update_branch !== "main") {
|
||||
document.body.classList.add("diffusers-enabled-on-startup");
|
||||
document.body.classList.remove("diffusers-disabled-on-startup");
|
||||
} else {
|
||||
document.body.classList.add("diffusers-disabled-on-startup");
|
||||
document.body.classList.remove("diffusers-enabled-on-startup");
|
||||
}
|
||||
}
|
||||
|
||||
if (!testDiffusersEnabled) {
|
||||
document.querySelector("#lora_model_container").style.display = "none"
|
||||
document.querySelector("#tiling_container").style.display = "none"
|
||||
|
Loading…
Reference in New Issue
Block a user