machine-learning - 加载 PyTorch 模型并收到错误“AttributeError: Can't get attribute 'Model' on"
问题描述
我正在使用 torch.load() 加载 Pytorch 模型并收到错误“AttributeError: Can't get attribute 'Model' on <module ' main '>”。有谁知道是什么原因造成的?
解决方案
已经保存的权重必须有一个类。您应该与加载的权重保持相同的类和文件体系结构。
因为隐式torch.load()
使用模块。pickle
推荐阅读
- java - 主题运算符未提供正确答案
- html - Flex-basis 除非没有子节点
- java - 如何在java中使用多线程查询所有50ms的数据
- c++ - C++读取功能改进,可以读取多个文件
- android - 当我单击打开弹出窗口的按钮时应用程序崩溃
- reactjs - Webpack URIError:无法解码参数'/%PUBLIC_URL%/favicon.ico'
- python - 在python中存储DNA矩阵的最佳方法
- python - Python:合并排序数据输入
- javascript - Jquery UI Slider,手柄跟随光标
- spring - 如何在 Spring Cloud Gateway 中为发现定位器编写复杂的谓词?