Repository navigation
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/194986
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 957e463 with merge base 2b3ecd9 ( GREEN LIGHT - PR requires human review:
reason: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
| if not active: | ||
| return | ||
|
|
||
| with torch.no_grad(): |
There was a problem hiding this comment.
nit: you can use the decorator to save an indentation
|
|
||
| parameter = torch.nn.Parameter(torch.tensor(2.0)) | ||
| optimizer = torch.optim.SGD([parameter], lr=0.01) | ||
| events = [] |
There was a problem hiding this comment.
Anything else more meaningful we can use here? Maybe just using profiler API to add a custom range around the optimizer?
| from torch.optim._adafactor import Adafactor as Adafactor | ||
| from torch.optim._muon import Muon as Muon | ||
| from torch.optim._adafactor import Adafactor as Adafactor, adafactor as adafactor | ||
| from torch.optim._muon import Muon as Muon, muon as muon |
There was a problem hiding this comment.
I'm not a fan of this and it makes things inconsistent with the rest...
I would slightly prefer adding a new torch.optim.muon module that re-exposes the content of the _muon part.
But no very strong opinion, so if you prefer this, that sounds ok as well
|
|
||
|
|
||
| __all__ = ["SparseAdam"] | ||
| __all__ = ["SparseAdam", "sparse_adam"] |
There was a problem hiding this comment.
I would expect this to fix public API binding error that would require removing from the allowlist 🤔
torch.optim.functional
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Merge failedReason: 1 jobs have failed, first few of them are: docs-build / linux-docs / build-docs-python-false Details for Dev Infra teamRaised by workflow job |
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Three documentation errors, each verified against the implementation:
Muon: the math block documented the momentum recurrence as
B_t = mu*B_{t-1} + g_t and the nesterov mix as g_t + mu*B_t, but the
implementation uses buf.lerp_(grad, 1 - momentum) and
grad.lerp(buf, momentum), i.e. both carry a (1-mu) coefficient on the
fresh gradient that the formulas omitted. Also drop a stray character
after a \rule command that typeset a literal 's' in the rendered
formula.
Adafactor: weight_decay was documented as defaulting to 1e-2 while the
signature and every code path use 0.
LBFGS: removed the stale claim that parameters must be real; complex
parameters have been supported since view_as_real flattening was added
and are covered by test_complex_2d in test/test_optim.py.
A fourth item, the stale torch.optim.RMSProp cross-reference in the
functional rmsprop docstring, was fixed upstream by the functional API
publicization in pytorch#194986, which removed that docstring; the rebased
branch no longer touches torch/optim/rmsprop.py.
Test Plan:
python -m py_compile on the three edited files: clean
python -m ruff check on the three edited files: no new findings
Numerical check of the corrected recurrence against lerp semantics for
mu in {0, 0.5, 0.95, 1.0}: matches within float32 rounding
LBFGS with complex parameters converged to the optimum on installed
torch binaries; docs build untouched since no Example blocks changed
…ch#194986) This PR, in short, does: - expose and publicize functional APIs (they already existed) - document this more uniformly - add big examples in optim.md for using them (and also step hooks), notably a bf16 adamw example. Pull Request resolved: pytorch#194986 Approved by: https://github.com/albanD
…ch#194986) This PR, in short, does: - expose and publicize functional APIs (they already existed) - document this more uniformly - add big examples in optim.md for using them (and also step hooks), notably a bf16 adamw example. Pull Request resolved: pytorch#194986 Approved by: https://github.com/albanD
This PR, in short, does:
Stack from ghstack (oldest at bottom):
torch.optim.functional#194986