Skip to content

Commit

Permalink
Profile Trainer.save_checkpoint (#20405)
Browse files Browse the repository at this point in the history
  • Loading branch information
EricCousineau-TRI authored Nov 13, 2024
1 parent f5b513d commit e1b172c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/lightning/pytorch/trainer/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1361,9 +1361,10 @@ def save_checkpoint(
"Saving a checkpoint is only possible if a model is attached to the Trainer. Did you call"
" `Trainer.save_checkpoint()` before calling `Trainer.{fit,validate,test,predict}`?"
)
checkpoint = self._checkpoint_connector.dump_checkpoint(weights_only)
self.strategy.save_checkpoint(checkpoint, filepath, storage_options=storage_options)
self.strategy.barrier("Trainer.save_checkpoint")
with self.profiler.profile("save_checkpoint"):
checkpoint = self._checkpoint_connector.dump_checkpoint(weights_only)
self.strategy.save_checkpoint(checkpoint, filepath, storage_options=storage_options)
self.strategy.barrier("Trainer.save_checkpoint")

"""
State properties
Expand Down

0 comments on commit e1b172c

Please sign in to comment.