-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Resolves [BUG] 'GatheredParameters' object is not callable #9614
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
sayakpaul
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!
|
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. |
src/diffusers/training_utils.py
Outdated
| if is_transformers_available(): | ||
| import transformers | ||
|
|
||
| if transformers.deepspeed.is_deepspeed_zero3_enabled(): |
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.
transformers.deepspeed is deprecated and will be removed in a near future release. Could you look into the alternative transformers.integrations?
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, give me sometime.
| context_manager = deepspeed.zero.GatheredParameters(parameters, modifier_rank=None) | ||
|
|
||
| with context_manager(): | ||
| with context_manager: |
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.
This is correct for GatheredParameters but I think will fail in non-DeepSpeed scenarious where nullcontext is used. Could you create the context_manager object too?
context_manager = contextlib.nullcontext()
if deepspeed enabled:
context_manager = GatheredParameters(...)
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.
Got it.
a-r-r-o-w
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 for fixing. But, now line 464 will fail which also needs to be taken into account, since it makes use of the same context_manager object.
Please change with context_manager(): to with context_manager:.
These changes need to be made carefully and all easy to verify code paths should be tested, otherwise it will lead to many more bug reports down the line.
|
Got it, @a-r-r-o-w, thanks. |
* gatherparams bug * calling context lib object * fix --------- Co-authored-by: Aryan <aryan@huggingface.co>

What does this PR do?
Fixes #9477
Before submitting
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
@sayakpaul @LinB203