astoken commited on
Commit
3263a20
·
1 Parent(s): d342917

Fix get_latest_run to search 'search_dir' recursivly

Browse files
Files changed (1) hide show
  1. utils/utils.py +2 -2
utils/utils.py CHANGED
@@ -36,10 +36,10 @@ def init_seeds(seed=0):
36
  np.random.seed(seed)
37
  torch_utils.init_seeds(seed=seed)
38
 
39
- def get_latest_run(search_dir = './runs/'):
40
  # get path to most recent 'last.pt' in run dirs
41
  # assumes most recently saved 'last.pt' is the desired weights to --resume from
42
- last_list = glob.glob('runs/*/weights/last.pt')
43
  latest = max(last_list, key = os.path.getctime)
44
  return latest
45
 
 
36
  np.random.seed(seed)
37
  torch_utils.init_seeds(seed=seed)
38
 
39
+ def get_latest_run(search_dir = './runs'):
40
  # get path to most recent 'last.pt' in run dirs
41
  # assumes most recently saved 'last.pt' is the desired weights to --resume from
42
+ last_list = glob.glob(f'{search_dir}/**/last.pt', recursive=True)
43
  latest = max(last_list, key = os.path.getctime)
44
  return latest
45