在 model 后面加个 .module,再次运行,加载模型成功。
参考来自:pytorch——AttributeError: ‘DataParallel’ object has no attribute ‘****’
MedSegDiff加载checkpoint文件(.pt)报错AttributeError: ‘DataParallel‘ object has no attribute ‘****‘
最新推荐文章于 2024-06-10 09:34:31 发布
本文介绍了在使用PyTorch的DataParallel类加载模型时遇到的AttributeError,解决方法是在模型名称后添加.module,确保正确加载并运行模型。
摘要由CSDN通过智能技术生成