如何解决我的.pkl文件无法加载的问题


filename = "/content/classifier_10class.pkl"
infile = open(filename,'rb')
new_dict = pickle.load(infile)
infile.close()

EOFError                                  Traceback (most recent call last)
<ipython-input-57-36f3a6bd7cfb> in <module>()
1 filename = "/content/classifier_10class.pkl"
2 infile = open(filename,'rb')
---> 3 new_dict = pickle.load(infile)
4 infile.close()
EOFError: Ran out of input

可以试试下面的代码吗?

>>> import pickle
>>> with open('file.pkl', 'rb') as fp:
>>>     data = pickle.load(fp)

相关内容

  • 没有找到相关文章

最新更新