Closed lucasjinreal closed 7 years ago
I think you can use pickle in python 3 instead of cPickle:
try:
import cPickle as pickle
except:
import pickle
I tried the same but it's not working.
Improved the code to
target_params = pickle.load(open('save/target_params.pkl','rb'))
.
Gives the following error:
ImportError: No module named 'numpy.core.multiarray\r'
Tried to resolve the \r
issue using this answer.
Yet the issue remains. Get this message.
TypeError: a bytes-like object is required, not 'str'
Can we create a new pickle for python 3 to resolve them?
I think original author save the data using python2.7 cPickle which may not can be properly opened by Python3 pickle, would original author resave this file using python3 for compatiable?
This should work:
import pickle
target_params = pickle.load(open('save/target_params.pkl', 'rb'), encoding='latin1')
Still not working.
I have added a new pickle file in python 3: https://github.com/LantaoYu/SeqGAN/blob/master/save/target_params_py3.pkl
Now you can read it with
import pickle
target_params = pickle.load(open('target_params_py3.pkl', 'rb'))
hi, I am trying run this repo under pyhton3, original implements using python2, code is fine but the target_params.pkl can not open, do you have an alternate version of that file which can open using python3?