soweego icon indicating copy to clipboard operation
soweego copied to clipboard

Switch to tensorflow.keras is blocked

Open marfox opened this issue 5 years ago • 0 comments

According to https://keras.io/ , the:

2.3.0 release will be the last major release of multi-backend Keras. Multi-backend Keras is superseded by tf.keras.

We need to switch to tf.keras to keep the project fresh.

However, it seems we're hitting an open tensorflow issue, see efd8f62ad9ff5432ae66a514c27c5cc6fcdc7433. As a temporary solution, I've kept the keras dependency.

In a nutshell:

  • pickle can't persist tensorflow.keras models;
  • we're using objects that wrap keras ones.

I see 2 workarounds that entail persistence with the h5 format and require some work:

  1. save the model with OUR_OBJECT.classifier.model.save and load it back with tensorflow.keras.models.load_model , see https://www.tensorflow.org/guide/keras/save_and_serialize#whole-model_saving. The problem here is that we lose our wrapper;
  2. (probably not worth) investigate h5py to persist our Python objects.

marfox avatar Apr 01 '20 10:04 marfox