Commit 94c7f647 authored by Zhicheng Yan's avatar Zhicheng Yan Committed by Facebook GitHub Bot
Browse files

only select pth files with prefix "model" as model checkpoint file

Summary:
Pull Request resolved: https://github.com/facebookresearch/d2go/pull/605

D2GO workflow async validation monitor the model checkpoint files *.pth in **e2e_train** folder (such as **model_0004999.pth**, **model_final.pth**) and launch async val operator as needed.
All model files actually have prefix **"model"**.  In some cases, there are non-model-checkpoint files also with pth file extension.
To exclude them, add a filtering to check if the file prefix is "model".

Reviewed By: ayushidalmia

Differential Revision: D48021972

fbshipit-source-id: 54d9c14117192809ea76d812ebd4240b44166637
parent 1c9e0e83
...@@ -55,6 +55,13 @@ def fetch_checkpoints_till_final(checkpoint_dir): ...@@ -55,6 +55,13 @@ def fetch_checkpoints_till_final(checkpoint_dir):
checkpoint_paths = DetectionCheckpointer( checkpoint_paths = DetectionCheckpointer(
None, save_dir=checkpoint_dir None, save_dir=checkpoint_dir
).get_all_checkpoint_files() ).get_all_checkpoint_files()
checkpoint_paths = [
cpt_path
for cpt_path in checkpoint_paths
if os.path.basename(cpt_path).startswith("model")
]
checkpoint_paths.extend(_get_lightning_checkpoints(checkpoint_dir)) checkpoint_paths.extend(_get_lightning_checkpoints(checkpoint_dir))
final_model_path = None final_model_path = None
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment