Skip to content

Commit

Permalink
don't use no_sync when deepspeed doesn't support it for certain zero …
Browse files Browse the repository at this point in the history
…stages (#35157)

* don't use no_sync when deepspeed doesn't support it for certain zero stages

* chore: lint

* fix no_sync context for deepspeed across all zero types

* chore: lint
  • Loading branch information
winglian authored Dec 13, 2024
1 parent 7237b3e commit add53e2
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/transformers/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2517,6 +2517,7 @@ def _inner_training_loop(
context = (
functools.partial(self.accelerator.no_sync, model=model)
if i != len(batch_samples) - 1
and self.accelerator.distributed_type != DistributedType.DEEPSPEED
else contextlib.nullcontext
)
with context():
Expand Down

0 comments on commit add53e2

Please sign in to comment.