RobustDet icon indicating copy to clipboard operation
RobustDet copied to clipboard

Problems with devices

Open Mr-Teal opened this issue 1 year ago • 5 comments

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!

Mr-Teal avatar Oct 21 '23 05:10 Mr-Teal

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

CrazyBrick avatar Nov 14 '23 14:11 CrazyBrick

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

No. I just used their pretrained model instead.

Mr-Teal avatar Nov 14 '23 14:11 Mr-Teal

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

No. I just used their pretrained model instead.

thank you for your reply!

CrazyBrick avatar Nov 14 '23 14:11 CrazyBrick

@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.

CrazyBrick avatar Nov 15 '23 08:11 CrazyBrick

@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!

Mr-Teal avatar Nov 15 '23 09:11 Mr-Teal