Skip to content

Add EMA callback#74

Merged
jemrobinson merged 6 commits intomainfrom
add-ema-callback
Aug 22, 2025
Merged

Add EMA callback#74
jemrobinson merged 6 commits intomainfrom
add-ema-callback

Conversation

@jemrobinson
Copy link
Copy Markdown
Member

@jemrobinson jemrobinson commented Aug 21, 2025

@marianovitasari20 @erinuclkwon here's a small wrapper class to implement EMA using the callback that will be included in the next version of pytorch-lightning. You can set decay_rate plus every_n_epochs and every_n_steps which control how often the EMA averaging will be applied.

I've added this as one of our default callbacks for training, so it will be applied to every model by default. It should remove the need for you to call an EMA instance inside your training loop. Does that do everything you need?

Closes #75

@jemrobinson jemrobinson requested a review from a team August 21, 2025 14:50
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Aug 21, 2025

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  ice_station_zebra/callbacks
  __init__.py
  ema_weight_averaging_callback.py 24-28, 34-40
  weight_averaging.py 96-112, 133, 149-161, 191-197, 212-217, 232-233, 248-249, 264-265, 277, 289, 310-326, 349-376, 387-398, 407-416
Project Total  

This report was generated by python-coverage-comment-action

Copy link
Copy Markdown
Contributor

@erinuclkwon erinuclkwon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it does. LGTM. Thanks!

@jemrobinson jemrobinson merged commit cbf2a77 into main Aug 22, 2025
3 checks passed
@jemrobinson jemrobinson deleted the add-ema-callback branch August 22, 2025 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Exponential Moving Average updating

2 participants