Skip to content

Commit e302bf7

Browse files
committed
Add todo for further state initialization improvement
Signed-off-by: Hao Wu <skyw@nvidia.com>
1 parent 91a4192 commit e302bf7

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

emerging_optimizers/soap/soap.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,11 @@ def step(self, closure: Callable[[], float] | None = None) -> float | None:
169169
# in the math equation that needs 1-based iteration count.
170170
curr_iter_1_based = state["step"] + 1
171171

172+
# TODO(Mkhona): Improve initialization handling.
173+
# - More protective checks can be added to avoid potential issues with checkpointing.
174+
# - Initializing zero buffers can also be avoided.
172175
if state["step"] == 0:
173-
assert all(x not in state for x in ["exp_avg", "exp_avg_sq", "GG"]), (
176+
assert all(key not in state for key in ["exp_avg", "exp_avg_sq", "GG"]), (
174177
"exp_avg and exp_avg_sq and GG should not be initialized at step 0. "
175178
"Some mismatch has been created likely in checkpointing"
176179
)

0 commit comments

Comments
 (0)