Skip to content

Cast boxes to double when scores.dtype == torch.float64 #5479

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

anmyachev
Copy link

To avoid: RuntimeError: dets should have the same type as scores.

Stacktrace:
 File "/home/jovyan/intel-xpu-backend-for-triton/.scripts_cache/pytorch/benchmarks/dynamo/common.py", line 2126, in check_accuracy
    breakpoint()
  File "/home/jovyan/intel-xpu-backend-for-triton/.scripts_cache/pytorch/benchmarks/dynamo/common.py", line 1942, in run_n_iterations
    model_iter_fn(mod, inputs, collect_outputs=False)
  File "/home/jovyan/intel-xpu-backend-for-triton/.scripts_cache/pytorch/benchmarks/dynamo/torchbench.py", line 460, in forward_pass
    return mod(*inputs)
  File "/home/jovyan/intel-xpu-backend-for-triton/.scripts_cache/pytorch/torch/nn/modules/module.py", line 1773, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/home/jovyan/intel-xpu-backend-for-triton/.scripts_cache/pytorch/torch/nn/modules/module.py", line 1785, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/jovyan/.conda/envs/xpu/lib/python3.10/site-packages/detectron2/modeling/meta_arch/rcnn.py", line 150, in forward
    return self.inference(batched_inputs)
  File "/home/jovyan/.conda/envs/xpu/lib/python3.10/site-packages/detectron2/modeling/meta_arch/rcnn.py", line 209, in inference
    proposals, _ = self.proposal_generator(images, features, None)
  File "/home/jovyan/intel-xpu-backend-for-triton/.scripts_cache/pytorch/torch/nn/modules/module.py", line 1773, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/home/jovyan/intel-xpu-backend-for-triton/.scripts_cache/pytorch/torch/nn/modules/module.py", line 1785, in _call_impl
    return forward_call(*args, **kwargs)
  File "/home/jovyan/.conda/envs/xpu/lib/python3.10/site-packages/detectron2/modeling/proposal_generator/rpn.py", line 477, in forward
    proposals = self.predict_proposals(
  File "/home/jovyan/.conda/envs/xpu/lib/python3.10/site-packages/detectron2/modeling/proposal_generator/rpn.py", line 503, in predict_proposals
    return find_top_rpn_proposals(
  File "/home/jovyan/.conda/envs/xpu/lib/python3.10/site-packages/detectron2/modeling/proposal_generator/proposal_utils.py", line 121, in find_top_rpn_proposals
    keep = batched_nms(boxes.tensor, scores_per_img, lvl, nms_thresh)
  File "/home/jovyan/.conda/envs/xpu/lib/python3.10/site-packages/detectron2/layers/nms.py", line 22, in batched_nms
    return box_ops.batched_nms(boxes.float(), scores, idxs, iou_threshold)
  File "/home/jovyan/.conda/envs/xpu/lib/python3.10/site-packages/torchvision/ops/boxes.py", line 81, in batched_nms
    return _batched_nms_vanilla(boxes, scores, idxs, iou_threshold)
  File "/home/jovyan/intel-xpu-backend-for-triton/.scripts_cache/pytorch/torch/jit/_trace.py", line 1347, in wrapper
    return fn(*args, **kwargs)
  File "/home/jovyan/.conda/envs/xpu/lib/python3.10/site-packages/torchvision/ops/boxes.py", line 117, in _batched_nms_vanilla
    curr_keep_indices = nms(boxes[curr_indices], scores[curr_indices], iou_threshold)
  File "/home/jovyan/.conda/envs/xpu/lib/python3.10/site-packages/torchvision/ops/boxes.py", line 48, in nms
    return torch.ops.torchvision.nms(boxes, scores, iou_threshold)
  File "/home/jovyan/intel-xpu-backend-for-triton/.scripts_cache/pytorch/torch/_ops.py", line 1244, in __call__
    return self._op(*args, **kwargs)
RuntimeError: dets should have the same type as scores

Before submitting a PR, please run dev/linter.sh to lint the code.

@facebook-github-bot
Copy link
Contributor

Hi @anmyachev!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants