IrisRainbowNeko / RobustDet

The official PyTorch implementation of "Adversarially-Aware Robust Object Detector"
56 stars 12 forks source link

Problems with devices #15

Open Mr-Teal opened 1 year ago

Mr-Teal commented 1 year ago

Hi! When I train the model with train_robust.py, I met this problem: When I run the command to train with VOC dataset on cuda device, it shows TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first. When I train on cpu, it shows RuntimeError: Expected a 'cuda' device type for generator but found 'cpu'. How should I solve this? I modified the code so that I can run it. As I use torch 2.1, in train_robust.py, I changed the number in the line if torch.__version__.startswith('1.9') to 2.1 so that the code can use my cuda device. Thanks a lot!

CrazyBrick commented 1 year ago

@Mr-Teal ,Hi, have you solved this problem?

Mr-Teal commented 1 year ago

@Mr-Teal ,Hi, have you solved this problem?

No. I just used their pretrained model instead.

CrazyBrick commented 1 year ago

@Mr-Teal ,Hi, have you solved this problem?

No. I just used their pretrained model instead.

thank you for your reply!

CrazyBrick commented 1 year ago

@Mr-Teal ,Hi, have you solved this problem?

No. I just used their pretrained model instead.

hi, I guess it may be due to version differences(of torch and numpy). I seem to be able to train normally now.

Mr-Teal commented 1 year ago

@Mr-Teal ,Hi, have you solved this problem?

No. I just used their pretrained model instead.

hi, I guess it may be due to version differences(of torch and numpy). I seem to be able to train normally now.

Oh that's nice!