v0.3.0 pre-release cleanup#208
Conversation
Signed-off-by: Hao Wu <skyw@nvidia.com>
Signed-off-by: Hao Wu <skyw@nvidia.com>
Signed-off-by: Hao Wu <skyw@nvidia.com>
|
@greptile ignore breaking API change in review |
|
Got it — I'll stop flagging breaking API changes in future reviews. |
|
The rule was already saved as a persistent one. If you'd like it removed so it only applied to this PR, you can delete it from the custom instructions page. Going forward, I'll flag breaking API changes in other PRs as usual. |
Greptile SummaryThis PR standardizes the optimizer API across the repo: every
Confidence Score: 4/5Safe to merge with the overload fix addressed — the runtime behavior is correct, but the TYPE_CHECKING stubs still advertise a closure→float path that will always crash. Every optimizer's runtime guard is now correct and consistent — a non-None closure raises immediately. The remaining gap is in the static type stubs: the second @overload in each class still promises step(closure: Callable[[], float]) -> float, so a type checker will silently accept code that crashes on the first call. The TYPE_CHECKING overload blocks in all seven optimizer files (laprop.py, lion.py, soap.py, psgd.py, orthogonalized_optimizer.py, adaptive_muon.py, normalized_optimizer.py) need the second overload removed to match the enforced runtime contract. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["optimizer.step(closure)"] --> B{closure is not None?}
B -- Yes --> C["raise ValueError('closure is not supported')"]
B -- No --> D["for group in param_groups"]
D --> E["_init_group(group)"]
E --> F["for p in group['params']"]
F --> G{p.grad is None?}
G -- Yes --> H["skip (pragma: no cover)"]
G -- No --> I["apply weight decay"]
I --> J["calculate_*_update(grad, buffers, *, betas=, eps=, ...)"]
J --> K["p.data.add_(update, alpha=-lr)"]
K --> L["return None"]
|
|
@greptile type checking part for step() is necessary and intentional. |
|
Understood — keeping the That said, the
|
Signed-off-by: Hao Wu <skyw@nvidia.com>
|
/ok to test a475f63 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Clean up a lot of inconsistency.