Skip to content
New issue

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

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

Already on GitHub? # to your account

RuntimeError: expected scalar type Half but found Float (DCN, fp16, MMCV 1.3.2) #1004

Closed
shinya7y opened this issue Apr 29, 2021 · 3 comments · Fixed by #1014
Closed

RuntimeError: expected scalar type Half but found Float (DCN, fp16, MMCV 1.3.2) #1004

shinya7y opened this issue Apr 29, 2021 · 3 comments · Fixed by #1014
Assignees
Labels

Comments

@shinya7y
Copy link
Contributor

Describe the Issue

MMCV 1.3.2 causes the RuntimeError for DCN with fp16 training.

Reproduction

Training with the following mmdet config reproduces the error.

faster_rcnn_r50_fpn_fp16_dconv_c3-c5_1x_coco.py

_base_ = '../faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py'
model = dict(
    backbone=dict(
        dcn=dict(type='DCN', deform_groups=1, fallback_on_stride=False),
        stage_with_dcn=(False, True, True, True)))
fp16 = dict(loss_scale=512.)

Environment

  • Error:
    • PyTorch: 1.7.1, MMCV: 1.3.2, MMDetection: 2.11.0+b536fb0
  • No error:
    • PyTorch: 1.7.1, MMCV: 1.3.1, MMDetection: 2.11.0+b536fb0
    • PyTorch: 1.7.1, MMCV: 1.3.0, MMDetection: 2.11.0+b536fb0

Error traceback
If applicable, paste the error traceback here.

  File "/home/shinya7y/miniconda3/envs/mmd2110/lib/python3.7/site-packages/mmcv/runner/fp16_utils.py", line 124, in new_func
    output = old_func(*new_args, **new_kwargs)
...
  File "/home/shinya7y/work/mmdetection/mmdet/models/backbones/resnet.py", line 272, in _inner_forward
    out = self.conv2(out)
  File "/home/shinya7y/miniconda3/envs/mmd2110/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/shinya7y/miniconda3/envs/mmd2110/lib/python3.7/site-packages/mmcv/ops/deform_conv.py", line 355, in forward
    self.dilation, self.groups, self.deform_groups)
  File "/home/shinya7y/miniconda3/envs/mmd2110/lib/python3.7/site-packages/mmcv/ops/deform_conv.py", line 100, in forward
    im2col_step=cur_im2col_step)
RuntimeError: expected scalar type Half but found Float
@ZwwWayne
Copy link
Collaborator

Hi @shinya7y ,
Thanks for your bug report, we will fix it ASAP.

@ZwwWayne ZwwWayne self-assigned this Apr 29, 2021
@shinya7y
Copy link
Contributor Author

shinya7y commented May 7, 2021

If no progress, I will send a PR.

@ZwwWayne
Copy link
Collaborator

ZwwWayne commented May 8, 2021

Hi @shinya7y ,
Currently, we are working on the resuming issue of FP16 training. So PRs are welcomed!.

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

Successfully merging a pull request may close this issue.

2 participants