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 and ArthurZucker committed Dec 13, 2024
1 parent b1d5d6d commit 1b6cb1e
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 1b6cb1e

Please sign in to comment.