Skip to content

Commit 67d3786

Browse files
committed
EXP: use laprop inside REKLS
Signed-off-by: Hao Wu <skyw@nvidia.com>
1 parent 19aa211 commit 67d3786

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

emerging_optimizers/soap/rekls.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,11 @@ def _init_group(self, group: dict, skip_non_grad_params: bool = True) -> None:
163163
state = self.state[p]
164164
if len(state) == 0:
165165
m, n = p.shape
166+
# Get full size of m, n if the parameter is tensor-parallel.
166167
if partition_dim == 0:
167168
m *= self.tp_size
168169
elif partition_dim == 1:
169170
n *= self.tp_size
170-
# When partition_dim is None: param is replicated, m and n are already full.
171171

172172
# Both dimensions must be divisible by tp_size for the L/R shards (each sharded
173173
# along dim 0) to gather back to the full square shape via torch.cat.
@@ -262,13 +262,12 @@ def step(self, closure: None = None) -> None:
262262
full_grad_projected = soap.precondition(full_grad, eigenbasis_list, dims=[[0], [0]])
263263

264264
# No matmul inside adam update. Put it under fp32_matmul_precision for code simplicity.
265-
full_adam_update = update_functions.calculate_adam_update(
265+
full_adam_update = update_functions.calculate_laprop_update(
266266
full_grad_projected,
267267
state["exp_avg"],
268268
state["exp_avg_sq"],
269-
group["betas"],
270269
True, # correct_bias
271-
False, # nesterov
270+
group["betas"],
272271
curr_iter_1_based,
273272
group["eps"],
274273
)

0 commit comments

Comments
 (0)