问题描述:yolov7 RuntimeError:indices should be either on cpu or on the same device as the indexed tensor(cpu)
问题解答:
原因:torch的版本过高
之前安装torch时默认安装的最高版本,实际上最高版本与其他库不兼容。
错误的torch版本
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
正确的torch版本
pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio==0.8.0 -f https://download.pytorch.org/whl/torch_stable.html