#139 · Primary category: Deep Learning Frameworks

ema-pytorch

artificial-intelligence deep-learning exponential-moving-average

A simple way to keep track of an Exponential Moving Average (EMA) version of your Pytorch model

Project last updated:07/31/26

GitHub Stars

660

Forks

42

Contributors

13

License

MIT

Why we included this project

Most PyTorch users have hand-rolled an exponential moving average of their weights at some point, usually as a small helper that never quite feels finished. This library wraps any nn.Module and keeps a shadow copy of the model with a configurable decay, a warmup step, and an update frequency, so you can hold a stable evaluation or teacher model alongside the one being trained. It also implements the post-hoc synthesized EMA from Karras et al., a Switch EMA variant, and a module wrapper that routes EMA outputs into nested submodules for self-supervised setups. That covers diffusion training and any project where a smoothed weight average improves final results, without you maintaining the update loop yourself. If you would rather use a maintained implementation than debug your own, this saves real time.

Articles for this project

No articles for this project yet.

To suggest a topic or contribute an article, contact us.

Related projects in this category