Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tensorflow checkpoint models getting deleted

I am using tensorflow checkpointing after every 10 epochs using the following code :

checkpoint_dir = os.path.abspath(os.path.join(out_dir, "checkpoints"))
checkpoint_prefix = os.path.join(checkpoint_dir, "model")
...
if current_step % checkpoint_every == 0:
    path = saver.save(sess, checkpoint_prefix, global_step=current_step)
    print("Saved model checkpoint to {}\n".format(path))

The problem is that, as the new files are getting generated, previous 5 model files are getting deleted automatically.

like image 671
Nitin Avatar asked Dec 07 '16 13:12

Nitin


People also ask

What is Ckpt file in Tensorflow?

b) Checkpoint file: This is a binary file which contains all the values of the weights, biases, gradients and all the other variables saved. This file has an extension .ckpt.

What are Tensorflow checkpoints?

Checkpoints capture the exact value of all parameters ( tf. Variable objects) used by a model. Checkpoints do not contain any description of the computation defined by the model and thus are typically only useful when source code that will use the saved parameter values is available.


1 Answers

This is the expected behavior, the docs for tf.train.Saver say that by default the 5 most recent checkpoint files are kept. To adjust that, set max_to_keep the the desired value.

like image 63
Gregory Begelman Avatar answered Oct 12 '22 13:10

Gregory Begelman