Fix inpainting mask shape assertions.

This commit is contained in:
Ryan Dick 2024-06-25 15:53:16 +00:00 committed by Kent Keirsey
parent b9946e50f9
commit cd9dfefe3c

View File

@ -255,8 +255,8 @@ class StableDiffusionGeneratorPipeline(StableDiffusionPipeline):
# Validate assumptions about input tensor shapes. # Validate assumptions about input tensor shapes.
batch_size, latent_channels, latent_height, latent_width = latents.shape batch_size, latent_channels, latent_height, latent_width = latents.shape
assert latent_channels == 4 assert latent_channels == 4
assert masked_ref_image_latents.shape == [1, 4, latent_height, latent_width] assert list(masked_ref_image_latents.shape) == [1, 4, latent_height, latent_width]
assert inpainting_mask == [1, 1, latent_height, latent_width] assert list(inpainting_mask.shape) == [1, 1, latent_height, latent_width]
# Repeat original_image_latents and inpainting_mask to match the latents batch size. # Repeat original_image_latents and inpainting_mask to match the latents batch size.
original_image_latents = masked_ref_image_latents.expand(batch_size, -1, -1, -1) original_image_latents = masked_ref_image_latents.expand(batch_size, -1, -1, -1)