-
Notifications
You must be signed in to change notification settings - Fork 3.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
Exponential Moving Average (EMA) #8100
Comments
I think having it as a callback would be nice. @miraodasilva Are you willing to contribute this? |
Sorry, I don't really have the time do it properly right now. However, I will start working with it on my own a bit, and perhaps I will contribute in the future. Thanks for responding! |
Hey @miraodasilva, It can be done using the Stochastic Weight Averaging Callback and replacing the avg_gn function there: Here is the mean average implementation: |
I see, hadn't seen that, thanks a lot! |
This issue has been automatically marked as stale because it hasn't had any recent activity. This issue will be closed in 7 days if no further activity occurs. Thank you for your contributions, Pytorch Lightning Team! |
Only for future readers, I don't think that the given solution is equivalent. |
🚀 Feature
Keep an Exponential Moving Average (EMA) of the model's weights as it is training. This is available on tensorflow but not on pytorch. https://www.tensorflow.org/api_docs/python/tf/train/ExponentialMovingAverage .
Motivation
EMA has shown to be extremely benefitial for bootstrapping better models from scratch. For instance efficientnet (v1 and v2) benefits heavily from the usage of this method. It's also widely used in Self-supervised Learning.
Pitch
Basically what needs to be done is already layed out here https://forums.pytorchlightning.ai/t/adopting-exponential-moving-average-ema-for-pl-pipeline/488 . This code requires this package https://github.com/fadel/pytorch_ema .
The text was updated successfully, but these errors were encountered: