From 84d9bc8356283410084809f2612bc6e9ea669649 Mon Sep 17 00:00:00 2001 From: brkirch Date: Fri, 4 Aug 2023 05:19:37 -0400 Subject: [PATCH] Force denoising strength of 1 for noisy latents --- modules/generation_parameters_copypaste.py | 2 ++ modules/processing.py | 2 +- modules/ui.py | 7 +++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/generation_parameters_copypaste.py b/modules/generation_parameters_copypaste.py index e9085568840..07cebda3575 100644 --- a/modules/generation_parameters_copypaste.py +++ b/modules/generation_parameters_copypaste.py @@ -291,6 +291,8 @@ def parse_generation_parameters(x: str): if "Hires noisy latent" not in res: res["Hires noisy latent"] = False + elif res["Hires noisy latent"] == True: + res["Denoising strength"] = 1.0 restore_old_hires_fix_params(res) diff --git a/modules/processing.py b/modules/processing.py index 8e5af9cc2fc..5bb2ec25ef6 100644 --- a/modules/processing.py +++ b/modules/processing.py @@ -946,7 +946,7 @@ class StableDiffusionProcessingTxt2Img(StableDiffusionProcessing): def __init__(self, enable_hr: bool = False, denoising_strength: float = 0.75, firstphase_width: int = 0, firstphase_height: int = 0, hr_scale: float = 2.0, hr_upscaler: str = None, hr_second_pass_steps: int = 0, hr_resize_x: int = 0, hr_resize_y: int = 0, hr_checkpoint_name: str = None, hr_sampler_name: str = None, hr_use_noisy: bool = False, hr_prompt: str = '', hr_negative_prompt: str = '', **kwargs): super().__init__(**kwargs) self.enable_hr = enable_hr - self.denoising_strength = denoising_strength + self.denoising_strength = denoising_strength if not hr_use_noisy else 1.0 self.hr_scale = hr_scale self.hr_upscaler = hr_upscaler self.hr_second_pass_steps = hr_second_pass_steps diff --git a/modules/ui.py b/modules/ui.py index 42cff52b3fc..1eadc9cafe0 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -614,6 +614,13 @@ def create_ui(): show_progress = False, ) + hr_use_noisy.change( + fn=lambda x: gr_show(not x), + inputs=[hr_use_noisy], + outputs=[denoising_strength], + show_progress = False, + ) + txt2img_paste_fields = [ (txt2img_prompt, "Prompt"), (txt2img_negative_prompt, "Negative prompt"),