Skip to content
Advertisement

Cannot pickle Tensorflow object in Python – TypeError: can’t pickle _thread._local objects

I want to pickle the history object after running a keras fit on tensorflow. But I am getting an error.

JavaScript

It gives me the following error:

JavaScript

PS: To get the code to run, download the fashion_mnist data: https://s3.amazonaws.com/img-datasets/mnist.pkl.g

Advertisement

Answer

As Karl suggested, the history object cannot be pickled. But it’s dictionary can:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement