0
点赞
收藏
分享

微信扫一扫

RuntimeError: Error(s) in loading state_dict for

丹柯yx 2022-04-24 阅读 77
python

1.在载入模型参数前加上:

model = nn.DataParallel(model)

2.更改torch版本
部分原因是模型之间torch版本不匹配导致,加载使用模型时和训练模型时的环境不一致,可以重新安装torch
3.增加load_state_dict()属性

model.load_state_dict(checkpoint['state_dict'], strict=False)

举报

相关推荐

0 条评论