diff --git a/CHANGELOG.md b/CHANGELOG.md index 94116c1fc..497931452 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,23 +2,27 @@ ## Update for 2023-12-30 -- **Improvements**: +- **Improvements** - allow deployment without git clone for example, zip of the sdnext folder can be used - - control: configurable output folder in settings - - hypertile: enable vae tiling + - control: configurable output folder in settings + - control: auto-refresh available models on tab activate + - hypertile: enable vae tiling - hypertile: add autodetect optimial value set tile size to 0 to use autodetected value - cli: sdapi.py allow manual api invoke example: `python cli/sdapi.py /sdapi/v1/sd-models` -- **Fixes**: +- **Fixes** + - python: fix python 3.9 compatibility - control: fix input image size - control: fix correct image mode - - control: reduce usage of temp files + - control: reduce usage of temp files + - control: add context menu to action buttons - img2img: clip and blip interrogate - - guard against invalid sampler index - - reset default cfg scale to 6.0 + - sampler: guard against invalid sampler index + - config: reset default cfg scale to 6.0 - processing: correct display metadata + - upscale: fix ldsr ## Update for 2023-12-29 diff --git a/javascript/contextMenus.js b/javascript/contextMenus.js index 9cfe2dcb3..404b44922 100644 --- a/javascript/contextMenus.js +++ b/javascript/contextMenus.js @@ -103,7 +103,7 @@ function initContextMenu() { } }; - for (const tab of ['txt2img', 'img2img']) { + for (const tab of ['txt2img', 'img2img', 'control']) { for (const el of ['generate', 'interrupt', 'skip', 'pause', 'paste', 'clear_prompt', 'extra_networks_btn']) { const id = `#${tab}_${el}`; appendContextMenuOption(id, 'Copy to clipboard', () => navigator.clipboard.writeText(document.querySelector(`#${tab}_prompt > label > textarea`).value)); diff --git a/javascript/control.js b/javascript/control.js index 3690c491a..4189b6af5 100644 --- a/javascript/control.js +++ b/javascript/control.js @@ -11,6 +11,18 @@ function setupControlUI() { c.style.flexGrow = c.style.flexGrow === '0' ? '9' : '0'; }; } + + const el = gradioApp().getElementById('control-input-column'); + if (!el) return; + const intersectionObserver = new IntersectionObserver((entries) => { + if (entries[0].intersectionRatio > 0) { + const tab = gradioApp().querySelector('#control-tabs > .tab-nav > .selected')?.innerText.toLowerCase() || ''; // selected tab name + const btn = gradioApp().getElementById(`refresh_${tab}_models`); + if (btn) btn.click(); + } + }); + intersectionObserver.observe(el); // monitor visibility of tab + log('initControlUI'); } diff --git a/modules/control/run.py b/modules/control/run.py index af710bdd5..a0109603c 100644 --- a/modules/control/run.py +++ b/modules/control/run.py @@ -263,6 +263,8 @@ def control_run(units: List[unit.Unit], inputs, inits, unit_type: str, is_genera shared.sd_model = pipe if not ((shared.opts.diffusers_model_cpu_offload or shared.cmd_opts.medvram) or (shared.opts.diffusers_seq_cpu_offload or shared.cmd_opts.lowvram)): shared.sd_model.to(shared.device) + shared.sd_model.to(device=devices.device, dtype=devices.dtype) + debug(f'Control device={devices.device} dtype={devices.dtype}') sd_models.copy_diffuser_options(shared.sd_model, original_pipeline) # copy options from original pipeline sd_models.set_diffuser_options(shared.sd_model) if ipadapter.apply_ip_adapter(shared.sd_model, p, ip_adapter, ip_scale, ip_image, reset=True): diff --git a/modules/sd_hijack_freeu.py b/modules/sd_hijack_freeu.py index ef893d2f3..430c764dc 100644 --- a/modules/sd_hijack_freeu.py +++ b/modules/sd_hijack_freeu.py @@ -59,6 +59,8 @@ def free_u_cat_hijack(hs, *args, original_function, **kwargs): except ValueError: return original_function(hs, *args, **kwargs) dims = h.shape[1] + if dims not in [1280, 640, 320]: + return original_function(hs, *args, **kwargs) index = [1280, 640, 320].index(dims) if index > 1: # not 1st or 2nd stage return original_function([h, h_skip], *args, **kwargs) diff --git a/modules/ui_control.py b/modules/ui_control.py index 8365d0127..b6d50a0fa 100644 --- a/modules/ui_control.py +++ b/modules/ui_control.py @@ -325,7 +325,7 @@ def create_ui(_blocks: gr.Blocks=None): enabled_cb = gr.Checkbox(value= i==0, label="") process_id = gr.Dropdown(label="Processor", choices=processors.list_models(), value='None') model_id = gr.Dropdown(label="ControlNet", choices=controlnet.list_models(), value='None') - ui_common.create_refresh_button(model_id, controlnet.list_models, lambda: {"choices": controlnet.list_models(refresh=True)}, 'refresh_control_models') + ui_common.create_refresh_button(model_id, controlnet.list_models, lambda: {"choices": controlnet.list_models(refresh=True)}, 'refresh_controlnet_models') model_strength = gr.Slider(label="Strength", minimum=0.01, maximum=1.0, step=0.01, value=1.0-i/10) control_start = gr.Slider(label="Start", minimum=0.0, maximum=1.0, step=0.05, value=0) control_end = gr.Slider(label="End", minimum=0.0, maximum=1.0, step=0.05, value=1.0) @@ -370,7 +370,7 @@ def create_ui(_blocks: gr.Blocks=None): enabled_cb = gr.Checkbox(value= i==0, label="") process_id = gr.Dropdown(label="Processor", choices=processors.list_models(), value='None') model_id = gr.Dropdown(label="ControlNet-XS", choices=xs.list_models(), value='None') - ui_common.create_refresh_button(model_id, xs.list_models, lambda: {"choices": xs.list_models(refresh=True)}, 'refresh_control_models') + ui_common.create_refresh_button(model_id, xs.list_models, lambda: {"choices": xs.list_models(refresh=True)}, 'refresh_xs_models') model_strength = gr.Slider(label="Strength", minimum=0.01, maximum=1.0, step=0.01, value=1.0-i/10) control_start = gr.Slider(label="Start", minimum=0.0, maximum=1.0, step=0.05, value=0) control_end = gr.Slider(label="End", minimum=0.0, maximum=1.0, step=0.05, value=1.0)