当前位置:网站首页>pickle. Load error [attributeerror: can't get attribute 'volatile' on < module '\u main']
pickle. Load error [attributeerror: can't get attribute 'volatile' on < module '\u main']
2022-07-01 19:31:00 【hei_ hei_ hei_】
pickle.load Report errors 【AttributeError: Can’t get attribute ‘Vocabulary’ on <module ‘main’】
background : When looking at the code, I want to see a pkl The file structure of the file and the data inside , So I use pickle.load open , But there was
AttributeError: Can't get attribute 'Vocabulary' on <module '__main__'
errorreason : For example, there are two ways to save models , One is to save the whole model , Although very large, it is easy to use ; The other is to save only the parameters of the model , Here, you need to initialize a model before loading . It's the same here ,
msvd_vocab.pkl
When loading, you also need to find the class it depends on , And it is also explained in the error information , The classes to be imported areVocabulary
. So you need to find the class in the project Vocabulary, And then callpickle.load('.../msvd_vocab.pkl','rb')
Of python In file import This kindError code
import pickle
with open('.\data\MSVD\msvd_vocab.pkl','rb') as f:
v = pickle.load(f)
# Report errors : stay demo.py Of main There is no ‘Vocabulary’ modular
AttributeError: Can't get attribute 'Vocabulary' on <module '__main__' from '.../demo.py'>
- find ‘Vocabulary’ class
- correct
import pickle
from utils.utils import *
with open('.\data\MSVD\msvd_vocab.pkl','rb') as f:
v = pickle.load(f)
Perfect flowers
边栏推荐
- XML syntax, constraints
- web开发常用的开源框架的开源协议整理
- Getting started with kubernetes command (namespaces, pods)
- Lumiprobe 活性染料丨吲哚菁绿说明书
- 【Go ~ 0到1 】 第四天 6月30 defer,结构体,方法
- 【pytorch记录】模型的分布式训练DataParallel、DistributedDataParallel
- [pytorch record] automatic hybrid accuracy training torch cuda. amp
- axure不显示元件库
- SuperVariMag 超导磁体系统 — SVM 系列
- 数商云:从规划到落地,五矿集团如何快速构建数字化发展新格局?
猜你喜欢
nacos配置文件发布失败,请检查参数是否正确的解决方案
Lake Shore 连续流动低温恒温器传输线
Netease games, radical going to sea
Witness the times! "The future of Renji collaboration has come" 2022 Hongji ecological partnership conference opens live broadcast reservation
Love business in Little Red Book
EasyGBS主子码流都为H.265时,切换出现花屏如何解决?
Lumiprobe cell imaging study PKH26 cell membrane labeling kit
Supervarimag superconducting magnet system SVM series
Solution of digital supply chain centralized purchase platform in mechanical equipment industry: optimize resource allocation and realize cost reduction and efficiency increase
水产行业智能供应链管理平台解决方案:支撑企业供应链数字化,提升企业管理效益
随机推荐
见证时代!“人玑协同 未来已来”2022弘玑生态伙伴大会开启直播预约
简版拼多多商品数据
web开发常用的开源框架的开源协议整理
Contos 7 set up SFTP to create users, user groups, and delete users
June issue | antdb database participated in the preparation of the "Database Development Research Report" and appeared on the list of information technology and entrepreneurship industries
Chaos engineering platform chaosblade box new heavy release
Lake Shore 连续流动低温恒温器传输线
[pytorch record] distributed training dataparallel and distributeddataparallel of the model
混沌工程平台 ChaosBlade-Box 新版重磅发布
Implement a Prometheus exporter
Is PMP cancelled??
axure不显示元件库
Learn MySQL from scratch - database and data table operations
English语法_形容词/副词3级 -注意事项
[go ~ 0 to 1] day 5 July 1 type alias, custom type, interface, package and initialization function
Go语言高级
制造业SRM管理系统供应商全方位闭环管理,实现采购寻源与流程高效协同
Dom4j parsing XML, XPath retrieving XML
Team up to learn! 14 days of Hongmeng equipment development "learning, practicing and testing" practical camp, free of charge!
CDGA|从事通信行业,那你应该考个数据管理证书