IDEA-Research / Grounded-Segment-Anything

Grounded SAM: Marrying Grounding DINO with Segment Anything & Stable Diffusion & Recognize Anything - Automatically Detect , Segment and Generate Anything
https://arxiv.org/abs/2401.14159
Apache License 2.0
14.85k stars 1.37k forks source link

RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 64 but got size 40 for tensor number 2 in the list. #54

Closed vgg4resnet closed 1 year ago

vgg4resnet commented 1 year ago

python gradio_app.py

text_config_dict is provided which will be used to initialize CLIPTextConfig. The value text_config["id2label"] will be overriden. /media/47/Project_andy/envconda/mmyolo/lib/python3.8/site-packages/transformers-4.27.4-py3.8.egg/transformers/models/clip/feature_extraction_clip.py:28: FutureWarning: The class CLIPFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please use CLIPImageProcessor instead. warnings.warn( 0%| | 0/50 [00:00<?, ?it/s] Traceback (most recent call last): File "/media/47/Project_andy/envconda/mmyolo/lib/python3.8/site-packages/gradio/routes.py", line 393, in run_predict output = await app.get_blocks().process_api( File "/media/47/Project_andy/envconda/mmyolo/lib/python3.8/site-packages/gradio/blocks.py", line 1108, in process_api result = await self.call_function( File "/media/47/Project_andy/envconda/mmyolo/lib/python3.8/site-packages/gradio/blocks.py", line 915, in call_function prediction = await anyio.to_thread.run_sync( File "/media/47/Project_andy/envconda/mmyolo/lib/python3.8/site-packages/anyio/to_thread.py", line 31, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "/media/47/Project_andy/envconda/mmyolo/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread return await future File "/media/47/Project_andy/envconda/mmyolo/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 867, in run result = context.run(func, args) File "gradio_app.py", line 254, in run_grounded_sam image = pipe(prompt=inpaint_prompt, image=image_pil, mask_image=mask_pil).images[0] File "/media/47/Project_andy/envconda/mmyolo/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 28, in decorate_context return func(args, **kwargs) File "/media/47/Project_andy/envconda/mmyolo/lib/python3.8/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 40 for tensor number 2 in the list. running in inpainting mode ,some errors occur ,what is the reason

image

lzghades commented 1 year ago

i got same error about

Sizes of tensors must match except in dimension 1. Expected size 64 but got size 112 for tensor number 2 in the list.

how to fix it