Skip to content

Implementation of EMA in tensorflow2. It's very easy to use.

Notifications You must be signed in to change notification settings

Fei-Ho/EMA-Exponential-Moving-Average-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

EMA(Exponential Moving Average)

When training a model, it is often beneficial to maintain moving averages of the trained parameters. Evaluations that use averaged parameters sometimes produce significantly better results than the final trained values.

Create an EMA instance

ema = EMA(model,0.999)

Create shadow parameters of trainable parameters of model

ema.register()

Update the value of shadow parameters after the change of trainable parameters (This is usually used in the training loop of the model).

ema.update()

Set the parameters of the model as shadow parameters

ema.apply_shadow()

Set the parameters of the model to actual values

ema.restore()

About

Implementation of EMA in tensorflow2. It's very easy to use.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published