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 (huggingface#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 inkcherry committed Dec 19, 2024
1 parent 30af1c0 commit 9cd90d5
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 @@ -2518,6 +2518,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 9cd90d5

Please sign in to comment.