Skip to content

Commit

Permalink
Merge pull request huggingface#165 from angegonzalez/feature/save-tra…
Browse files Browse the repository at this point in the history
…in-ending-checkpoint

Adding checkpoint after traning ends
  • Loading branch information
xrsrke authored Aug 2, 2024
2 parents 6ad5994 + b1872e1 commit 2793c92
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/nanotron/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ class CheckpointsArgs:
checkpoints_path: Path
checkpoint_interval: int
save_initial_state: Optional[bool] = False
save_final_state: Optional[bool] = False
resume_checkpoint_path: Optional[Path] = None
checkpoints_path_is_shared_file_system: Optional[bool] = False

Expand Down
5 changes: 4 additions & 1 deletion src/nanotron/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,10 @@ def train(
self.save_checkpoint()

dist.barrier() # let's wait for everyone before leaving


if self.config.checkpoints.save_final_state:
self.save_checkpoint()

self.post_training()

def training_step(
Expand Down

0 comments on commit 2793c92

Please sign in to comment.