facebookresearch / facebookresearch/SlowFast

get_best_checkpoint and get_last_checkpoint?

Open
#706 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
7.4k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

How can I get the best_checkpoint? Only the last_checkpoint will be loaded during the test.

`def get_last_checkpoint(path_to_job, task):
"""
Get the last checkpoint from the checkpointing folder.
Args:
path_to_job (string): the path to the folder of the current job.
"""

d = get_checkpoint_dir(path_to_job)
names = pathmgr.ls(d) if pathmgr.exists(d) else []
if task != "":
names = [f for f in names if "{}_checkpoint".format(task) in f]
else:
names = [f for f in names if f.startswith("checkpoint")]
if len(names) == 0:
return None
# Sort the checkpoints by epoch.
name = sorted(names)[-1]
return os.path.join(d, name)`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.