1、问题描述
最近在用Swin Transformer做语义分割的任务,基本的配置环境参考的是GitHub的基础安装步骤,主要的是环境的配置问题,mmcv的配置要求,不允许高于1.4.0,所以,在train.py文件进行训练运行的时候,报错:RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [2, 512, 32, 32]], which is output 0 of ReluBackward0, is at version 1; expected version 0 instead. Hint: enable anomaly detection to find the operation that failed to compute its gradient, with torch.autograd.set_detect_anomaly(True).
2、解决方案与配置单
1、python=3.8
2、conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=11.1 -c pytorch -c conda-forge
3、pip install mmcv-full==1.4.0 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.8.0/index.html
3、总结
就是环境问题,这是我浪费了一天的时间,总结出来的配置单,大家有问题也可以私信我