mirror of
https://github.com/karpathy/nanochat.git
synced 2025-12-06 04:12:13 +00:00
fix last_step cal bug
Signed-off-by: kuizhiqing <kuizhiqing@msn.com>
This commit is contained in:
parent
4a87a0d19f
commit
dfecef47bb
|
|
@ -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
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user