mirror of
https://github.com/saymrwulf/transformers.git
synced 2026-05-14 20:58:08 +00:00
don't use no_sync when deepspeed doesn't support it for certain zero 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
This commit is contained in:
parent
7237b3ecfc
commit
add53e25ff
1 changed files with 1 additions and 0 deletions
|
|
@ -2517,6 +2517,7 @@ class Trainer:
|
|||
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():
|
||||
|
|
|
|||
Loading…
Reference in a new issue