LSNet icon indicating copy to clipboard operation
LSNet copied to clipboard

RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation:

Open zhaoxiaodong789 opened this issue 3 years ago • 8 comments

When run lsnet_bbox_r50_fpn_1x_coco.py, I got the problem like this: 微信截图_20210515195205

zhaoxiaodong789 avatar May 15 '21 11:05 zhaoxiaodong789

what's your pytorch version?

Duankaiwen avatar May 19 '21 06:05 Duankaiwen

1.7.1

zhaoxiaodong789 avatar May 19 '21 06:05 zhaoxiaodong789

Please try to use Pytorch 1.5.0

Duankaiwen avatar May 19 '21 06:05 Duankaiwen

ok

zhaoxiaodong789 avatar May 19 '21 06:05 zhaoxiaodong789

Installation instruction https://github.com/eeric/LSNet_supplement

eeric avatar May 28 '21 01:05 eeric

I meet the same question, I just use 3090 GPU, which pytorch1.5 is not compatible with. Is it possible to run lsnet on pytorch1.7+?

zy937085318 avatar Jun 01 '21 07:06 zy937085318

I meet the same question, I just use 3090 GPU, which pytorch1.5 is not compatible with. Is it possible to run lsnet on pytorch1.7+?

You can use a higher version of PyTorch, e.g. 1.8.0, in case you have a GPU that only works under CUDA 11+ As you can see, the error is caused by inplace operations. If you turn on torch.autograd.set_detect_anomaly, you will find out what you need to do is to simply change some code in code/mmdet/models/dense_heads/lsnet_head.py You can change all the variable1 *= variable2 into variable1 = variable1 * variable2

I've tested it myself with NVIDIA A100 with PyTorch 1.8.0 and it works.

dongdongyee avatar Dec 16 '21 22:12 dongdongyee

收到

zhaoxiaodong789 avatar Dec 16 '21 22:12 zhaoxiaodong789