in benchmarks/horovod-resnet/train_imagenet_resnet_hvd.py [0:0]
def sort_and_load_ckpts(log_dir):
ckpts = []
for f in os.listdir(log_dir):
m = re.match(r"model.ckpt-([0-9]+).index", f)
if m is None:
continue
fullpath = os.path.join(log_dir, f)
ckpts.append(
{
"step": int(m.group(1)),
"path": os.path.splitext(fullpath)[0],
"mtime": os.stat(fullpath).st_mtime,
}
)
ckpts.sort(key=itemgetter("step"))
return ckpts