kemaloksuz / RankSortLoss

Official PyTorch Implementation of Rank & Sort Loss for Object Detection and Instance Segmentation [ICCV2021]
Apache License 2.0
239 stars 26 forks source link

RuntimeError: expected scalar type Half but found Float #16

Closed sanmulab closed 2 years ago

sanmulab commented 2 years ago

Hello author! I seem to have a new problem now: I want to use half-precision fp16 for training, so I add the line fp16 = dict(loss_scale=512.) to the config file, but I get an error: . Does your codebase currently not support half-precision training?

error: File "/home/ubuntu/cs_logdet/rankSortLoss-main/mmdet/models/necks/fpn_carafe.py", line 256, in forward upsample_feat = self.upsample_modulesi - 1 File "/home/ubuntu/.conda/envs/testlogdet/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl return forward_call(*input, **kwargs) File "/home/ubuntu/.conda/envs/testlogdet/lib/python3.7/site-packages/mmcv/ops/carafe.py", line 285, in forward x = self.feature_reassemble(x, mask) File "/home/ubuntu/.conda/envs/testlogdet/lib/python3.7/site-packages/mmcv/ops/carafe.py", line 277, in feature_reassemble x = carafe(x, mask, self.up_kernel, self.up_group, self.scale_factor) File "/home/ubuntu/.conda/envs/testlogdet/lib/python3.7/site-packages/mmcv/ops/carafe.py", line 139, in forward scale_factor=scale_factor) RuntimeError: expected scalar type Half but found Float

kemaloksuz commented 2 years ago

Hi,

Unfortunately, we have tried the code with half precision. Having checked your error message, the error may not be related to RS Loss but carafe operation in the mmdetection, however, I am not fully sure. Have you tried to run an architecture without carafe?

sanmulab commented 2 years ago

This is the case, when I add fpn_carafe, I will have this error, and I can train normally without fpn_carafe. I will go to the official to raise this issue. Thanks for answering.