aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-08-30 19:08:04 +0300
committerAUTOMATIC1111 <16777216c@gmail.com>2023-08-30 19:08:17 +0300
commit135b61bc0bb9fe3ddde5d54a96a03157300c3cbe (patch)
tree24592ed3404d8937cc4469d705de7f83b3063a5a /modules
parent87cca029d7133b4060650b8ec33fc6772cc2f7dd (diff)
fix inpainting models in txt2img creating black pictures
Diffstat (limited to 'modules')
-rw-r--r--modules/processing.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/processing.py b/modules/processing.py
index f696e925..e08b6305 100644
--- a/modules/processing.py
+++ b/modules/processing.py
@@ -91,8 +91,8 @@ def create_binary_mask(image):
def txt2img_image_conditioning(sd_model, x, width, height):
if sd_model.model.conditioning_key in {'hybrid', 'concat'}: # Inpainting models
- # The "masked-image" in this case will just be all zeros since the entire image is masked.
- image_conditioning = torch.zeros(x.shape[0], 3, height, width, device=x.device)
+ # The "masked-image" in this case will just be all 0.5 since the entire image is masked.
+ image_conditioning = torch.ones(x.shape[0], 3, height, width, device=x.device) * 0.5
image_conditioning = images_tensor_to_samples(image_conditioning, approximation_indexes.get(opts.sd_vae_encode_method))
# Add the fake full 1s mask to the first dimension.