Save and Restore sessions as checkpoints in TensorFlow

Updated 29 July 2021

How to Save and Restore sessions model as checkpoint

In this post, we are going to talk about checkpoints, how to save them, and restore them for training.


Checkpoints are saved the graph of all parameters that are used by a model. checkpoints do not contain a description of the computation defined by the model. checkpoints are binary files in a proprietary format that map variable names to tensor values. The best way to examine the contents of a checkpoint is to load it using a Saver.


The Saver class helps you to save the variables and restore them. Savers can automatically number checkpoint filenames with a provided counter by an option global_step. This lets you keep multiple checkpoints at different steps while training a model. For example, you can number the checkpoint filenames with the training step number. To avoid filling up disks, savers manage checkpoint files automatically. For example, they can keep only the N most recent files, or one checkpoint for every N hours of training.


after running this code you can find saved checkpoint in your specified directory.


.data: Contains variable values

.meta: Contains graph structure

.index: Identifies checkpoints


All the variables that you need to save in the disk, you can load your saved variables in the session using saver.restore(). we can load through this function and call this function inside your session object.

In addition, you can see the saved variables by this code as above mentioned.

After that, you can visualize this saved checkpoint through tensorboard. you just need to go to the directory where the checkpoints are saved open the terminal and run this command


I hope this blog will help you to save the checkpoint and restore the checkpoint in session. Feel free to comment for any problems or suggestions. Also, You can follow me here for more blogs. Thanks for reading.

Reference Links :
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*

Be the first to comment.

Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home