jozhang97/DETA

indices should be either on cpu or on the same device as the indexed tensor (cpu)

yinyjin opened this issue · 0 comments

#when I train the model, i meet the wrong:

return _VF.meshgrid(tensors, **kwargs)  # type: ignore[attr-defined]
Traceback (most recent call last):
  File "main.py", line 345, in <module>
Traceback (most recent call last):
  File "main.py", line 345, in <module>
    main(args)
  File "main.py", line 295, in main
    main(args)
  File "main.py", line 295, in main
    model, criterion, data_loader_train, optimizer, device, epoch, args.clip_max_norm)
  File "/hdd/jy/code/DETA/engine.py", line 43, in train_one_epoch
    model, criterion, data_loader_train, optimizer, device, epoch, args.clip_max_norm)
  File "/hdd/jy/code/DETA/engine.py", line 43, in train_one_epoch
    loss_dict = criterion(outputs, targets)
  File "/home/jinying/miniconda3/envs/deta/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
    loss_dict = criterion(outputs, targets)
  File "/home/jinying/miniconda3/envs/deta/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
        return forward_call(*input, **kwargs)return forward_call(*input, **kwargs)

  File "/hdd/jy/code/DETA/models/deformable_detr.py", line 398, in forward
  File "/hdd/jy/code/DETA/models/deformable_detr.py", line 398, in forward
    indices = self.stg1_assigner(enc_outputs, bin_targets)
    indices = self.stg1_assigner(enc_outputs, bin_targets)  File "/home/jinying/miniconda3/envs/deta/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl

  File "/home/jinying/miniconda3/envs/deta/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
    return forward_call(*input, **kwargs)
  File "/hdd/jy/code/DETA/models/assigner.py", line 326, in forward
    return forward_call(*input, **kwargs)
  File "/hdd/jy/code/DETA/models/assigner.py", line 326, in forward
    pos_pr_inds = all_pr_inds[matched_labels == 1]
    pos_pr_inds = all_pr_inds[matched_labels == 1]
RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu)
RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu)
Traceback (most recent call last):
  File "./tools/launch.py", line 192, in <module>
    main()
  File "./tools/launch.py", line 188, in main
    cmd=process.args)
subprocess.CalledProcessError: Command '['./configs/deta.sh', '--coco_path', '/hdd/jy/code/data/coco2017']' returned non-zero exit status 1.

#Why?
#the wrong with the code or train environment?