Skip to content

Add rename transform support to load_nested_safetensors in Orbax + Qwix integration#239

Merged
copybara-service[bot] merged 1 commit intomainfrom
test_891488955
Mar 31, 2026
Merged

Add rename transform support to load_nested_safetensors in Orbax + Qwix integration#239
copybara-service[bot] merged 1 commit intomainfrom
test_891488955

Conversation

@copybara-service
Copy link
Copy Markdown

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 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.

@copybara-service copybara-service Bot force-pushed the test_891488955 branch 2 times, most recently from 220908b to 52e166e Compare March 31, 2026 18:01
…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
@copybara-service copybara-service Bot merged commit 95fafcd into main Mar 31, 2026
1 check passed
@copybara-service copybara-service Bot deleted the test_891488955 branch March 31, 2026 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant