I am trying to serialize a trained KerasClassifier. There seems to be no issue serializing and deserializing a model before fitting, but after .fit() is called, things seem to break down for me. I am using python 3.12 and scikeras 0.13.
There are several errors, but they are all of a similar flavor to this one:
TypeError: <class 'keras.src.models.sequential.Sequential'> could not be deserialized properly. Please ensure that components that are Python object instances (layers, models, etc.) returned by get_config() are explicitly deserialized in the model's from_config() method.
Is there additional customization of a KerasClassifier model that has to be done before or after fitting to make it serializable again?
Hello,
I am trying to serialize a trained KerasClassifier. There seems to be no issue serializing and deserializing a model before fitting, but after .fit() is called, things seem to break down for me. I am using python 3.12 and scikeras 0.13.
Here is a very simple example, following the outline of the https://adriangb.com/scikeras/stable/advanced.html page:
https://colab.research.google.com/drive/162oDiHwSHXf_TwtCaqDglS5-hy7fPJkU?usp=sharing
There are several errors, but they are all of a similar flavor to this one:
TypeError: <class 'keras.src.models.sequential.Sequential'> could not be deserialized properly. Please ensure that components that are Python object instances (layers, models, etc.) returned by
get_config()
are explicitly deserialized in the model'sfrom_config()
method.Is there additional customization of a KerasClassifier model that has to be done before or after fitting to make it serializable again?
With gratitude, CAW9