tachyon
tachyon

Reputation: 479

How to load keras model with tensorflow v1.x backend in keras with tensorflow v2.x backend?

I have a saved model with h5 format created using keras with tensorflow v1.x backend. I can no longer load this model in keras with tensorflow v2.x backend using keras.models.load_model. Is there anyway to migrate the saved model to make it compatible with newer keras with tensorflow v2.x backend?

So far I have found tools / tutorials to migrate the code but I could not find any useful way to upgrade the saved models. I know there is tf.compat.v1.saved_model.load method for tensorflow but I cannot really use that as I saved the model using keras.

Upvotes: 3

Views: 1534

Answers (1)

Dr. Snoopy
Dr. Snoopy

Reputation: 56367

You should be able to load the same model in TensorFlow 1.x and 2.x, but for this you need to use a version of Keras that supports both, for example, Keras 2.3.1

Upvotes: 4

Related Questions