Skip to content

Commit b340913

Browse files
authored
Fix the checkpoint dir bug in get_intermediate_ckpt_path so that checkpointing_limit can actually work. (#207)
1 parent 4b21d37 commit b340913

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

finetrainers/utils/checkpointing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def get_intermediate_ckpt_path(checkpointing_limit: int, step: int, output_dir:
5555
# before we save the new checkpoint, we need to have at_most `checkpoints_total_limit - 1` checkpoints
5656
if len(checkpoints) >= checkpointing_limit:
5757
num_to_remove = len(checkpoints) - checkpointing_limit + 1
58-
checkpoints_to_remove = checkpoints[0:num_to_remove]
58+
checkpoints_to_remove = [os.path.join(output_dir, x) for x in checkpoints[0:num_to_remove]]
5959
delete_files(checkpoints_to_remove)
6060

6161
logger.info(f"Checkpointing at step {step}")

0 commit comments

Comments
 (0)