domainadaptation icon indicating copy to clipboard operation
domainadaptation copied to clipboard

Wrong implementation about EMA ?

Open YilinLiu97 opened this issue 6 years ago • 8 comments

Hi @perone, I found that the teacher model's weights seem to be not updated as it performed as bad as it was first initialized.

def update_ema_variables(model, ema_model, alpha, global_step):

  alpha = min(1 - 1 / (global_step + 1), alpha)
  for ema_param, param in zip(ema_model.parameters(), model.parameters()):
  ema_param.data.mul_(alpha).add_(1 - alpha, param.data)

About this

line:ema_param.data.mul_(alpha).add_(1 - alpha, param.data),

shouldn't this be ema_param.data.mul_(alpha).add_((1 - alpha)*param.data) ?? Thanks!

YilinLiu97 avatar Feb 13 '19 23:02 YilinLiu97