Skip to content
This repository was archived by the owner on Apr 19, 2026. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions evaluate_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@
"evaluate_single_checkpoint",
"",
"If set, defines the checkpoint file prefix to evaluate "
'and then exit, e.g. "model.ckpt-97231".',
'and then exit, e.g. "model.ckpt-97231". Use "latest" to evaluate '
"the latest checkpoint.",
)

FLAGS = flags.FLAGS
Expand Down Expand Up @@ -146,7 +147,14 @@ def evaluate(hps, result_dir, tuner=None, trial_name=None):
)

if FLAGS.evaluate_single_checkpoint:
meta_file = FLAGS.evaluate_single_checkpoint + ".meta"
if FLAGS.evaluate_single_checkpoint == "latest":
latest_ckpt = tf.train.latest_checkpoint(result_dir)
if not latest_ckpt:
logging.warning("No checkpoints in %s", result_dir)
return
meta_file = os.path.basename(latest_ckpt) + ".meta"
else:
meta_file = FLAGS.evaluate_single_checkpoint + ".meta"
else:

potential_files = tf.gfile.ListDirectory(result_dir)
Expand Down