Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move barrier to before saving checkpoint to reduce timeouts when saving #38

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions prismatic/training/strategies/base_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ def run_training(

# Check for Termination & Save Final Checkpoint (in case `max_steps` is not None)
if self.max_steps is not None and metrics.global_step >= self.max_steps:
self.save_checkpoint(metrics.run_dir, metrics.global_step, epoch, loss.item())
dist.barrier()
self.save_checkpoint(metrics.run_dir, metrics.global_step, epoch, loss.item())

return

Expand All @@ -235,5 +235,5 @@ def run_training(

# Save checkpoint at end each epoch (if `self.max_steps` is None)
if self.max_steps is None:
self.save_checkpoint(metrics.run_dir, metrics.global_step, epoch, loss.item())
dist.barrier()
self.save_checkpoint(metrics.run_dir, metrics.global_step, epoch, loss.item())
1 change: 1 addition & 0 deletions prismatic/training/strategies/fsdp.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ def save_checkpoint(
if key.startswith(mprefix := f"{mkey}."):
model_state_dicts[mkey][key.removeprefix(mprefix)] = param

torch.barrier()
# Save on rank zero *only*
if overwatch.is_rank_zero():
checkpoint_dir = run_dir / "checkpoints"
Expand Down