Repository navigation
Make scale_by_muon work on a params tree without weight_dimension_numbers - #1901
Open
vineethsaivs wants to merge 1 commit into
Open
vineethsaivs wants to merge 1 commit into
vineethsaivs wants to merge 1 commit into
Conversation
…bers With the default weight_dimension_numbers=None, the update tree-mapped a bare None against the params tree and failed with a pytree structure error. None now means every leaf is orthogonalized as a matrix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
contrib.scale_by_muon()with its defaultweight_dimension_numbers=Nonecrashes on any params tree (a dict, say), so the documented default is unusable.The update tree-maps the orthogonalization over
(mu_hat, resolved_weight_dim_nums). WithNone, that second argument is a bareNone, which does not match the params tree, and jax raisesValueError: pytree structure error: different types at key path.muon()hides this because it always builds its own dim nums.When
weight_dimension_numbersisNone, the update now uses a tree of per-leafNones, so every leaf is orthogonalized as a matrix. A non-matrix leaf now gets the intended "must have shape (m, n) or dim nums" error instead of the pytree one.On
{'w': (4, 3), 'v': (3, 2)},scale_by_muon().update(...)raised on main and now returns the same updates as an explicitMuonDimensionNumbers(0, 1)tree. The newtest_scale_by_muon_defaults_to_matrices_for_a_params_treefails on main and passes here;_muon_test.py(33 passed) and_common_test.py(512 passed, 4 skipped) pass.