StableDiffusionInpaintPipeline Tensor Input Error
When calling aStableDiffusionInpaintPipelinepipeline, the documentation (Stable diffusion pipelines) states that tensors can be used as input for parametersimageandmask_image. The docs indicate thatmask_imageneeds to have shape (B, H, W, 1), but what is the expected shape forimage?I used (B, H, W, 1) for bothimageandmask_imageparameters, and got this error:----> Preformatted text4 image = pipe(prompt=inpaint_prompts[0], image=inpaint_input, mask_image=inpaint_mask).images[0]56 image2 frames/usr/local/lib/python3.7/dist-packages/torch/autograd/grad_mode.py in decorate_context(*args, **kwargs)25         def decorate_context(*args, **kwargs):26             with self.clone():—> 27                 return func(*args, **kwargs)28         return cast(F, decorate_context)29/usr/local/lib/python3.7/dist-packages/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py incall(self, prompt, image, mask_image, height, width, num_inference_steps, guidance_scale, negative_prompt, num_images_per_prompt, eta, generator, latents, output_type, return_dict, callback, callback_steps, **kwargs)361362         # prepare mask and masked_image→ 363         mask, masked_image = prepare_mask_and_masked_image(image, mask_image)364         mask = mask.to(device=self.device, dtype=text_embeddings.dtype)365         masked_image = masked_image.to(device=self.device, dtype=text_embeddings.dtype)/usr/local/lib/python3.7/dist-packages/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py in prepare_mask_and_masked_image(image, mask)2122 def prepare_mask_and_masked_image(image, mask):—> 23     image = np.array(image.convert(“RGB”))24     image = image[None].transpose(0, 3, 1, 2)25     image = torch.from_numpy(image).to(dtype=torch.float32) / 127.5 - 1.0AttributeError: ‘Tensor’ object has no attribute ‘convert’Are tensors not actually supported as inputs?
2022-11-09T10:16:06Z
Hi@jnick!You are right, tensors are not supported yet but that’s about to be fixed, seethis pull request.
2022-11-09T16:01:15Z
That’s great! Thank you@pcuenq!