aboutsummaryrefslogtreecommitdiffstats
path: root/webui.py
diff options
context:
space:
mode:
authordeggua <26562606+deggua@users.noreply.github.com>2022-09-02 11:18:12 +0000
committerdeggua <26562606+deggua@users.noreply.github.com>2022-09-02 11:18:12 +0000
commitf9c0046897e49d2fcc9b8d6c79c2c3d82fc365bc (patch)
tree8459bf3b0466766a1ee2b3c00548175798eb9c2d /webui.py
parent7b9c301f8998a063cd20d1cdcd25f787d7bc7762 (diff)
downloadstable-diffusion-webui-gfx803-f9c0046897e49d2fcc9b8d6c79c2c3d82fc365bc.tar.gz
stable-diffusion-webui-gfx803-f9c0046897e49d2fcc9b8d6c79c2c3d82fc365bc.tar.bz2
stable-diffusion-webui-gfx803-f9c0046897e49d2fcc9b8d6c79c2c3d82fc365bc.zip
Fix for fill latent zeros/noise in masking mode
Diffstat (limited to 'webui.py')
-rw-r--r--webui.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/webui.py b/webui.py
index 8901706d..f4fcb879 100644
--- a/webui.py
+++ b/webui.py
@@ -1573,6 +1573,12 @@ class StableDiffusionProcessingImg2Img(StableDiffusionProcessing):
self.mask = torch.asarray(1.0 - latmask).to(device).type(sd_model.dtype)
self.nmask = torch.asarray(latmask).to(device).type(sd_model.dtype)
+ if self.mask is not None:
+ if self.inpainting_fill == 2:
+ self.init_latent = self.init_latent * self.mask + create_random_tensors(self.init_latent.shape[1:], [self.seed + x + 1 for x in range(self.init_latent.shape[0])]) * self.nmask
+ elif self.inpainting_fill == 3:
+ self.init_latent = self.init_latent * self.mask
+
def sample(self, x, conditioning, unconditional_conditioning):
if self.mask is not None: