Add pack int2 functions#4112
Closed
AlexanderDokuchaev wants to merge 4 commits into
Closed
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds bit-packing utilities for 2-bit integer quantization to the PyTorch quantization helpers, and consolidates/extends the test coverage for 2-bit and 4-bit pack/unpack functions.
Changes:
- Implement
pack_uint2,unpack_uint2,pack_int2,unpack_int2inquantize_functions.py. - Expand pack/unpack docstrings for int4/uint4 to document bit layout more clearly.
- Move and extend pack/unpack tests into
tests/torch/quantization/test_functions.py, removing the duplicated int4 pack/unpack tests from the weights-compression test module.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/nncf/torch/quantization/quantize_functions.py |
Adds 2-bit pack/unpack implementations and improves packing docstrings. |
tests/torch/quantization/test_functions.py |
Adds consolidated pack/unpack tests (round-trip, layout, dtype validation). |
tests/torch/function_hook/quantization/test_weights_compression.py |
Removes duplicated int4 pack/unpack tests after consolidation. |
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.
Changes
Add functions for compression to int2:
pack_uint2,pack_int2,unpack_uint2,unpack_int2Move all tests for int4 compression to corresponding file
tests/torch/quantization/test_functions.pyReason for changes
Related tickets
Tests