conda换源
https://zhuanlan.zhihu.com/p/95100538
anaconda清华源
https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64/
https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/linux-64/
https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda本地安装下载的包
https://blog.csdn.net/zhaotun123/article/details/100765510
pytorch安装
import torch
print(torch.__version__)
print(torchvision.__version__)
print(torch.cuda.is_available())
torch.cuda.device_count()
torch.cuda.current_device()
torch.cuda.get_device_name(id)
print("cuDNN version is :")
print(torch.backends.cudnn.version())
如果是 True,意味着你可以使用 GPU,如果是 False,意味着只能使用CPU。
pytorch模型存储的两种方式
1.保存整个网络结构信息和模型参数信息:
torch.save(model_object, './model.pth')
直接加载即可使用:
model = torch.load('./model.pth')
2.只保存网络的模型参数-推荐使用
torch.save(model_object.state_dict(), './params.pth')
加载则要先从本地网络模块导入网络,然后再加载参数:
from models import AgeModel
model = AgeModel()
model.load_state_dict(torch.load('./params.pth'))
pytorch2onnx
https://pytorch.org/tutorials/advanced/super_resolution_with_caffe2.html
安装pytorch后在导入pytorch时libmkl_intel_lp64.so找不到解决办法
https://www.cnblogs.com/denny402/p/10848506.html