Browse Source

Fix get_latest_run to search 'search_dir' recursivly

5.0
Alex Stoken 4 years ago
parent
commit
3263a204ea
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      utils/utils.py

+ 2
- 2
utils/utils.py View File

@@ -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


Loading…
Cancel
Save