Add rename transform support to load_nested_safetensors in Orbax + Qwix integration#239
Merged
copybara-service[bot] merged 1 commit intomainfrom Mar 31, 2026
Merged
Conversation
220908b to
52e166e
Compare
…ix integration This CL adds support for selectively renaming parameters when loading checkpoints via `load_nested_safetensors`. By passing an optional `rename_rules` parameter (a sequence of regex string pairs), parameters with custom suffixes (e.g., `scale_inv`, `param`) can be transformed into their expected Qwix components (`scale`, `qvalue`) prior to unflattening. Changes: - Modified `load_nested_safetensors` to optionally apply the `orbax.checkpoint.experimental.model_surgery.transformations.renaming.rename_by_regex` transformation. - Integrated the `renaming` module and its dependencies into the BUILD targets via `build_cleaner`. - Added a new `test_load_with_renaming` integration test to ensure `qvalue` and `scale` components are properly mapped and validated dynamically during `process_prequantized_params`. PiperOrigin-RevId: 892439192
52e166e to
95fafcd
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.
Add rename transform support to load_nested_safetensors in Orbax + Qwix integration
This CL adds support for selectively renaming parameters when loading checkpoints via
load_nested_safetensors. By passing an optionalrename_rulesparameter (a sequence of regex string pairs), parameters with custom suffixes (e.g.,scale_inv,param) can be transformed into their expected Qwix components (scale,qvalue) prior to unflattening.Changes:
load_nested_safetensorsto optionally apply theorbax.checkpoint.experimental.model_surgery.transformations.renaming.rename_by_regextransformation.renamingmodule and its dependencies into the BUILD targets viabuild_cleaner.test_load_with_renamingintegration test to ensureqvalueandscalecomponents are properly mapped and validated dynamically duringprocess_prequantized_params.