From 958543fcd5922bd9d9df87baafdfc333b59bf37e Mon Sep 17 00:00:00 2001 From: Pyry Takala <7336413+pyrytakala@users.noreply.github.com> Date: Fri, 21 Nov 2025 13:47:22 -0800 Subject: [PATCH] Update nanochat/checkpoint_manager.py Co-authored-by: Sofie Van Landeghem --- nanochat/checkpoint_manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nanochat/checkpoint_manager.py b/nanochat/checkpoint_manager.py index b9118e2..afba340 100644 --- a/nanochat/checkpoint_manager.py +++ b/nanochat/checkpoint_manager.py @@ -117,7 +117,7 @@ def find_last_step(checkpoint_dir): checkpoint_files = [f for f in os.listdir(checkpoint_dir) if re.search(r'model_(\d+)\.pt$', f)] if not checkpoint_files: raise FileNotFoundError(f"No checkpoints found in {checkpoint_dir}") - last_step = int(max(re.search(r'model_(\d+)\.pt$', f).group(1) for f in checkpoint_files)) + last_step = int(max(f.split("_")[-1].split(".")[0] for f in checkpoint_files)) return last_step # -----------------------------------------------------------------------------