fix bug in fallback case of find_largest_model

Fix: Handle missing d<number> model tags in find_largest_model
ty
This commit is contained in:
Andrej
2025-10-13 14:38:34 -07:00
committed by GitHub

View File

@@ -104,8 +104,8 @@ def find_largest_model(checkpoint_dir):
candidates.sort(key=lambda x: x[0], reverse=True) candidates.sort(key=lambda x: x[0], reverse=True)
return candidates[0][1] return candidates[0][1]
# 2) if that failed, take the most recently updated model: # 2) if that failed, take the most recently updated model:
candidates.sort(key=lambda x: os.path.getmtime(os.path.join(checkpoint_dir, x[1])), reverse=True) model_tags.sort(key=lambda x: os.path.getmtime(os.path.join(checkpoint_dir, x)), reverse=True)
return candidates[0][1] return model_tags[0]
def find_last_step(checkpoint_dir): def find_last_step(checkpoint_dir):