final tweak to EMA class

This commit is contained in:
Phil Wang
2022-05-16 11:54:34 -07:00
parent f4016f6302
commit 89ff04cfe2
2 changed files with 6 additions and 2 deletions

View File

@@ -195,7 +195,11 @@ class EMA(nn.Module):
def update(self):
self.step += 1
if self.step <= self.update_after_step or (self.step % self.update_every) != 0:
if (self.step % self.update_every) != 0:
return
if self.step <= self.update_after_step:
self.copy_params_from_model_to_ema()
return
if not self.initted: