我正在尝试加载保存了以下内容的模型,这给了我这个错误:
import torch
model = torch.load('./grunet.pkl')
model.eval()
这是错误:
Traceback (most recent call last):
File ".\eval.py", line 4, in <module>
model.eval()
AttributeError: 'NoneType' object has no attribute 'eval'
请帮助!
答案 0 :(得分:0)
您缺少一步:
model = YourModelClass()
model.load_state_dict(torch.load("./grunet.pkl"))
model.eval()
# do something with the model