第一次安装pytorch时,
conda install pytorch torchvision cudatoolkit=10.2 -c pytorch
下载后训练发现是cpu版本而不是gpu;
重新下载
pip3 install torch==1.10.1+cu102 torchvision==0.11.2+cu102 torchaudio===0.10.1+cu102 -f https://download.pytorch.org/whl/cu102/torch_stable.html
后出现下面错误,困扰我半天了也没弄出来
ImportError: Failed to load PyTorch C extensions:
It appears that PyTorch has loaded the torch/_C
folder
of the PyTorch repository rather than the C extensions which
are expected in the torch._C
namespace. This can occur when
using the install
workflow. e.g.
$ python setup.py install && python -c "import torch"
This error can generally be solved using the `develop` workflow
$ python setup.py develop && python -c "import torch" # This should succeed
or by running Python from a different directory.
我也遇到了这个报错:我在下载安装运行一些程序后都没有问题,昨天不知道为什么突然出现了这个报错。我尝试了报错下给的两个解决方案均不能解决问题,请问你已经解决了这个问题吗?