From 9a65fc2cf4f2a8f6afbd0f3d55d259c1ac590afb Mon Sep 17 00:00:00 2001 From: Steve Heim Date: Mon, 27 Jun 2022 15:30:48 -0400 Subject: [PATCH] when resuming training, sort by last-modified, so you do not get the wrong folder when the month changes --- legged_gym/utils/helpers.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/legged_gym/utils/helpers.py b/legged_gym/utils/helpers.py index b05efaa53..ae7501500 100644 --- a/legged_gym/utils/helpers.py +++ b/legged_gym/utils/helpers.py @@ -102,9 +102,8 @@ def parse_sim_params(args, cfg): def get_load_path(root, load_run=-1, checkpoint=-1): try: - runs = os.listdir(root) - #TODO sort by date to handle change of month - runs.sort() + runs = sorted(os.listdir(root), + key=lambda x: os.path.getctime(os.path.join(root, x))) if 'exported' in runs: runs.remove('exported') last_run = os.path.join(root, runs[-1]) except: