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.97k stars 1.39k forks source link

run 'python grounding_dino_demo.py ' get error #186

Open sl-gong opened 1 year ago

sl-gong commented 1 year ago

/home/agmap/users/conda/gsam/lib/python3.10/site-packages/torch/functional.py:504: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:3483.) return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined] final text_encoder_type: bert-base-uncased Some weights of the model checkpoint at bert-base-uncased were not used when initializing BertModel: ['cls.predictions.transform.dense.bias', 'cls.predictions.decoder.weight', 'cls.predictions.transform.dense.weight', 'cls.seq_relationship.weight', 'cls.predictions.transform.LayerNorm.weight', 'cls.seq_relationship.bias', 'cls.predictions.transform.LayerNorm.bias', 'cls.predictions.bias']

rentainhe commented 1 year ago

Hello, it seems like a warning more than error? Would you like to share more info with us about this~

oyw233 commented 1 year ago

I have same question, and no output

wangyuyuchen commented 1 year ago

I have same question, and no output

fmy7834 commented 1 year ago

I have same question, but when I change DEVICE = "cuda:5" to DEVICE = "cuda", it works.

Leestronger commented 1 year ago

I have same question, but when I change DEVICE = "cuda:5" to DEVICE = "cuda", it works. Is that the sentence you changed: export CUDA_VISIBLE_DEVICES=0 python grounded_sam_demo.py \ --config GroundingDINO/groundingdino/config/GroundingDINO_SwinT_OGC.py \ --grounded_checkpoint groundingdino_swint_ogc.pth \ --sam_checkpoint sam_vit_h_4b8939.pth \ --input_image assets/demo1.jpg \ --output_dir "outputs" \ --box_threshold 0.3 \ --text_threshold 0.25 \ --text_prompt "bear" \ --device "cuda"

rentainhe commented 1 year ago

I have same question, but when I change DEVICE = "cuda:5" to DEVICE = "cuda", it works.

It's something wrong with the custom operator MultiscaleDeformable Attention, it did not support to set specific CUDA device for inference, to solve this problem you can set the CUDA_VISIBLE_DEVICES before running the demo:

CUDA_VISIBLE_DEVICES=5
python demo.py