From afaa5b4c905ffc8b42b861142ab51b51adb6edd0 Mon Sep 17 00:00:00 2001 From: Mirza-Samad-Ahmed-Baig Date: Tue, 14 Oct 2025 00:18:20 +0300 Subject: [PATCH] Fix: Handle missing d model tags in find_largest_model --- nanochat/checkpoint_manager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nanochat/checkpoint_manager.py b/nanochat/checkpoint_manager.py index 961ebd5..f400d47 100644 --- a/nanochat/checkpoint_manager.py +++ b/nanochat/checkpoint_manager.py @@ -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):