-
Notifications
You must be signed in to change notification settings - Fork 27.4k
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
Make clearer about zero_init requirements #29879
Conversation
Thank you for adding this. It will hopefully save a lot of people a lot of time :) |
@pacman100 the other option I'm considering: Could we realistically check for this from (Whether we raise an explicit error, or doing it behind the scenes I'm iffy on, I'd rather raise an err) |
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.
Thanks for adding! Having these error messages will definitely be useful!
Just a comment on the conditional tuple return in is_deepspeed_zero3_enabled
Thanks @amyeroberts, I've tweaked it so now it lives under its own new func, and we call both in order since it's only needed in two places |
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 @muellerzr for the fixes but I have left some overall comments.
@amyeroberts @pacman100 should be good for a last review. Post discussions offline it's best to just do an RTFM, since we can't reliably check beforehand and currently rely on having numerous examples instead |
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!
Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com>
* Docstring to note about zero init * Check for accelerate * Change conditional return * Tweak * Add new accelerate-specific zero3 check * Fix import * Revert to RTFM * Update src/transformers/modeling_utils.py Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com> --------- Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com>
* Docstring to note about zero init * Check for accelerate * Change conditional return * Tweak * Add new accelerate-specific zero3 check * Fix import * Revert to RTFM * Update src/transformers/modeling_utils.py Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com> --------- Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com>
What does this PR do?
@abhishekkrthakur pointed out that he was facing some confusing issues on when trying to use zero-init + model initialization, and he was initializing the model before
TrainingArguments
were made, so zero-init couldn't be setup.There's no real way to catch this, so instead it flags beforehand that we need to instantiate the
TrainingArguments
beforehand in the docstring. The exception of this is if a user used a configuredaccelerate launch
, which this PR also checks for/has logic forBefore 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.
@pacman100 @amyeroberts