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

网页运行显示error,不显示图片

Open cjf-repo opened this issue 1 year ago • 8 comments

运行的gradio_app.py选择seg的时候(其他的也一样),这里到5s左右就直接显示error,但是代码是没有报错,并且运行到了最后的return [image, mask_pil]这一步,而单独运行grounded_sam_demo.py是可以出来结果的,是我哪里需要修改吗,网页上没有显示出结果 image

cjf-repo avatar Apr 17 '23 12:04 cjf-repo

#136

Nidacoke avatar Apr 17 '23 13:04 Nidacoke

我也是 而且特别吃显存 就这个图10000多MB显存 请问知道怎么改呢

gukehan2000 avatar Apr 26 '23 09:04 gukehan2000

我也是 而且特别吃显存 就这个图10000多MB显存 请问知道怎么改呢

home/anaconda3/envs/github-2/lib/python3.8/site-packages/transformers/modeling_utils.py:862: FutureWarning: The device argument is deprecated and will be removed in v5 of Transformers. warnings.warn( /home/anaconda3/envs/github-2/lib/python3.8/site-packages/torch/utils/checkpoint.py:25: UserWarning: None of the inputs have requires_grad=True. Gradients will be None warnings.warn("None of the inputs have requires_grad=True. Gradients will be None") Traceback (most recent call last): File "/home/naconda3/envs/github-2/lib/python3.8/site-packages/gradio/routes.py", line 401, in run_predict output = await app.get_blocks().process_api( File "/home/anaconda3/envs/github-2/lib/python3.8/site-packages/gradio/blocks.py", line 1302, in process_api result = await self.call_function( File "/home/anaconda3/envs/github-2/lib/python3.8/site-packages/gradio/blocks.py", line 1025, in call_function prediction = await anyio.to_thread.run_sync( File "/home/anaconda3/envs/github-2/lib/python3.8/site-packages/anyio/to_thread.py", line 31, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "/home/anaconda3/envs/github-2/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread return await future File "/home/naconda3/envs/github-2/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 867, in run result = context.run(func, *args) File "/home/MyProject/Grounded-Segment-Anything-main/gradio_app.py", line 286, in run_grounded_sam masks, _, _ = sam_predictor.predict_torch( File "/home/anaconda3/envs/github-2/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context return func(*args, **kwargs) File "/home/MyProject/Grounded-Segment-Anything-main/segment_anything/segment_anything/predictor.py", line 229, in predict_torch low_res_masks, iou_predictions = self.model.mask_decoder( File "/home/gukehan/anaconda3/envs/github-2/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl return forward_call(*input, **kwargs) File "/home/MyProject/Grounded-Segment-Anything-main/segment_anything/segment_anything/modeling/mask_decoder.py", line 94, in forward masks, iou_pred = self.predict_masks( File "/home/MyProject/Grounded-Segment-Anything-main/segment_anything/segment_anything/modeling/mask_decoder.py", line 144, in predict_masks masks = (hyper_in @ upscaled_embedding.view(b, c, h * w)).view(b, -1, h, w) RuntimeError: cannot reshape tensor of 0 elements into shape [0, -1, 256, 256] because the unspecified dimension size -1 can be any value and is ambiguous

gukehan2000 avatar Apr 26 '23 09:04 gukehan2000

+1

lijain avatar Jun 02 '23 06:06 lijain

+1

Dratlan avatar Jul 03 '23 01:07 Dratlan

I got the same issue: RuntimeError: cannot reshape tensor of 0 elements into shape [0, -1, 256, 256] because the unspecified dimension size -1 can be any value and is ambiguous

wanghao-cst avatar Sep 19 '23 08:09 wanghao-cst

I got the same issue: RuntimeError: cannot reshape tensor of 0 elements into shape [0, -1, 256, 256] because the unspecified dimension size -1 can be any value and is ambiguous

I got the same issue,can you solve it now?

chenminupup avatar Nov 09 '23 03:11 chenminupup