From 63190a50e7fd99d5e8e966ac2bd294dc76d881be Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Sat, 2 May 2026 08:06:57 +0200 Subject: [PATCH] fix ernie preview Signed-off-by: Vladimir Mandic --- CHANGELOG.md | 4 +++- modules/api/validate.py | 1 + modules/processing_callbacks.py | 4 +++- modules/processing_diffusers.py | 4 ++-- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad6888ac4..370e7bd4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ - Tag multi-image pipes with `use_images_direct` and allow UI override -## Update for 2026-04-30 +## Update for 2026-05-02 - **Features** - **Multi-image** workflows! @@ -27,6 +27,8 @@ - refactor `pip` installer, thanks @awsr - **Fixes** - save handle already decoded images + - ernie-image preview + - lora false deactivate ## Update for 2026-04-28 diff --git a/modules/api/validate.py b/modules/api/validate.py index 58952332c..1ff77be75 100644 --- a/modules/api/validate.py +++ b/modules/api/validate.py @@ -5,6 +5,7 @@ from modules.logger import log # value is cost: -1=disabled, 0=unlimited, 1=default, >1 expensive request_cost = { "/file": 0, + "/internal/progress": 0, "/run/predict": 0, "/sdapi/v1/browser/thumb": 0, "/sdapi/v1/network/thumb": 0, diff --git a/modules/processing_callbacks.py b/modules/processing_callbacks.py index e1c2c19ba..97bfc0fc4 100644 --- a/modules/processing_callbacks.py +++ b/modules/processing_callbacks.py @@ -139,7 +139,9 @@ def diffusers_callback(pipe, step: int = 0, timestep: int = 0, kwargs: dict | No width = getattr(p, 'width', 1024) height = getattr(p, 'height', 1024) latents = kwargs['latents'] - if len(latents.shape) == 3: # packed format [B, seq_len, patch_channels] + if len(latents.shape) == 4: + latents = pipe._unpatchify_latents(latents) # [B, C*4, h/2, w/2] -> [B, C, h, w] # pylint: disable=protected-access + elif len(latents.shape) == 3: # packed format [B, seq_len, patch_channels] b, seq_len, patch_ch = latents.shape channels = patch_ch // 4 # 4 = 2x2 patch h_patches = height // vae_scale // 2 diff --git a/modules/processing_diffusers.py b/modules/processing_diffusers.py index b7b1030ef..92427c836 100644 --- a/modules/processing_diffusers.py +++ b/modules/processing_diffusers.py @@ -242,7 +242,7 @@ def process_base(p: processing.StableDiffusionProcessing): def process_hires(p: processing.StableDiffusionProcessing, output): # optional second pass - if (output is None) or (output.images is None): + if (output is None) or not hasattr(output, 'images') or (output.images is None): return output if p.enable_hr: jobid = shared.state.begin('Hires') @@ -368,7 +368,7 @@ def process_hires(p: processing.StableDiffusionProcessing, output): def process_refine(p: processing.StableDiffusionProcessing, output): # optional refiner pass or decode - if (output is None) or (output.images is None): + if (output is None) or not hasattr(output, 'images') or (output.images is None): return output if is_refiner_enabled(p): if shared.opts.samples_save and not p.do_not_save_samples and shared.opts.save_images_before_refiner and hasattr(shared.sd_model, 'vae'):