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: expected scalar type Float but found Half #19

Open
David1-git opened this issue Aug 7, 2023 · 1 comment
Open

RuntimeError: expected scalar type Float but found Half #19

David1-git opened this issue Aug 7, 2023 · 1 comment

Comments

@David1-git
Copy link

Traceback (most recent call last):
File "/home/valca509/Desktop/TransCenter_official-main/training/main_mot20.py", line 511, in
main(args)
File "/home/valca509/Desktop/TransCenter_official-main/training/main_mot20.py", line 366, in main
model, criterion, postprocessors, data_loader_val, base_ds, device, args.output_dir, args.half
File "/home/valca509/anaconda3/envs/transcenter3/lib/python3.7/site-packages/torch/autograd/grad_mode.py", line 28, in decorate_context
return func(*args, **kwargs)
File "/home/valca509/Desktop/TransCenter_official-main/training/engine.py", line 172, in evaluate
outputs = model(samples, pre_samples=pre_samples, pre_hm=targets['pre_cts'].clone())
File "/home/valca509/anaconda3/envs/transcenter3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
return forward_call(*input, **kwargs)
File "/home/valca509/Desktop/TransCenter_official-main/training/deformable_detr.py", line 215, in forward
hs[layer_lvl] = self.ida_up(hs[layer_lvl], 0, len(hs[layer_lvl]))[-1]
File "/home/valca509/anaconda3/envs/transcenter3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
return forward_call(*input, **kwargs)
File "/home/valca509/Desktop/TransCenter_official-main/models/dla.py", line 96, in forward
layers[i-1] = node(layers[i] + layers[i - 1])
File "/home/valca509/anaconda3/envs/transcenter3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
return forward_call(*input, **kwargs)
File "/home/valca509/anaconda3/envs/transcenter3/lib/python3.7/site-packages/torch/cuda/amp/autocast_mode.py", line 141, in decorate_autocast
return func(*args, **kwargs)
File "/home/valca509/Desktop/TransCenter_official-main/models/dla.py", line 47, in forward
x_out = self.conv(x)
File "/home/valca509/anaconda3/envs/transcenter3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1051, in _call_impl
return forward_call(*input, **kwargs)
File "/home/valca509/Desktop/TransCenter_official-main/to_install/DCNv2_1.9/dcn_v2.py", line 172, in forward
self.deformable_groups,
File "/home/valca509/Desktop/TransCenter_official-main/to_install/DCNv2_1.9/dcn_v2.py", line 39, in forward
ctx.deformable_groups,
RuntimeError: expected scalar type Float but found Half

@yihongXU
Copy link
Owner

yihongXU commented Aug 7, 2023

Hi,

It is because DCN doesn't support half precision. Please add .float() in your dcn_v2.py file.
Like:
https://gitlab.inria.fr/robotlearn/TransCenter_official/-/blob/main/to_install/DCNv2/dcn_v2.py#L152

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

2 participants