Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how can i load pickle file? #22

Closed
mathshangw opened this issue Mar 27, 2021 · 4 comments
Closed

how can i load pickle file? #22

mathshangw opened this issue Mar 27, 2021 · 4 comments

Comments

@mathshangw
Copy link

mathshangw commented Mar 27, 2021

thanks for sharing the code .. i'm trying to load pickle file to read it using these commands

import pickle infile = open('data.pkl','rb') new_dict = pickle.load(infile) infile.close() print(type(new_dict))
but error is
_pickle.UnpicklingError: A load persistent id instruction was encountered, but no persistent_load function was specified.
i searched for the solution but got that pickle file appears to be using advanced features that suggest it was never supposed to be directly loaded this way. can you help, please ?

@whai362
Copy link
Owner

whai362 commented Mar 27, 2021

What is the error code? It seems that there is no 'data.pkl' in this repository.

@mathshangw
Copy link
Author

mathshangw commented Mar 27, 2021

thanks for replying , the error is
line 3, in <module> new_dict = pickle.load(infile) _pickle.UnpicklingError: A load persistent id instruction was encountered, but no persistent_load function was specified.
i tried to open epoch1 after it finished

@whai362
Copy link
Owner

whai362 commented Mar 28, 2021

Could you provide the complete source code and point out the error line?
For example, in XXX line of XXX.py.

@whai362
Copy link
Owner

whai362 commented Mar 28, 2021

There might be a format problem with your data.pkl.
As I know, the pickle of py2 and py3 are not compatible.
You could check the document of pickle. I have no idea about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants