tf.train.get_checkpoint_state always None

Viewed 6097

I am using tf.train.get_checkpoint_state to check whether I have a valid checkpoint file to restore a Tensorflow saved model.

ckpt = tf.train.get_checkpoint_state(os.path.dirname('fi/saves'))
if ckpt and ckpt.model_checkpoint_path:
   saver.restore(sess, ckpt.model_checkpoint_path)  

My issue is that ckpt is always None. Here is the content of my saves directory:

  • internals.pkl
  • stats.json
  • variables.ckpt.data-00000-of-00001
  • variables.ckpt.index

Please note that a call to restore directly works well.

EDIT:

I have tried using the latest_filename argument like this:

tf.train.get_checkpoint_state(os.path.dirname(checkpoint_dir), latest_filename='variables.ckpt.index')  

I am still getting None.

1 Answers
Related