From 02fd0aee06b9ae1625de5bfa89538b1cf43f9341 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Tue, 6 May 2025 09:06:50 -0400 Subject: [PATCH] fix control refiner Signed-off-by: Vladimir Mandic --- CHANGELOG.md | 3 ++- modules/processing_diffusers.py | 2 +- modules/processing_helpers.py | 15 ++++++++------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7daf60f0d..a654737bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Change Log for SD.Next -## Update for 2025-05-05 +## Update for 2025-05-06 - **Features** - [FramePack](https://vladmandic.github.io/sdnext-docs/FramePack) @@ -36,6 +36,7 @@ - Control: t2i-adapter workflow - Control: xs-controlnet workflow - Control: lllite-workflow + - Control: refiner workflow with multiple control elements ## Highlights for 2025-04-28 diff --git a/modules/processing_diffusers.py b/modules/processing_diffusers.py index 2c1f16cb6..03d0b7b78 100644 --- a/modules/processing_diffusers.py +++ b/modules/processing_diffusers.py @@ -54,7 +54,7 @@ def restore_state(p: processing.StableDiffusionProcessing): def process_base(p: processing.StableDiffusionProcessing): txt2img = is_txt2img() - use_refiner_start = txt2img and is_refiner_enabled(p) and not p.is_hr_pass and p.refiner_start > 0 and p.refiner_start < 1 + use_refiner_start = is_refiner_enabled(p) and (not p.is_hr_pass) use_denoise_start = not txt2img and p.refiner_start > 0 and p.refiner_start < 1 shared.sd_model = update_pipeline(shared.sd_model, p) diff --git a/modules/processing_helpers.py b/modules/processing_helpers.py index d20aeefb2..2535127ff 100644 --- a/modules/processing_helpers.py +++ b/modules/processing_helpers.py @@ -454,14 +454,15 @@ def calculate_base_steps(p, use_denoise_start, use_refiner_start): if len(getattr(p, 'timesteps', [])) > 0: return None if not is_txt2img(): - if use_denoise_start and shared.sd_model_type == 'sdxl': + cls = shared.sd_model.__class__.__name__ + if cls in sd_models.i2i_pipes: + steps = p.steps + elif 'Flex' in cls: + steps = p.steps + elif 'HiDreamImageEditingPipeline' in cls: + steps = p.steps + elif use_denoise_start and (shared.sd_model_type == 'sdxl'): steps = p.steps // (1 - p.refiner_start) - elif 'Flex' in shared.sd_model.__class__.__name__: - steps = p.steps - elif 'HiDreamImageEditingPipeline' in shared.sd_model.__class__.__name__: - steps = p.steps - elif shared.sd_model.__class__.__name__ in sd_models.i2i_pipes: - steps = p.steps elif p.denoising_strength > 0: steps = (p.steps // p.denoising_strength) + 1 else: