From b34091362e88e78c4a4575289c9e6b7e97ce2924 Mon Sep 17 00:00:00 2001 From: Boyang Deng <8297447+Awcrr@users.noreply.github.com> Date: Thu, 9 Jan 2025 23:48:32 -0800 Subject: [PATCH] Fix the checkpoint dir bug in `get_intermediate_ckpt_path` so that `checkpointing_limit` can actually work. (#207) --- finetrainers/utils/checkpointing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/finetrainers/utils/checkpointing.py b/finetrainers/utils/checkpointing.py index be0124b..01dbea0 100644 --- a/finetrainers/utils/checkpointing.py +++ b/finetrainers/utils/checkpointing.py @@ -55,7 +55,7 @@ def get_intermediate_ckpt_path(checkpointing_limit: int, step: int, output_dir: # before we save the new checkpoint, we need to have at_most `checkpoints_total_limit - 1` checkpoints if len(checkpoints) >= checkpointing_limit: num_to_remove = len(checkpoints) - checkpointing_limit + 1 - checkpoints_to_remove = checkpoints[0:num_to_remove] + checkpoints_to_remove = [os.path.join(output_dir, x) for x in checkpoints[0:num_to_remove]] delete_files(checkpoints_to_remove) logger.info(f"Checkpointing at step {step}")