解决RuntimeError: Couldn‘t load custom C++ ops. This can happen if your PyTorch

07-19 1224阅读

问题描述

刚下好yolov8的代码,想测一下能否成果,果然没成功,报错如下

RuntimeError: Couldn't load custom C++ ops. This can happen if your PyTorch and torchvision versions are incompatible, or if you had errors while compiling torchvision from source. For f
urther information on the compatible versions, check https://github.com/pytorch/vision#installation for the compatibility matrix. Please check your PyTorch version with torch.__version__
 and your torchvision version with torchvision.__version__ and verify if they are compatible, and if not please reinstall torchvision so that it matches your PyTorch install.

简单来说就是torchvision和torch不匹配,就很离谱,我照着版本对应关系pip install的啊,怎么会不匹配

建议先看看你的版本

python
import torch
import torchvision
print(torch.__version__)
print(torchvision.__version__)

我是下图红框这个

解决RuntimeError: Couldn‘t load custom C++ ops. This can happen if your PyTorch

版本对应博文

首先确定自己torch没问题,因为我的3090这个卡目前cuda版本是11.1,这个whl是早就下好的,一般1-2G,有问题重新下就麻烦了

解决RuntimeError: Couldn‘t load custom C++ ops. This can happen if your PyTorch

解决RuntimeError: Couldn‘t load custom C++ ops. This can happen if your PyTorch

然后我pip install了很多次torchvision==0.11.3,都没啥用。想试着改改版本,结果要下其他的torch版本,就更不可能了。

解决

如果版本对的上,而且后缀都有cu111就没问题了,我的torchvision下了好多次,都没有这个后缀

解决RuntimeError: Couldn‘t load custom C++ ops. This can happen if your PyTorch

方法:去官网https://pytorch.org/get-started/previous-versions/,找到你想要的版本,复制后面的网址

解决RuntimeError: Couldn‘t load custom C++ ops. This can happen if your PyTorch

就是比如这个网址,https://download.pytorch.org/whl/cu111/torchvision/,找到要的whl下载后,本地pip install就好了

解决RuntimeError: Couldn‘t load custom C++ ops. This can happen if your PyTorch

VPS购买请点击我

文章版权声明:除非注明,否则均为主机测评原创文章,转载或复制请以超链接形式并注明出处。

目录[+]