-
Notifications
You must be signed in to change notification settings - Fork 120
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: expected scalar type Half but found Float #2
Comments
@Jessejx hi, this problem is caused by resnet with dcn. I have updated the configuration and code set dcn as False. so, you can use resnet without dcn. please update your code.
only test resnet, there is no error, but when i train total network, the error is same as you. And id have check their weights: weights of DeformConv2d Although they are all float32, we can see that the former should be in half format. But I don't know why. Therefore, don't use the DCN for now. I will solve it when I have time. thanks! |
I think this is caused by the mixed precision training of apex, and the DCN support for this is not very good. I train resnet with dcn for DBNet, There was no problem. @Jessejx |
Thanks again. |
@ratom pleasse give me more your configs info, next week i will check it |
Thanks for your great work. I met this problem when I use resnet as backbone.
Traceback (most recent call last):
File "train.py", line 527, in
train(hyp, opt, device, tb_writer, wandb)
File "train.py", line 293, in train
pred = model(imgs) # forward
File "/home/jx/anaconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/jx/Workings/flexible-yolov5-main/od/models/model.py", line 67, in forward
out = self.backbone(x)
File "/home/jx/anaconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/jx/Workings/flexible-yolov5-main/od/models/backbone/resnet.py", line 208, in forward
x2 = self.layer2(x1)
File "/home/jx/anaconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/jx/anaconda3/lib/python3.8/site-packages/torch/nn/modules/container.py", line 117, in forward
input = module(input)
File "/home/jx/anaconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/jx/Workings/flexible-yolov5-main/od/models/backbone/resnet.py", line 119, in forward
out = self.conv2(out, offset)
File "/home/jx/anaconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/jx/anaconda3/lib/python3.8/site-packages/torchvision/ops/deform_conv.py", line 143, in forward
return deform_conv2d(input, offset, self.weight, self.bias, stride=self.stride,
File "/home/jx/anaconda3/lib/python3.8/site-packages/torchvision/ops/deform_conv.py", line 76, in deform_conv2d
return torch.ops.torchvision.deform_conv2d(
RuntimeError: expected scalar type Half but found Float
The text was updated successfully, but these errors were encountered: