nlintz / TensorFlow-Tutorials

Simple tutorials using Google's TensorFlow Framework
6k stars 1.52k forks source link

Saving and Restoring model, it starts from the same epoch. #97

Open mmuratarat opened 5 years ago

mmuratarat commented 5 years ago

In 10_save_restore_net.ipynb file, you save the model at each epoch. When you interrupt it with keyboard and starting running again, the model is restored from the epoch where the interruption occurred and it computes the loss (predictions in your case) at that epoch once again. For example, Model runs until epoch 2 and then I interrupt it:

Start from: 0 0 0.9374 1 0.9634 2 0.9697

After I re-run it, ./ckpt_dir/model.ckpt-2 INFO:tensorflow:Restoring parameters from ./ckpt_dir/model.ckpt-2 Start from: 2 2 0.9742 3 0.9747 4 0.9774 5 0.9768 6 0.9783 7 0.9786 8 0.9785 .....

It is computing the loss (predictions in your case) for the epoch 2 once again.

How correct is that?

Can I do start = global_step.eval() + 1?