diff options
author | CodeHatchling <steve@codehatch.com> | 2023-12-07 04:16:27 +0000 |
---|---|---|
committer | CodeHatchling <steve@codehatch.com> | 2023-12-07 04:16:27 +0000 |
commit | ac4578912395627731f2cd8529f87a95df1f7644 (patch) | |
tree | 1378df6b3fae1add1eaeca9a4509f0bc93dc7c99 /modules/sd_samplers_cfg_denoiser.py | |
parent | 4608f6236fc24d937f89500b2c9bf48484537cf9 (diff) | |
download | stable-diffusion-webui-gfx803-ac4578912395627731f2cd8529f87a95df1f7644.tar.gz stable-diffusion-webui-gfx803-ac4578912395627731f2cd8529f87a95df1f7644.tar.bz2 stable-diffusion-webui-gfx803-ac4578912395627731f2cd8529f87a95df1f7644.zip |
Removed soft inpainting, added hooks for softpainting to work instead.
Diffstat (limited to 'modules/sd_samplers_cfg_denoiser.py')
-rw-r--r-- | modules/sd_samplers_cfg_denoiser.py | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/modules/sd_samplers_cfg_denoiser.py b/modules/sd_samplers_cfg_denoiser.py index f13e8dcc..eb9d5daf 100644 --- a/modules/sd_samplers_cfg_denoiser.py +++ b/modules/sd_samplers_cfg_denoiser.py @@ -109,19 +109,16 @@ class CFGDenoiser(torch.nn.Module): assert not is_edit_model or all(len(conds) == 1 for conds in conds_list), "AND is not supported for InstructPix2Pix checkpoint (unless using Image CFG scale = 1.0)"
# If we use masks, blending between the denoised and original latent images occurs here.
- def apply_blend(latent):
- if hasattr(self.p, "denoiser_masked_blend_function") and callable(self.p.denoiser_masked_blend_function):
- return self.p.denoiser_masked_blend_function(
- self,
- # Using an argument dictionary so that arguments can be added without breaking extensions.
- args=
- {
- "denoiser": self,
- "current_latent": latent,
- "sigma": sigma
- })
- else:
- return self.init_latent * self.mask + self.nmask * latent
+ def apply_blend(current_latent):
+ blended_latent = current_latent * self.nmask + self.init_latent * self.mask
+
+ if self.p.scripts is not None:
+ from modules import scripts
+ mba = scripts.MaskBlendArgs(current_latent, self.nmask, self.init_latent, self.mask, blended_latent, denoiser=self, sigma=sigma)
+ self.p.scripts.on_mask_blend(self.p, mba)
+ blended_latent = mba.blended_latent
+
+ return blended_latent
# Blend in the original latents (before)
if self.mask_before_denoising and self.mask is not None:
|