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
commit dd6ff9a1cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -104,8 +104,8 @@ def find_largest_model(checkpoint_dir):
candidates.sort(key=lambda x: x[0], reverse=True)
return candidates[0][1]
# 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)
return candidates[0][1]
model_tags.sort(key=lambda x: os.path.getmtime(os.path.join(checkpoint_dir, x)), reverse=True)
return model_tags[0]
def find_last_step(checkpoint_dir):