Skip to content

Conversation

@enriquezaf
Copy link

Current version is kinda exploding the gradients, non standard ema, looks to me is half way into using 2 different betas but never got done.

Current

  • step 1: buf * momentum
  • step 2: grad + buf * momentum
  • step 3: grad + buf * momentum * (grad + buf * momentum)
buf.mul_(momentum)       # buf * momentum
buf.add_(grad)           # grad + buf * momentum
grad.add_(buf*momentum)  # grad + buf * momentum * (grad + buf * momentum)

# if momentum = 0.9
# 1: buf * 0.9
# 2: grad + 0.9 * buf
# 3: grad + 0.9 * (grad + 0.9 * buf) -> grad + 0.9 * grad + 0.81 * buf
# -> grad = 1.9 * grad + 0.81 * buf

New

# if momentum = 0.9
# grad = buf * 0.9 + 0.1 * grad

This match the default from heavyball.

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.

1 participant