Tensorflow: how to save/restore a model?

前端 未结 26 2617
迷失自我
迷失自我 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:23

    As Yaroslav said, you can hack restoring from a graph_def and checkpoint by importing the graph, manually creating variables, and then using a Saver.

    I implemented this for my personal use, so I though I'd share the code here.

    Link: https://gist.github.com/nikitakit/6ef3b72be67b86cb7868

    (This is, of course, a hack, and there is no guarantee that models saved this way will remain readable in future versions of TensorFlow.)

提交回复
热议问题