Tensorflow: how to save/restore a model?

前端 未结 26 2592
迷失自我
迷失自我 2020-11-21 11:37

After you train a model in Tensorflow:

  1. How do you save the trained model?
  2. How do you later restore this saved model?
26条回答
  •  灰色年华
    2020-11-21 12:04

    I'm on Version:

    tensorflow (1.13.1)
    tensorflow-gpu (1.13.1)
    

    Simple way is

    Save:

    model.save("model.h5")
    

    Restore:

    model = tf.keras.models.load_model("model.h5")
    

提交回复
热议问题