-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Fix the fsdp config cannot work issue. #37549
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
Signed-off-by: yuanwu <[email protected]>
|
Hi 👋, thank you for opening this pull request! The pull request is converted to draft by default. The CI will be paused while the PR is in draft mode. When it is ready for review, please click the |
|
cc @SunMarc |
MekkCyber
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.
Sounds good ! Thanks
|
@ArthurZucker Please help to review. |
SunMarc
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, just a nit. Can you also add a small test ?
src/transformers/training_args.py
Outdated
| v = self.fsdp_config.pop(k) | ||
| self.fsdp_config[k[5:]] = v | ||
|
|
||
| if self.fsdp_config is not None: |
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.
check if fsdp_config is a dict also
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.
Done.
Signed-off-by: yuanwu <[email protected]>
Signed-off-by: yuanwu <[email protected]>
| for k, v in trainer.args.fsdp_config.items(): | ||
| self.assertEqual(v, self.accelerate_fsdp_config[k]) |
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.
The goal was to check that trainer.args.fsdp_config keys were correctly modified no ?
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.
cc @yuanwu2017
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.
Yes.
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.
I mean here you are checking the values not the keys
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.
Use the keys of trainer.args.fsdp_config to retrieve the values of acclerate_fsdp_config, in fact, the key must have been verified. I added a key check before the value. Please review.
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 the test. Just a minor nit, please do |
|
Done. |
Signed-off-by: yuanwu <[email protected]>
Signed-off-by: yuanwu <[email protected]>
|
@Rocketknight1 @ArthurZucker Please help to review and merge. |
|
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. |
* Fix the fsdp config cannot work issue. Signed-off-by: yuanwu <[email protected]> * Check the fsdp_config type Signed-off-by: yuanwu <[email protected]> * Add the accelerate_fsdp_config test Signed-off-by: yuanwu <[email protected]> * fix error of make style Signed-off-by: yuanwu <[email protected]> * Add key check Signed-off-by: yuanwu <[email protected]> --------- Signed-off-by: yuanwu <[email protected]> Co-authored-by: Mohamed Mekkouri <[email protected]> Co-authored-by: Marc Sun <[email protected]>
* Fix the fsdp config cannot work issue. Signed-off-by: yuanwu <[email protected]> * Check the fsdp_config type Signed-off-by: yuanwu <[email protected]> * Add the accelerate_fsdp_config test Signed-off-by: yuanwu <[email protected]> * fix error of make style Signed-off-by: yuanwu <[email protected]> * Add key check Signed-off-by: yuanwu <[email protected]> --------- Signed-off-by: yuanwu <[email protected]> Co-authored-by: Mohamed Mekkouri <[email protected]> Co-authored-by: Marc Sun <[email protected]>


What does this PR do?
The fsdp config generated by accelerate config is all fsdp prefixed. If passed in as parameters, these parameters will not work. But passing in in the fsdp_config.json method, these parameters can work. This patch makes them behave consistently and can work.
Fixes # (issue)
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.