forked from extern/easydiffusion
Merge branch 'main' of github.com:cmdr2/stable-diffusion-ui
This commit is contained in:
commit
58c9b70b26
@ -9,6 +9,11 @@ Additionally, a common reason for this error is that you're using an initial ima
|
|||||||
|
|
||||||
Also try generating smaller sized images.
|
Also try generating smaller sized images.
|
||||||
|
|
||||||
|
## urllib.error.URLError: <urlopen error [Errno 11001] getaddrinfo failed>
|
||||||
|
This can be due to a Firewall/Antivirus/Proxy/VPN blocking your network connections. Please check those.
|
||||||
|
|
||||||
|
Another solution is to switch to Google's DNS server: https://developers.google.com/speed/public-dns/docs/using#windows or Cloudflare's DNS server: https://developers.cloudflare.com/1.1.1.1/setup/windows/
|
||||||
|
|
||||||
## basicsr module not found
|
## basicsr module not found
|
||||||
For Windows: Please download and extract basicsr from [here](https://github.com/cmdr2/stable-diffusion-ui/releases/download/v2.16/basicsr-win64.zip), and place the `basicsr` folder inside the `stable-diffusion-ui\stable-diffusion\env\lib\site-packages` folder. Then run the `Start Stable Diffusion UI.cmd` file again.
|
For Windows: Please download and extract basicsr from [here](https://github.com/cmdr2/stable-diffusion-ui/releases/download/v2.16/basicsr-win64.zip), and place the `basicsr` folder inside the `stable-diffusion-ui\stable-diffusion\env\lib\site-packages` folder. Then run the `Start Stable Diffusion UI.cmd` file again.
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link rel="icon" type="image/png" href="/media/favicon-16x16.png" sizes="16x16">
|
<link rel="icon" type="image/png" href="/media/favicon-16x16.png" sizes="16x16">
|
||||||
<link rel="icon" type="image/png" href="/media/favicon-32x32.png" sizes="32x32">
|
<link rel="icon" type="image/png" href="/media/favicon-32x32.png" sizes="32x32">
|
||||||
<link rel="stylesheet" href="/media/main.css?v=21">
|
<link rel="stylesheet" href="/media/main.css?v=22">
|
||||||
<link rel="stylesheet" href="/media/modifier-thumbnails.css?v=1">
|
<link rel="stylesheet" href="/media/modifier-thumbnails.css?v=1">
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css">
|
||||||
<link rel="stylesheet" href="/media/drawingboard.min.css">
|
<link rel="stylesheet" href="/media/drawingboard.min.css">
|
||||||
@ -15,7 +15,7 @@
|
|||||||
<div id="container">
|
<div id="container">
|
||||||
<div id="top-nav">
|
<div id="top-nav">
|
||||||
<div id="logo">
|
<div id="logo">
|
||||||
<h1>Stable Diffusion UI <small>v2.2 <span id="updateBranchLabel"></span></small></h1>
|
<h1>Stable Diffusion UI <small>v2.21 <span id="updateBranchLabel"></span></small></h1>
|
||||||
</div>
|
</div>
|
||||||
<ul id="top-nav-items">
|
<ul id="top-nav-items">
|
||||||
<li class="dropdown">
|
<li class="dropdown">
|
||||||
@ -57,10 +57,12 @@
|
|||||||
<div id="editor-inputs-prompt" class="row">
|
<div id="editor-inputs-prompt" class="row">
|
||||||
<label for="prompt">Prompt</label>
|
<label for="prompt">Prompt</label>
|
||||||
<textarea id="prompt" class="col-free">a photograph of an astronaut riding a horse</textarea>
|
<textarea id="prompt" class="col-free">a photograph of an astronaut riding a horse</textarea>
|
||||||
|
<small>(or)</small> <button id="promptsFromFileBtn">Load prompts from a file</button> <small>(one prompt per line)</small>
|
||||||
|
<input id="prompt_from_file" name="prompt_from_file" type="file" /> <!-- hidden -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="editor-inputs-init-image" class="row">
|
<div id="editor-inputs-init-image" class="row">
|
||||||
<label for="init_image"><b>Initial Image:</b> (optional) </label> <input id="init_image" name="init_image" type="file" /><br/>
|
<label for="init_image"><b>Initial Image (img2img):</b> (optional) </label> <input id="init_image" name="init_image" type="file" /><br/>
|
||||||
|
|
||||||
<div id="init_image_preview_container" class="image_preview_container">
|
<div id="init_image_preview_container" class="image_preview_container">
|
||||||
<img id="init_image_preview" src="" width="100" height="100" />
|
<img id="init_image_preview" src="" width="100" height="100" />
|
||||||
@ -96,11 +98,11 @@
|
|||||||
</li>
|
</li>
|
||||||
<li id="samplerSelection" class="pl-5"><label for="sampler">Sampler:</label>
|
<li id="samplerSelection" class="pl-5"><label for="sampler">Sampler:</label>
|
||||||
<select id="sampler" name="sampler">
|
<select id="sampler" name="sampler">
|
||||||
<option value="plms" selected>plms</option>
|
<option value="plms">plms</option>
|
||||||
<option value="ddim">ddim</option>
|
<option value="ddim">ddim</option>
|
||||||
<option value="heun">heun</option>
|
<option value="heun">heun</option>
|
||||||
<option value="euler">euler</option>
|
<option value="euler">euler</option>
|
||||||
<option value="euler_a">euler_a</option>
|
<option value="euler_a" selected>euler_a</option>
|
||||||
<option value="dpm2">dpm2</option>
|
<option value="dpm2">dpm2</option>
|
||||||
<option value="dpm2_a">dpm2_a</option>
|
<option value="dpm2_a">dpm2_a</option>
|
||||||
<option value="lms">lms</option>
|
<option value="lms">lms</option>
|
||||||
@ -152,7 +154,7 @@
|
|||||||
</select>
|
</select>
|
||||||
<label for="height"><small>(height)</small></label>
|
<label for="height"><small>(height)</small></label>
|
||||||
</li>
|
</li>
|
||||||
<li class="pl-5"><label for="num_inference_steps">Number of inference steps:</label> <input id="num_inference_steps" name="num_inference_steps" size="4" value="50"></li>
|
<li class="pl-5"><label for="num_inference_steps">Number of inference steps:</label> <input id="num_inference_steps" name="num_inference_steps" size="4" value="25"></li>
|
||||||
<li class="pl-5"><label for="guidance_scale_slider">Guidance Scale:</label> <input id="guidance_scale_slider" name="guidance_scale_slider" class="editor-slider" value="75" type="range" min="10" max="500"> <input id="guidance_scale" name="guidance_scale" size="4"></li>
|
<li class="pl-5"><label for="guidance_scale_slider">Guidance Scale:</label> <input id="guidance_scale_slider" name="guidance_scale_slider" class="editor-slider" value="75" type="range" min="10" max="500"> <input id="guidance_scale" name="guidance_scale" size="4"></li>
|
||||||
<li class="pl-5"><span id="prompt_strength_container"><label for="prompt_strength_slider">Prompt Strength:</label> <input id="prompt_strength_slider" name="prompt_strength_slider" class="editor-slider" value="80" type="range" min="0" max="99"> <input id="prompt_strength" name="prompt_strength" size="4"><br/></span></li>
|
<li class="pl-5"><span id="prompt_strength_container"><label for="prompt_strength_slider">Prompt Strength:</label> <input id="prompt_strength_slider" name="prompt_strength_slider" class="editor-slider" value="80" type="range" min="0" max="99"> <input id="prompt_strength" name="prompt_strength" size="4"><br/></span></li>
|
||||||
<li class="pl-5"><label for="output_format">Output format:</label>
|
<li class="pl-5"><label for="output_format">Output format:</label>
|
||||||
@ -224,7 +226,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
<script src="media/main.js?v=31"></script>
|
<script src="media/main.js?v=32"></script>
|
||||||
<script>
|
<script>
|
||||||
async function init() {
|
async function init() {
|
||||||
await loadModifiers()
|
await loadModifiers()
|
||||||
|
@ -410,4 +410,7 @@ img {
|
|||||||
}
|
}
|
||||||
.img-batch {
|
.img-batch {
|
||||||
display: inline;
|
display: inline;
|
||||||
|
}
|
||||||
|
#prompt_from_file {
|
||||||
|
display: none;
|
||||||
}
|
}
|
@ -18,6 +18,8 @@ const IMAGE_REGEX = new RegExp('data:image/[A-Za-z]+;base64')
|
|||||||
let sessionId = new Date().getTime()
|
let sessionId = new Date().getTime()
|
||||||
|
|
||||||
let promptField = document.querySelector('#prompt')
|
let promptField = document.querySelector('#prompt')
|
||||||
|
let promptsFromFileSelector = document.querySelector('#prompt_from_file')
|
||||||
|
let promptsFromFileBtn = document.querySelector('#promptsFromFileBtn')
|
||||||
let negativePromptField = document.querySelector('#negative_prompt')
|
let negativePromptField = document.querySelector('#negative_prompt')
|
||||||
let numOutputsTotalField = document.querySelector('#num_outputs_total')
|
let numOutputsTotalField = document.querySelector('#num_outputs_total')
|
||||||
let numOutputsParallelField = document.querySelector('#num_outputs_parallel')
|
let numOutputsParallelField = document.querySelector('#num_outputs_parallel')
|
||||||
@ -588,12 +590,27 @@ async function checkTasks() {
|
|||||||
}
|
}
|
||||||
setTimeout(checkTasks, 0)
|
setTimeout(checkTasks, 0)
|
||||||
|
|
||||||
async function makeImage() {
|
function makeImage() {
|
||||||
if (serverStatus !== 'online') {
|
if (serverStatus !== 'online') {
|
||||||
alert('The server is still starting up..')
|
alert('The server is still starting up..')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let prompts = promptField.value
|
||||||
|
prompts = prompts.split('\n')
|
||||||
|
prompts.forEach(prompt => {
|
||||||
|
prompt = prompt.trim()
|
||||||
|
if (prompt === '') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
createTask(prompt)
|
||||||
|
})
|
||||||
|
|
||||||
|
initialText.style.display = 'none'
|
||||||
|
}
|
||||||
|
|
||||||
|
function createTask(prompt) {
|
||||||
let task = {
|
let task = {
|
||||||
stopped: false,
|
stopped: false,
|
||||||
batchesDone: 0
|
batchesDone: 0
|
||||||
@ -607,7 +624,6 @@ async function makeImage() {
|
|||||||
|
|
||||||
let streamImageProgress = (numOutputsTotal > 50 ? false : streamImageProgressField.checked)
|
let streamImageProgress = (numOutputsTotal > 50 ? false : streamImageProgressField.checked)
|
||||||
|
|
||||||
let prompt = promptField.value
|
|
||||||
if (activeTags.length > 0) {
|
if (activeTags.length > 0) {
|
||||||
let promptTags = activeTags.map(x => x.name).join(", ")
|
let promptTags = activeTags.map(x => x.name).join(", ")
|
||||||
prompt += ", " + promptTags
|
prompt += ", " + promptTags
|
||||||
@ -729,8 +745,6 @@ async function makeImage() {
|
|||||||
task['previewPrompt'].innerText = prompt
|
task['previewPrompt'].innerText = prompt
|
||||||
|
|
||||||
taskQueue.unshift(task)
|
taskQueue.unshift(task)
|
||||||
|
|
||||||
initialText.style.display = 'none'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// create a file name with embedded prompt and metadata
|
// create a file name with embedded prompt and metadata
|
||||||
@ -1032,6 +1046,27 @@ maskSetting.addEventListener('click', function() {
|
|||||||
inpaintingEditorContainer.style.display = (this.checked ? 'block' : 'none')
|
inpaintingEditorContainer.style.display = (this.checked ? 'block' : 'none')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
promptsFromFileBtn.addEventListener('click', function() {
|
||||||
|
promptsFromFileSelector.click()
|
||||||
|
})
|
||||||
|
|
||||||
|
promptsFromFileSelector.addEventListener('change', function() {
|
||||||
|
if (promptsFromFileSelector.files.length === 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let reader = new FileReader()
|
||||||
|
let file = promptsFromFileSelector.files[0]
|
||||||
|
|
||||||
|
reader.addEventListener('load', function() {
|
||||||
|
promptField.value = reader.result
|
||||||
|
})
|
||||||
|
|
||||||
|
if (file) {
|
||||||
|
reader.readAsText(file)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
// function showMaskImagePreview() {
|
// function showMaskImagePreview() {
|
||||||
// if (maskImageSelector.files.length === 0) {
|
// if (maskImageSelector.files.length === 0) {
|
||||||
// // maskImagePreviewContainer.style.display = 'none'
|
// // maskImagePreviewContainer.style.display = 'none'
|
||||||
|
@ -82,15 +82,16 @@ except:
|
|||||||
def load_model_ckpt(ckpt_to_use, device_to_use='cuda', turbo=False, unet_bs_to_use=1, precision_to_use='autocast'):
|
def load_model_ckpt(ckpt_to_use, device_to_use='cuda', turbo=False, unet_bs_to_use=1, precision_to_use='autocast'):
|
||||||
global ckpt_file, model, modelCS, modelFS, model_is_half, device, unet_bs, precision, model_fs_is_half
|
global ckpt_file, model, modelCS, modelFS, model_is_half, device, unet_bs, precision, model_fs_is_half
|
||||||
|
|
||||||
ckpt_file = ckpt_to_use
|
|
||||||
device = device_to_use if has_valid_gpu else 'cpu'
|
device = device_to_use if has_valid_gpu else 'cpu'
|
||||||
precision = precision_to_use if not force_full_precision else 'full'
|
precision = precision_to_use if not force_full_precision else 'full'
|
||||||
unet_bs = unet_bs_to_use
|
unet_bs = unet_bs_to_use
|
||||||
|
|
||||||
|
unload_model()
|
||||||
|
|
||||||
if device == 'cpu':
|
if device == 'cpu':
|
||||||
precision = 'full'
|
precision = 'full'
|
||||||
|
|
||||||
sd = load_model_from_config(f"{ckpt_file}.ckpt")
|
sd = load_model_from_config(f"{ckpt_to_use}.ckpt")
|
||||||
li, lo = [], []
|
li, lo = [], []
|
||||||
for key, value in sd.items():
|
for key, value in sd.items():
|
||||||
sp = key.split(".")
|
sp = key.split(".")
|
||||||
@ -137,8 +138,22 @@ def load_model_ckpt(ckpt_to_use, device_to_use='cuda', turbo=False, unet_bs_to_u
|
|||||||
model_is_half = False
|
model_is_half = False
|
||||||
model_fs_is_half = False
|
model_fs_is_half = False
|
||||||
|
|
||||||
|
ckpt_file = ckpt_to_use
|
||||||
|
|
||||||
print('loaded ', ckpt_file, 'to', device, 'precision', precision)
|
print('loaded ', ckpt_file, 'to', device, 'precision', precision)
|
||||||
|
|
||||||
|
def unload_model():
|
||||||
|
global model, modelCS, modelFS
|
||||||
|
|
||||||
|
if model is not None:
|
||||||
|
del model
|
||||||
|
del modelCS
|
||||||
|
del modelFS
|
||||||
|
|
||||||
|
model = None
|
||||||
|
modelCS = None
|
||||||
|
modelFS = None
|
||||||
|
|
||||||
def load_model_gfpgan(gfpgan_to_use):
|
def load_model_gfpgan(gfpgan_to_use):
|
||||||
global gfpgan_file, model_gfpgan
|
global gfpgan_file, model_gfpgan
|
||||||
|
|
||||||
@ -223,8 +238,9 @@ def do_mk_img(req: Request):
|
|||||||
# to the ckpt file (without the extension).
|
# to the ckpt file (without the extension).
|
||||||
|
|
||||||
needs_model_reload = False
|
needs_model_reload = False
|
||||||
if ckpt_file != req.use_stable_diffusion_model:
|
ckpt_to_use = ckpt_file
|
||||||
ckpt_file = req.use_stable_diffusion_model
|
if ckpt_to_use != req.use_stable_diffusion_model:
|
||||||
|
ckpt_to_use = req.use_stable_diffusion_model
|
||||||
needs_model_reload = True
|
needs_model_reload = True
|
||||||
|
|
||||||
model.turbo = req.turbo
|
model.turbo = req.turbo
|
||||||
@ -233,8 +249,7 @@ def do_mk_img(req: Request):
|
|||||||
device = 'cpu'
|
device = 'cpu'
|
||||||
|
|
||||||
if model_is_half:
|
if model_is_half:
|
||||||
del model, modelCS, modelFS
|
load_model_ckpt(ckpt_to_use, device)
|
||||||
load_model_ckpt(ckpt_file, device)
|
|
||||||
needs_model_reload = False
|
needs_model_reload = False
|
||||||
|
|
||||||
load_model_gfpgan(gfpgan_file)
|
load_model_gfpgan(gfpgan_file)
|
||||||
@ -247,8 +262,7 @@ def do_mk_img(req: Request):
|
|||||||
if (precision == 'autocast' and (req.use_full_precision or not model_is_half)) or \
|
if (precision == 'autocast' and (req.use_full_precision or not model_is_half)) or \
|
||||||
(precision == 'full' and not req.use_full_precision and not force_full_precision):
|
(precision == 'full' and not req.use_full_precision and not force_full_precision):
|
||||||
|
|
||||||
del model, modelCS, modelFS
|
load_model_ckpt(ckpt_to_use, device, req.turbo, unet_bs, ('full' if req.use_full_precision else 'autocast'))
|
||||||
load_model_ckpt(ckpt_file, device, req.turbo, unet_bs, ('full' if req.use_full_precision else 'autocast'))
|
|
||||||
needs_model_reload = False
|
needs_model_reload = False
|
||||||
|
|
||||||
if prev_device != device:
|
if prev_device != device:
|
||||||
@ -256,7 +270,7 @@ def do_mk_img(req: Request):
|
|||||||
load_model_real_esrgan(real_esrgan_file)
|
load_model_real_esrgan(real_esrgan_file)
|
||||||
|
|
||||||
if needs_model_reload:
|
if needs_model_reload:
|
||||||
load_model_ckpt(ckpt_file, device, req.turbo, unet_bs, precision)
|
load_model_ckpt(ckpt_to_use, device, req.turbo, unet_bs, precision)
|
||||||
|
|
||||||
if req.use_face_correction != gfpgan_file:
|
if req.use_face_correction != gfpgan_file:
|
||||||
load_model_gfpgan(req.use_face_correction)
|
load_model_gfpgan(req.use_face_correction)
|
||||||
|
Loading…
Reference in New Issue
Block a user