Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make SE algorithm also return zero points #3054

Merged
merged 2 commits into from
Nov 6, 2024

Conversation

nikita-savelyevv
Copy link
Collaborator

@nikita-savelyevv nikita-savelyevv commented Nov 1, 2024

Changes

  1. Made Scale Estimation return zero points besides scales.
  2. Minor fixes to do_int_quantization function, made its signature more strict.

Reason for changes

  1. Currently zero points need to be re-computed for the weights for which SE computed scales.
  2. Avoid unnecessary computations inside do_int_quantization. Avoid wrong usage of the function.

Tests

Added a test to verify correctness of feeding precomputed quantization parameters to do_int_quantization.

Tickets

Prerequisite to 139047.

@github-actions github-actions bot added NNCF OpenVINO Pull requests that updates NNCF OpenVINO NNCF PTQ Pull requests that updates NNCF PTQ labels Nov 1, 2024
@nikita-savelyevv
Copy link
Collaborator Author

No regressions on NNCF/job/manual/job/post_training_weight_compression/240

@nikita-savelyevv nikita-savelyevv marked this pull request as ready for review November 4, 2024 07:56
@nikita-savelyevv nikita-savelyevv requested a review from a team as a code owner November 4, 2024 07:56
@@ -358,6 +358,12 @@ def do_int_quantization(
"""
assert config.is_integer(), "The function supports integer quantization only"
group_size = config.group_size
is_asym = config.mode in [CompressWeightsMode.INT8_ASYM, CompressWeightsMode.INT4_ASYM]
if is_asym and (precomputed_scale is None) != (precomputed_zero_point is None):
raise ValueError(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it working with data free approach for INT4_ASYM?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

During data-free asymmetric compression, both precomputed_scale and precomputed_zero_point are None, so the if condition does not hold and the exception is not raised.

@ljaljushkin ljaljushkin merged commit 5d2be87 into openvinotoolkit:develop Nov 6, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NNCF OpenVINO Pull requests that updates NNCF OpenVINO NNCF PTQ Pull requests that updates NNCF PTQ
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants