refactor: streamline LoRA parameter restoration for JAX/NNX models#4067
Open
RexBearIU wants to merge 1 commit into
Open
refactor: streamline LoRA parameter restoration for JAX/NNX models#4067RexBearIU wants to merge 1 commit into
RexBearIU wants to merge 1 commit into
Conversation
3360657 to
0639ae2
Compare
4 tasks
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
0639ae2 to
9feec02
Compare
4 tasks
9feec02 to
042158a
Compare
4d51a1c to
019d93d
Compare
a0f3ab9 to
2b0c32a
Compare
4 tasks
2b0c32a to
936b8b7
Compare
igorts-git
approved these changes
Jun 26, 2026
7b8865f to
2316d38
Compare
2316d38 to
303587b
Compare
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.
Description
Refactors the LoRA parameter restoration utility (
restore_lora_from_path) to natively accept and merge parameters of JAX/NNX model wrapper classes.Standardizing on the NNX state tree representation removes complex state-container unpackings, enhancing trainer safety and maintainability.
Key Changes:
src/maxtext/utils/lora_utils.py): Overhauledrestore_lora_from_pathto directly query and merge parameters of NNX wrapperclasses.
src/maxtext/trainers/post_train/sft/train_sft.py): Simplified parameter setup sequence to cleanly map restored LoRA statesdirectly onto the model.
Tests
Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.