官网
https://pytorch.org/hub/pytorch_vision_vgg/
可以参考这里:Anaconda学习
我是按照下面的博客一步步完成,亲测有效
Pytorch安装教程(最全最详细版)
我的win10安装环境:
conda install pytorch==1.7.1 torchvision==0.8.2 torchaudio==0.7.2 cudatoolkit=11.0 -c pytorch
出现下面的图,说明成功了!
from torchvision import models
reset=models.resnet101(pretrained=True)
如果出现下面错误:
解决方案:
DLL load failed while importing _imaging: 找不到指定的模块的解决方法
我本地采用:
pip uninstall pillow
pip install pillow==6.2.1 -i https://pypi.tuna.tsinghua.edu.cn/simple/
再次测试success:
PS F:\work\deep_learning\pytorch> & D:/ProgramData/Anaconda3/envs/pytorch/python.exe f:/work/deep_learning/pytorch/day001.py
Downloading: "https://download.pytorch.org/models/resnet101-5d3b4d8f.pth" to C:\Users\Administrator/.cache\torch\hub\checkpoints\resnet101-5d3b4d8f.pth
100.0%