You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add RNNT quantization passes and ONNX MatMulNBits graph surgery - #2761
Reuse ONNX k-quant packing and canonical initializer naming.
Support per-node settings, wildcard exclusions, accuracy levels, and progress logging.
Preserve graph outputs and rewire intermediate consumers.
Reuse shared quantized initializers and remove unused weights.
Provide a standalone RemoveUnusedInitializers surgery.
Load Hugging Face configuration before resolving task model classes, retain the required AutoConfig import, and add external-data serialization diagnostics.
Add regression tests for RNNT quantization, shared k-quant parameters, MatMulNBits conversion and naming, initializer reuse and cleanup, and external-data serialization.
Checklist before requesting a review
Add unit tests for this change.
Make sure all tests can pass.
Update documents if necessary.
Lint and apply fixes to your code by running lintrunner -a
Is this a user-facing change? If yes, give a description of this change to be included in the release notes.
Introduce RNNT-specific optimization paths without requiring
transformer-centric model metadata.
- Register RnntSelectiveMixedPrecision and RnntGptq passes.
- Add grouped linear-weight quantization with RTN and shared
k-quant parameter selection.
- Resolve group sizes against layer dimensions and persist
quantized state dictionaries.
- Keep decoder and joint precision unchanged by ignoring their
per-module precision overrides.
Add configurable MatMul-to-MatMulNBits graph conversion:
- Reuse ONNX k-quant packing and canonical initializer naming.
- Support per-node settings, wildcard exclusions, accuracy levels,
and progress logging.
- Preserve graph outputs and rewire intermediate consumers.
- Reuse shared quantized initializers and remove unused weights.
- Provide a standalone RemoveUnusedInitializers surgery.
Load Hugging Face configuration before resolving task model classes,
retain the required AutoConfig import, and add external-data
serialization diagnostics.
Add regression tests for RNNT quantization, shared k-quant parameters,
MatMulNBits conversion and naming, initializer reuse and cleanup,
and external-data serialization.
- Save through ir_model_to_olive_model to match ONNX k-quant
- Preserve output-directory creation and initializer deduplication
- Test inline/external weights, output paths, and deduplication modes
Resolves the observed ~134 MB encoder size overhead from protobuf saving.
This PR adds RNNT-specific quantization paths to Olive without relying on transformer metadata, alongside configurable ONNX MatMulNBits graph conversion.
Changes:
Register RNNT mixed-precision and grouped weight-quantization passes using RTN or shared k-quant parameters.
Add MatMulNBits conversion and unused-initializer cleanup, with regression tests.
Update graph serialization and load Hugging Face configuration before resolving task model classes.
File
Description
test/passes/pytorch/test_rnnt_quantization.py
Tests RNNT metadata and quantized weights.
test/passes/onnx/test_graph_surgeries.py
Tests conversion, initializer reuse, cleanup, and serialization.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Critical defects can invalidate ONNX graphs through unsafe value renaming and unsupported block sizes, while quantized checkpoint loading depends on unbundled source resources and can mix CPU weights with CUDA parameters.
The shared-weight cache is checked only after _kquant_block_quant has already run. Consequently, every MatMul using the same weight and settings repeats the full k-quant search and packing, then discards the duplicate arrays; only initializer storage is reused. Check (weight_name, node_bits, node_block_size) before quantization and run the expensive work only on a cache miss, especially for large shared weights.
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
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 RNNT quantization passes and ONNX MatMulNBits graph surgery
Introduce RNNT-specific optimization paths without requiring transformer-centric model metadata.
Add configurable MatMul-to-MatMulNBits graph conversion:
Load Hugging Face configuration before resolving task model classes, retain the required AutoConfig import, and add external-data serialization diagnostics.
Add regression tests for RNNT quantization, shared k-quant parameters, MatMulNBits conversion and naming, initializer reuse and cleanup, and external-data serialization.
Checklist before requesting a review
lintrunner -a(Optional) Issue link