tf.train.get_checkpoint_state() return None

Viewed 38

I have a model.ckpt file that I downloaded from internet and located it in "ckpt" folder. When I have tried to get checkpoint it always return none. But when I check, the file is already exists. I'm a newbie in python. what's wrong with my code?

    import tensorflow as tf
    model_folder = "ckpt"
    if not tf.io.gfile.exists(model_folder):
        raise AssertionError(
        "Export directory doesn't exists. Please specify an export "
        "directory: %s" % model_folder)

    checkpoint = tf.train.get_checkpoint_state(model_folder)
    input_checkpoint = checkpoint.model_checkpoint_path
1 Answers

You can try loading the checkpoint like this:

import tensorflow as tf
model_folder = "ckpt"
latest = tf.train.latest_checkpoint(model_folder)

get_checkpoint_state does not get you the checkpoint, check the docs, it returns:

A CheckpointState if the state was available, None otherwise.

Related