-
Notifications
You must be signed in to change notification settings - Fork 31.9k
set supports_gradient_checkpointing = False in SwitchTransformer #35249
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
Conversation
|
Hi @nhamanasu Thank you for the PR. Although pytest-dev/pytest-subtests#169 is merged, we will still need to review the impact of installing and using In the meantime, #34806 should not be the cause of failing Change it to Could you check if |
|
Hi @ydshieh Thank you for your response! I got the situation (sorry for my misunderstanding). Related to SwitchTransformer, it currently has And also, SwitchTransformer has experts in MLP modules:
I think the last part should be the cause of non-gradient weights. So as you suggested, I think we need to set supports_gradient_checkpointing = False for this model. |
|
| config_class = SwitchTransformersConfig | ||
| base_model_prefix = "switch_transformers" | ||
| supports_gradient_checkpointing = True | ||
| supports_gradient_checkpointing = False |
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.
you can simply remove this line as False it the default value defined in
class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMixin, PeftAdapterMixin):
tests/test_modeling_common.py
Outdated
| ): | ||
| # TODO (ydshieh): use `skipTest` once pytest-dev/pytest-subtests/pull/169 is merged | ||
| # self.skipTest(reason=f"`supports_gradient_checkpointing` is False for {model_class.__name__}.") | ||
| self.skipTest(reason=f"`supports_gradient_checkpointing` is False for {model_class.__name__}.") |
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.
Let's revert the change here :-)
|
Thanks. Just 2 nits and we are ready to go |
…nedModel since the default value is False
|
Thank you! I've reflected your comments. |
ydshieh
left a comment
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.
Thank you for the iteration!
|
Thanks! I think recently @ydshieh had a new look and this hsould be fixed (it does support GC just that some expert are sometimes not used) |
ArthurZucker
left a comment
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 anyway for the PR and sorry for the delay!
|
For the record: #35587 Sorry for not including you as a contributor in that PR (my limited short memory ... 😢 ), and thank you ! I am closing this PR. |
What does this PR do?
Recently, CircleCI's
tests_torchsometimes fails (Reference: tests_torch - Failed), because some models which don't support gradient_checkpointing or have MoE module like SwitchTransformer will occasionally have weights without gradients.I found maybe-related PR: #34806, and the situation described in the PR was already fixed (pytest-dev/pytest-subtests#169 was already merged).
In #34806, @ydshieh said:
TODO (ydshieh): use skipTest once pytest-dev/pytest-subtests/pull/169 is merged, so I reverted the stopgap fix.Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
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.
cc @ydshieh @muellerzr @SunMarc