pth文件读取
参考知乎:https://zhuanlan.zhihu.com/p/84797438pytorch中保存的模型文件.pth深入解析
# -*- coding: utf-8 -*-
import torch
net = torch.load('iter_100000.pth')#加载模型
print(type(net))#<class 'dict'>
print(len(net))#3
#for k in net.keys():
# print(k)##meta state_dict optimizer
#meta state_dict optimizer这三项逐一加载查看
#print(net['meta'])
# for key,value in net['meta'].items():
# print(key,value)
# for key,value in net['state_dict'].items():
# print(key,value)
for key,value in net['optimizer'].items():
print(key,value)
想知道里面到底都写了些啥?
有大佬知道嘛??