Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of MoMo algorithm #721

Merged
merged 27 commits into from
Apr 23, 2024
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
variable naming
  • Loading branch information
fabian-sp committed Jan 22, 2024
commit 8a81f5c7ae4b1eeeab68e150d3e3d35f95cd388a
8 changes: 4 additions & 4 deletions optax/contrib/momo_adam.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@ def update_fn(
updates,
)
bc2 = 1-beta2**(count+1)
Dk = tu.tree_map(
precond = tu.tree_map(
lambda eas: eps + jnp.sqrt(eas/bc2),
exp_avg_sq
)
)
exp_avg_weighted = tu.tree_map(
lambda ea, prec: ea/prec,
exp_avg,
Dk
precond
)
exp_avg_norm = tree_utils.tree_vdot(exp_avg,exp_avg_weighted)
gamma = beta1*state.gamma + (1-beta1)*tree_utils.tree_vdot(updates, params)
Expand All @@ -133,7 +133,7 @@ def update_fn(
-(alpha*weight_decay)/(1+alpha*weight_decay)*p
- tau*ea/prec,
exp_avg,
Dk,
precond,
params
)
new_state = MomoAdamState(
Expand Down
Loading