Fixed mask+masked_image in sd inpaint pipeline (#1516)

* Fixed mask+masked_image in sd inpaint pipeline

Those were left unset when inputs are not PIL images

* Fixed formatting
This commit is contained in:
Antoine Bouthors 2022-12-03 04:51:51 +12:00 committed by GitHub
parent 769f0be8fb
commit 3ad49eeedd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -632,6 +632,9 @@ class StableDiffusionInpaintPipeline(DiffusionPipeline):
# 4. Preprocess mask and image
if isinstance(image, PIL.Image.Image) and isinstance(mask_image, PIL.Image.Image):
mask, masked_image = prepare_mask_and_masked_image(image, mask_image)
else:
mask = mask_image
masked_image = image * (mask < 0.5)
# 5. set timesteps
self.scheduler.set_timesteps(num_inference_steps, device=device)