-
Notifications
You must be signed in to change notification settings - Fork 6.1k
EMA: fix state_dict()
and load_state_dict()
& add cur_decay_value
#2146
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
The documentation is not available anymore as the PR was closed or merged. |
'float' object (`state_dict["power"]`) has no attribute 'get'.
|
state_dict()
& add cur_decay_value
state_dict()
and load_state_dict()
& add cur_decay_value
This looks good to me! @chenguolin could you maybe also check if the EMAModel class is correctly used in: https://github.com/huggingface/diffusers/blob/main/examples/unconditional_image_generation/train_unconditional.py and potentially fix it? :-) |
It looks good. I have changed
|
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 LGTM, @pcuenca @patil-suraj could you take a look?
Actually we should probably also apply the same changes to: https://github.com/huggingface/diffusers/blob/main/examples/text_to_image/train_text_to_image.py In case you have 5min it'd be great if you could take a look at applying the same changes to cc @patil-suraj wdyt of this PR |
Hi @patrickvonplaten, the only necessary change to example "train_unconditional.py" is While other examples don't use |
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 a lot for fixing this!
@chenguolin there's a merge conflict in |
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!
Hi @patil-suraj, I have just deleted |
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.
Failing test is un-related :)
…e` (huggingface#2146) * EMA: fix `state_dict()` & add `cur_decay_value` * EMA: fix a bug in `load_state_dict()` 'float' object (`state_dict["power"]`) has no attribute 'get'. * del train_unconditional_ort.py
…e` (huggingface#2146) * EMA: fix `state_dict()` & add `cur_decay_value` * EMA: fix a bug in `load_state_dict()` 'float' object (`state_dict["power"]`) has no attribute 'get'. * del train_unconditional_ort.py
…e` (huggingface#2146) * EMA: fix `state_dict()` & add `cur_decay_value` * EMA: fix a bug in `load_state_dict()` 'float' object (`state_dict["power"]`) has no attribute 'get'. * del train_unconditional_ort.py
fix the saved value for
min_decay
in EMAself.state_dict()
.add an interface
self.cur_decay_value
to track the current value for decay.(as
self.decay
is a constant value meaning "max decay value")track the current EMA decay value by
self.cur_decay_value
in "unconditional image generation" examples, instead ofself.decay
.