From dfecef47bb07244bb707ab95281854d63fb33275 Mon Sep 17 00:00:00 2001 From: kuizhiqing Date: Sun, 23 Nov 2025 00:04:55 +0800 Subject: [PATCH] fix last_step cal bug Signed-off-by: kuizhiqing --- 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 63f257f..bec3845 100644 --- a/nanochat/checkpoint_manager.py +++ b/nanochat/checkpoint_manager.py @@ -118,7 +118,7 @@ def find_last_step(checkpoint_dir): checkpoint_files = glob.glob(os.path.join(checkpoint_dir, "model_*.pt")) if not checkpoint_files: raise FileNotFoundError(f"No checkpoints found in {checkpoint_dir}") - last_step = int(max(os.path.basename(f).split("_")[-1].split(".")[0] for f in checkpoint_files)) + last_step = max(int(os.path.basename(f).split("_")[-1].split(".")[0]) for f in checkpoint_files) return last_step # -----------------------------------------------------------------------------