当前位置:网站首页>torch.load加载模型报错:Can‘t get attribute ‘vae_vc‘ on <module ‘__main__‘ from ‘xxxx()运行文件路径‘
torch.load加载模型报错:Can‘t get attribute ‘vae_vc‘ on <module ‘__main__‘ from ‘xxxx()运行文件路径‘
2022-06-29 11:14:00 【Wsyoneself】
报错原因:torch.load在加载模型时实际需要参考网络结构构建出一个对应网络的实例对象,需要参考源class,所以报此错误原因是搭建的网络class 不在运行文件中
解决:
(1)简单解决:将网络class 代码复制一份到运行文件中
(2)参考我的博客:python动态导入自己写的模块或类_Wsyoneself的博客-CSDN博客
将网络所在文件的内容全部导入,如
from xxxx import *再次测试即可正确运行~
边栏推荐
- 启泰观察:职业精英创业必踩巨坑之 --- 学习效果坑
- Take another picture of cloud redis' improvement path
- 稳定币风险状况:USDT 和 USDC 安全吗?
- Safety innovation practice | Haitai Fangyuan was invited to participate in the technical exchange Seminar on "network information innovation and value co creation in the digital age"
- 【高并发】2.8万字的Callable和Future面试知识点总结,看完我直接面进了字节跳动,原谅我有点飘了(上)
- RSLO:自监督激光雷达里程计(实时+高精度,ICRA2022)
- [NLP] text generation topic 1: basic knowledge
- 年轻就要醒着拼,年轻就要勇于尝试
- MySQL enable slow query
- 记一次 MSI 笔记本 GE63 播放网页视频 闪屏和随机发绿 问题解决
猜你喜欢

安全 创新 实践|海泰方圆受邀参加“数字时代的网信创新与价值共创”技术交流研讨会

QT learning 08 set sail! First application instance

Nature | biosynthetic potential of global marine microbiome

How to identify the exact length and width of the contour

杰理之关于 TWS 交叉配对的配置【篇】

Exclusive interview with head of suss NIFT: the future of Web3 is inseparable from the governance of "everyone for me, I for everyone"

Qt学习16 Qt 对象间的父子关系

pod安全策略(PSP)

SOFARegistry 源码|数据同步模块解析

ONES 创始人王颖奇对话《财富》(中文版):中国有没有优秀的软件?
随机推荐
CICD简介[通俗易懂]
Unity learning notes --vector3 how to set default parameters
MySQL enable slow query
【高并发】2.8万字的Callable和Future面试知识点总结,看完我直接面进了字节跳动,原谅我有点飘了(中)
Is it safe to open a stock account online
Qt学习05 Qt Creator工程介绍
Record once MSI notebook ge63 plays webpage video flash screen and randomly turns green to solve the problem
钛动科技:我们的 Zadig 落地之路
Oracle netsuite helps TCM bio understand data changes and make business development more flexible
亲测!Centos7部署PHP + Swoole
杰理之关于 TWS 配对方式配置【篇】
mysql截取字符串去重,mysql 截取字符串 去重 拼接
Qt学习07 Qt中的坐标系统
matlab fmincon 精度,fmincon与quadprog误差
Initial use of eolink
普通用户使用vscode登录ssh编辑root文件
恒泰证券开户安全吗 证券排名
Oracle NetSuite 助力 TCM Bio,洞悉数据变化,让业务发展更灵活
Codeforces Round #803 (Div. 2)
Pytorch - 分布式通信原语(附源码)