解决AttributeError: ‘model‘ object has no attribute ‘copy‘

错误AttributeError: 'model' object has no attribute 'copy'原因原因是没有使用model.state_dict()进行模型保存,但是使用了model.load_state_dict()加载模型。这两者要配套使用。解决方案使用一下的方式保存、加载模型...

AttributeError: ‘model’ object has no attribute ‘copy’-pytorch

问题:加载训练模型出错解决方法:查看自己保存模型的方法,然后修改相应的加载方法1:state_dict方式保存:torch.save(model.state_dict(), 路径) # 推荐的文件后缀名是pt或pth加载:model = TheModelClass(*args, **kwargs) ...

本页面内关键词为智能算法引擎基于机器学习所生成,如有任何问题,可在页面下方点击"联系我们"与我们沟通。

产品推荐