Saving model in tensorflow

20,742

First of all you have to understand, that tensorflow graph does not have current weights in it (until you save them manually there) and if you load model structure from graph.pb, you will start you train from the very beginning. But if you want to continue train or use your trained model, you have to save checkpoint (using tf Saver) with the values of the variables in it, not only the structure. Check out this tread: Tensorflow: How to restore a previously saved model (python)

Share:
20,742
user3425082
Author by

user3425082

Updated on August 15, 2020

Comments

  • user3425082
    user3425082 almost 4 years

    Tensorflow allows us to save/load model's structure, using method tf.train.write_graph, so that we can restore it in the future to continue our training session. However, I'm wondering that if this is necessary because I can create a module, e.g GraphDefinition.py, and use this module to re-create the model. So, which is the better way to save the model structure or are there any rule of thumb that suggest which way should I use when saving a model?