-
Notifications
You must be signed in to change notification settings - Fork 249
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
[HWConfig] narrow_range parameter is introduced in hardware config #3196
[HWConfig] narrow_range parameter is introduced in hardware config #3196
Conversation
07a6520
to
a9a0c19
Compare
7134fcb
to
c8b1761
Compare
0b064a7
to
0733ac3
Compare
0733ac3
to
10267b0
Compare
/* | ||
* Narrow range: should NNCF use 2**num_bits quants or 2**num_bits - 1 | ||
*/ | ||
"narrow_range": false | ||
}, | ||
"q8_sym_tnr_-128_127": { // Alias name for set of hyperparameters | ||
"bits": 8, // Number of quantization bits | ||
"mode": "symmetric", // Quantization mode | ||
"granularity": "pertensor", // Granularity: one scale for output tensor | ||
"level_low": -128, // Low quantization level |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does NNCF support for level_low
and level_high
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it redundant, since other params define how to calculate them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/openvinotoolkit/nncf/blob/develop/nncf/common/hardware/config.py#L160
It looks like, level_low
and level_high
parameters are only used to calculate signedness_to_force
. I believe, that is more simple just specify signedness_to_force
in the hardware config. I would suggest to implement it in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
a2e42d5
to
7257b2e
Compare
4b0dc46
to
4d3a892
Compare
987c51d
to
ea5d0fd
Compare
"input_low": -0.9350724220275879, | ||
"input_low": -0.9424352049827576, | ||
"input_high": 0.9350724220275879, | ||
"output_low": -0.9350724220275879, | ||
"output_low": -0.9424352049827576, | ||
"output_high": 0.9350724220275879 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e7a1453
to
cfedaf7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, rebase the PR. Did you run e2e for PyTorch?
/* | ||
* Narrow range: should NNCF use 2**num_bits quants or 2**num_bits - 1 | ||
*/ | ||
"narrow_range": false | ||
}, | ||
"q8_sym_tnr_-128_127": { // Alias name for set of hyperparameters | ||
"bits": 8, // Number of quantization bits | ||
"mode": "symmetric", // Quantization mode | ||
"granularity": "pertensor", // Granularity: one scale for output tensor | ||
"level_low": -128, // Low quantization level |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/openvinotoolkit/nncf/blob/develop/nncf/common/hardware/config.py#L160
It looks like, level_low
and level_high
parameters are only used to calculate signedness_to_force
. I believe, that is more simple just specify signedness_to_force
in the hardware config. I would suggest to implement it in this PR.
9632fc8
to
320474d
Compare
320474d
to
1d14985
Compare
TriggerBetta/969/ - Passed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…penvinotoolkit#3196) ### Changes * Narrow range parameter is moved to hardware config * Embedding / embedding bag nodes propagates the narrow_range attribute of the activation quantizer up to the weight quantizer ### Reason for changes * To extend the set of possible quantization configuration (like weights + symmetric + narrow_range=False) required for the some runtimes (ex: XNNPACK) ### Related tickets ### Tests * tests/cross_fw/test_templates/test_calculate_quantizer_parameters.py is updated to check all possible combination of existing qconfigs with narrow_range True/False * tests/common/quantization/test_quantizer_propagation_solver.py is updated to check requantization rule with narrow_range and the rule of configuration merging with different narrow_range parameters * tests/common/quantization/test_quantizer_propagation_graph.py is updated to check subsequent quantizers with different narrow_range values do not merge * reference quantizers scales are updated to reflect the fix of embedding weights quantization post_training_quantization/586/ - Passed job/weekly/job/ubuntu20_eval/245/ (+ job/ubuntu20_eval/246/) Passed eval_tf/461/ - Passed torch_weekly/100/ - Passed job/nightly/job/torch_nightly/444/ - Passed TriggerBetta/969/ - Passed
Changes
Reason for changes
Related tickets
#3231
Tests
post_training_quantization/586/ - Passed
job/weekly/job/ubuntu20_eval/245/ (+ job/ubuntu20_eval/246/) Passed
eval_tf/461/ - Passed
torch_weekly/100/ - Passed
job/nightly/job/torch_nightly/444/ - Passed
TriggerBetta/969/ - Passed