Grounded-Segment-Anything icon indicating copy to clipboard operation
Grounded-Segment-Anything copied to clipboard

grounded_sam_inpainting_deomo.py runtime Error

Open KKKSQJ opened this issue 2 years ago • 1 comments

when i run grounded_sam_inpainting_deomo.py,it will report an error:RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 64 but got size 62 for tensor number 2 in the list.

text_config_dict is provided which will be used to initialize CLIPTextConfig. The value text_config["id2label"] will be overriden. A bird, high quality, detailed 0%| | 0/50 [00:00<?, ?it/s] Traceback (most recent call last): File "/workspace/Grounded-Segment-Anything/grounded_sam_inpainting_demo.py", line 199, in image = pipe(prompt=inpaint_prompt, image=image_pil, mask_image=mask_pil).images[0] File "/opt/conda/envs/sam/lib/python3.7/site-packages/torch/autograd/grad_mode.py", line 28, in decorate_context return func(*args, **kwargs) File "/opt/conda/envs/sam/lib/python3.7/site-packages/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py", line 854, in call latent_model_input = torch.cat([latent_model_input, mask, masked_image_latents], dim=1) RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 64 but got size 62 for tensor number 2 in the list.

May I ask how to run the program correctly.

KKKSQJ avatar Apr 12 '23 10:04 KKKSQJ

the diffusion model requires the image size(width and height) to be dividable by 64.

We suggest resize images to (512, 512) for inpainting. and resize to the original size as outputs.

SlongLiu avatar Apr 12 '23 11:04 SlongLiu