Skip to content

Commit

Permalink
Force denoising strength of 1 for noisy latents
Browse files Browse the repository at this point in the history
  • Loading branch information
brkirch committed Aug 4, 2023
1 parent 2058e89 commit 84d9bc8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions modules/generation_parameters_copypaste.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion modules/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions modules/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down

0 comments on commit 84d9bc8

Please sign in to comment.