[NNX] Checkpoint restore: name the parameter path on ShapeDtypeStruct mismatch#4341
Open
ecnal-cienet wants to merge 1 commit into
Open
[NNX] Checkpoint restore: name the parameter path on ShapeDtypeStruct mismatch#4341ecnal-cienet wants to merge 1 commit into
ecnal-cienet wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
2db41cb to
ee725b5
Compare
… mismatch When Orbax skips a parameter on a structural/shape mismatch it leaves an unmaterialized ShapeDtypeStruct in the restored state, which otherwise surfaces as a cryptic compile error deep in the first train_step. Report the offending parameter path and shape from _assert_no_shaped_dtype_struct so the mismatch points straight at the config (emb_dim/mlp_dim/layers/scan_layers).
ee725b5 to
d416dc1
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
When Orbax skips a parameter during an NNX checkpoint restore (a structural/shape mismatch under
partial_restore), it leaves an unmaterializedjax.ShapeDtypeStructin the restored state. Today the guard that catches this reports only the raw struct, so the failure surfaces as a cryptic, low-level compile/allocation error deep in the firsttrain_step.This makes
_assert_no_shaped_dtype_structcarry the tree path and report the offending parameter and its shape/dtype, pointing straight at the config that doesn't match the checkpoint (e.g.emb_dim,mlp_dim, num layers,scan_layers).Tests
tests/unit/checkpointing_nnx_load_test.py::TestShapeDtypeStructPath— a survivingShapeDtypeStructraises naming its path and shape; concrete arrays pass.Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.