aboutsummaryrefslogtreecommitdiff
path: root/modules/processing.py
diff options
context:
space:
mode:
authorrandom_thoughtss <random_thoughtss@proton.me>2022-10-25 13:15:08 -0700
committerrandom_thoughtss <random_thoughtss@proton.me>2022-10-25 13:15:08 -0700
commit8b4f32779f28010fc8077e8fcfb85a3205b36bc2 (patch)
tree127e5c644ce9728e65b1b4300da07fcd79683b43 /modules/processing.py
parent605d27687f433c0fefb9025aace7dc94f0ebd454 (diff)
Switch to a continous blend for cond. image.
Diffstat (limited to 'modules/processing.py')
-rw-r--r--modules/processing.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/modules/processing.py b/modules/processing.py
index 23ee5e02..02292bdc 100644
--- a/modules/processing.py
+++ b/modules/processing.py
@@ -769,9 +769,12 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
# Create another latent image, this time with a masked version of the original input.
conditioning_mask = conditioning_mask.to(image.device)
- conditioning_image = image
- if getattr(self, "inpainting_mask_image", shared.opts.inpainting_mask_image):
- conditioning_image = conditioning_image * (1.0 - conditioning_mask)
+ # Smoothly interpolate between the masked and unmasked latent conditioning image.
+ conditioning_image = torch.lerp(
+ image,
+ image * (1.0 - conditioning_mask),
+ getattr(self, "inpainting_mask_weight", shared.opts.inpainting_mask_weight)
+ )
conditioning_image = self.sd_model.get_first_stage_encoding(self.sd_model.encode_first_stage(conditioning_image))