Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: "sigmoid_cpu" not implemented for 'Half', when run command 'python grounding_dino_demo.py' #479

Open
loubron23 opened this issue Mar 28, 2024 · 3 comments

Comments

@loubron23
Copy link

(sam) loubron@loubron-PC:~/disk/sam/Grounded-Segment-Anything$ python grounding_dino_demo.py
UserWarning: Failed to load image Python extension: libc10_hip.so: cannot open shared object file: No such file or directory
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:3190.)
final text_encoder_type: bert-base-uncased
Some weights of the model checkpoint at bert-base-uncased were not used when initializing BertModel: ['cls.seq_relationship.weight', 'cls.seq_relationship.bias', 'cls.predictions.transform.LayerNorm.weight', 'cls.predictions.transform.dense.bias', 'cls.predictions.transform.dense.weight', 'cls.predictions.transform.LayerNorm.bias', 'cls.predictions.bias']

  • This IS expected if you are initializing BertModel from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).
  • This IS NOT expected if you are initializing BertModel from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).
    FutureWarning: The device argument is deprecated and will be removed in v5 of Transformers.
    UserWarning: None of the inputs have requires_grad=True. Gradients will be None
    Traceback (most recent call last):
    File "grounding_dino_demo.py", line 21, in
    boxes, logits, phrases = predict(
    File "/home/loubron/disk/Grounded-Segment-Anything-main/GroundingDINO/groundingdino/util/inference.py", line 69, in predict
    prediction_logits = outputs["pred_logits"].cpu().sigmoid()[0] # prediction_logits.shape = (nq, 256)
    RuntimeError: "sigmoid_cpu" not implemented for 'Half'
@loubron23 loubron23 changed the title RuntimeError: "sigmoid_cpu" not implemented for 'Half' when RUN RuntimeError: "sigmoid_cpu" not implemented for 'Half', when run command 'python grounding_dino_demo.py' Mar 28, 2024
@live-github
Copy link

live-github commented Apr 1, 2024

Use cuda or remove
# if FP16_INFERENCE
# image = image.half()
# model = model.half()
in the grounding_dino_demo.py

@JCBreath
Copy link

Use cuda or remove # if FP16_INFERENCE # image = image.half() # model = model.half() in the grounding_dino_demo.py

Works perfectly, thanks!

@rexainn
Copy link

rexainn commented May 21, 2024

Use cuda or remove # if FP16_INFERENCE # image = image.half() # model = model.half() in the grounding_dino_demo.py

I'm sorry but I want to know how to use cuda for this script? I can use cuda for anything else, I think cuda will also work well for this project, but it's not. Should I need some extra settings?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants