-
Notifications
You must be signed in to change notification settings - Fork 27.7k
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
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 #35157
Conversation
7ef3da1
to
63acec4
Compare
might have to broaden deepspeed for all zero cases? https://github.com/microsoft/DeepSpeed/blob/master/deepspeed/runtime/engine.py#L2208-L2209 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we should disable it for all DS (apparently), let's just go ahead and do that. I'll apply a similar fix in Accelerator.
cc @SunMarc
src/transformers/trainer.py
Outdated
context = ( | ||
functools.partial(self.accelerator.no_sync, model=model) | ||
if i != len(batch_samples) - 1 | ||
if i != len(batch_samples) - 1 and not disable_deepspeed_no_sync |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if i != len(batch_samples) - 1 and not disable_deepspeed_no_sync | |
if i != len(batch_samples) - 1 and not self.accelerator.distributed_type == DistributedType.DEEPSPEED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may i ask which version of transformers support this fix-up? mine is 4.46.0. same problem with deepspeed 0.16
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with zach suggestion !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! We've also confirmed this fixes up all the fails users reported wrt deepspeed. cc @ArthurZucker for final post wing doing quality ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry for breaking this ... and thanks for the fix!
can you just run |
…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
…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
Strangely, this issue still exists on |
This is on 4.48 ! |
What does this PR do?
Deepspeed 0.16 has assertions preventing the use of no_sync with zero 2/3. see https://github.com/microsoft/DeepSpeed/blob/master/deepspeed/runtime/engine.py#L1986-L2004
it seems people are reporting this here microsoft/DeepSpeed#6793, and I'm assuming that everyone is using accelerate/transformers as downgrading to deepspeed 0.15.4 makes it "work" for them.
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
@muellerzr
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.