From 753bfebe1c17a4d95d169a85783ed369e5ed29cc Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Mon, 29 Jan 2024 08:34:36 -0500 Subject: [PATCH] fix img2img batch --- CHANGELOG.md | 4 ++-- .../stable-diffusion-webui-images-browser | 2 +- javascript/base.css | 4 ---- javascript/control.js | 5 +---- javascript/sdnext.css | 4 ---- modules/img2img.py | 2 ++ modules/memstats.py | 11 +++++++++-- 7 files changed, 15 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f470403c9..4b3676886 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ OPTIONAL: - masking api - preprocess api -## Update for 2023-01-28 +## Update for 2023-01-29 Another big release, highlights being: - A lot more functionality in the **Control** module: @@ -141,7 +141,7 @@ As of this release, default backend is set to **diffusers** as its more feature - modularized blip/booru interrogate now appears as toolbuttons on image/gallery output - faster browser page load - - cleanup hints + - cleanup hints, thanks @brknsoul - cleanup settings - **server** - all move/offload options are disable by default for optimal performance diff --git a/extensions-builtin/stable-diffusion-webui-images-browser b/extensions-builtin/stable-diffusion-webui-images-browser index 27fe4a713..8dc4665c4 160000 --- a/extensions-builtin/stable-diffusion-webui-images-browser +++ b/extensions-builtin/stable-diffusion-webui-images-browser @@ -1 +1 @@ -Subproject commit 27fe4a713d883436049ed1ed9e1642f8eb4fd924 +Subproject commit 8dc4665c4f4e79cc12d06ad5b6fb47ddf84593fa diff --git a/javascript/base.css b/javascript/base.css index b5736cbf2..c84bb08c3 100644 --- a/javascript/base.css +++ b/javascript/base.css @@ -23,10 +23,6 @@ .livePreview img { position: absolute; object-fit: contain; width: 100%; height: 100%; } .dark .livePreview { background-color: rgb(17 24 39 / var(--tw-bg-opacity)); } .popup-metadata { color: white; background: #0000; display: inline-block; white-space: pre-wrap; font-size: 0.75em; } -.global-popup{ display: flex; position: fixed; z-index: 10001; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(20, 20, 20, 0.95);} -.global-popup-close:before { content: "×"; } -.global-popup-close{ position: fixed; right: 0.5em; top: 0; cursor: pointer; color: white; font-size: 32pt; } -.global-popup-inner{ display: inline-block; margin: auto; padding: 2em; } /* fullpage image viewer */ #lightboxModal{ display: none; position: fixed; z-index: 1001; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(20, 20, 20, 0.75); backdrop-filter: blur(6px); diff --git a/javascript/control.js b/javascript/control.js index 25b66f359..36c6affdb 100644 --- a/javascript/control.js +++ b/javascript/control.js @@ -33,10 +33,7 @@ async function setupControlUI() { const name = tab.innerText.toLowerCase(); for (let i = 0; i < 10; i += 1) { const btn = gradioApp().getElementById(`refresh_${name}_models_${i}`); - if (btn) { - btn.click(); - console.log('HERE', `refresh_${name}_models_${i}`); - } + if (btn) btn.click(); } } } diff --git a/javascript/sdnext.css b/javascript/sdnext.css index 2a82e5add..8b2e447f0 100644 --- a/javascript/sdnext.css +++ b/javascript/sdnext.css @@ -145,10 +145,6 @@ div#extras_scale_to_tab div.form{ flex-direction: row; } .livePreview img { position: absolute; object-fit: contain; width: 100%; height: 100%; } .dark .livePreview { background-color: rgb(17 24 39 / var(--tw-bg-opacity)); } .popup-metadata { color: white; background: #0000; display: inline-block; white-space: pre-wrap; font-size: var(--text-xxs); } -.global-popup{ display: flex; position: fixed; z-index: 10001; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(20, 20, 20, 0.95);} -.global-popup-close:before { content: "×"; } -.global-popup-close{ position: fixed; right: 0.5em; top: 0; cursor: pointer; color: white; font-size: 32pt; } -.global-popup-inner{ display: inline-block; margin: auto; padding: 2em; } /* fullpage image viewer */ #lightboxModal{ display: none; position: fixed; z-index: 1001; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(20, 20, 20, 0.75); backdrop-filter: blur(6px); diff --git a/modules/img2img.py b/modules/img2img.py index dd2cb4255..6ca794ff1 100644 --- a/modules/img2img.py +++ b/modules/img2img.py @@ -23,9 +23,11 @@ def process_batch(p, input_files, input_dir, output_dir, inpaint_mask_dir, args) shared.log.error(f"Process batch: directory not found: {input_dir}") return image_files = os.listdir(input_dir) + image_files = [os.path.join(input_dir, f) for f in image_files] is_inpaint_batch = False if inpaint_mask_dir: inpaint_masks = os.listdir(inpaint_mask_dir) + inpaint_masks = [os.path.join(inpaint_mask_dir, f) for f in inpaint_masks] is_inpaint_batch = len(inpaint_masks) > 0 if is_inpaint_batch: shared.log.info(f"Process batch: inpaint batch masks={len(inpaint_masks)}") diff --git a/modules/memstats.py b/modules/memstats.py index a7c28861a..eab4a677a 100644 --- a/modules/memstats.py +++ b/modules/memstats.py @@ -1,9 +1,12 @@ import os import psutil import torch -from modules import shared +from modules import shared, errors + +fail_once = False def memory_stats(): + global fail_once # pylint: disable=global-statement def gb(val: float): return round(val / 1024 / 1024 / 1024, 2) @@ -15,7 +18,11 @@ def memory_stats(): ram = { 'used': gb(res.rss), 'total': gb(ram_total) } mem.update({ 'ram': ram }) except Exception as e: - mem.update({ 'ram': e }) + if not fail_once: + shared.log.error('Memory stats: {e}') + errors.display(e, 'Memory stats') + fail_once = True + mem.update({ 'ram': str(e) }) try: s = torch.cuda.mem_get_info() gpu = { 'used': gb(s[1] - s[0]), 'total': gb(s[1]) }