From 3263a204ea027effce0a9b1bf7163d4bc28fc478 Mon Sep 17 00:00:00 2001 From: Alex Stoken Date: Wed, 17 Jun 2020 10:34:37 -0500 Subject: [PATCH] Fix get_latest_run to search 'search_dir' recursivly --- utils/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/utils.py b/utils/utils.py index 4570cd0..5332bee 100755 --- a/utils/utils.py +++ b/utils/utils.py @@ -36,10 +36,10 @@ def init_seeds(seed=0): np.random.seed(seed) torch_utils.init_seeds(seed=seed) -def get_latest_run(search_dir = './runs/'): +def get_latest_run(search_dir = './runs'): # get path to most recent 'last.pt' in run dirs # assumes most recently saved 'last.pt' is the desired weights to --resume from - last_list = glob.glob('runs/*/weights/last.pt') + last_list = glob.glob(f'{search_dir}/**/last.pt', recursive=True) latest = max(last_list, key = os.path.getctime) return latest