KeyError when loading pickled scikit-learn model using joblib
The solution to this was pretty banal: Without being aware of it I was using the version of joblib
in sklearn.externals.joblib
for the pickling, but a newer version of joblib
for unpickling the object. The problem was resolved when I used the newer version of joblib
for both tasks.
Mine was interesting. I was working with git-lfs
and thus the files had been changed and joblib couldn't open them. So I needed to run git lfs pull
to get actual files. So if you are using compatible joblib versions, make sure your files are not changed somehow!
With me, happened that I exported the model using from sklearn.externals import joblib
and tried to load using import joblib
.