1 year ago
#380907
Hamzalihi
Unpickling heavy python Object returns error: EOFError Ran out of input Python
I have made a machine learning algorithm (RF) and saved it as a pickle for further use and the file is 5gb. When I unpickle it I get the error :
reg = pickle.load(f)
EOFError: Ran out of input
This is how I pickled the regression (from scikit-learn)
#Pickle
pickle_out = open("D:\\data_for_learning\\Regression.pickle","wb")
pickle.dump(Reg, pickle_out) #REG is from fit(x,y)
pickle_out.close()
And this is how unpickle it:
pickle_file = "D:\\data_for_learning\\RegressionRandom.pickle"
with open(pickle_file, 'rb') as f:
reg = pickle.load(f)
I have read that I could accidentally have overwritten my data but I have run it only once and tried to unpickle it the way I wrote it. I can rerun the machine learning part again but I want to know the source of the problem and why? Did I mess up the pickling?
python
scikit-learn
pickle
0 Answers
Your Answer