简体   繁体   中英

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 .

您应该能够在 TensorFlow 1.x 和 2.x 中加载相同的模型,但为此您需要使用支持两者的 Keras 版本,例如 Keras 2.3.1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM