Add new LFS prune API (#14294)

This commit is contained in:
Sylvain Gugger
2021-11-05 18:58:51 -04:00
committed by GitHub
parent 4be78c22c9
commit 08a5f57567
11 changed files with 51 additions and 23 deletions

View File

@@ -667,7 +667,11 @@ def main():
unwrapped_model.save_pretrained(args.output_dir, save_function=accelerator.save)
if (args.push_to_hub and epoch < args.num_train_epochs - 1) and accelerator.is_main_process:
repo.push_to_hub(commit_message=f"Training in progress step {completed_steps}", blocking=False)
repo.push_to_hub(
commit_message=f"Training in progress step {completed_steps}",
blocking=False,
auto_lfs_prune=True,
)
# if completed steps > `args.max_train_steps` stop
if completed_steps >= args.max_train_steps:
@@ -714,7 +718,7 @@ def main():
unwrapped_model.save_pretrained(args.output_dir, save_function=accelerator.save)
if accelerator.is_main_process:
if args.push_to_hub:
repo.push_to_hub(commit_message="End of training")
repo.push_to_hub(commit_message="End of training", auto_lfs_prune=True)
if __name__ == "__main__":