-
Notifications
You must be signed in to change notification settings - Fork 228
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
dump actual_subset_size #2769
Closed
Closed
dump actual_subset_size #2769
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -197,3 197,20 @@ def test_ignored_scope_dump(ignored_options, expected_dump, tmp_path): | |
assert dumped_model.get_rt_info(rt_path) == value | ||
else: | ||
assert dumped_model.has_rt_info(rt_path) is False | ||
|
||
|
||
@pytest.mark.parametrize("subset_size, expected_actual_subset_size", [[1, 1], [2, 1]]) | ||
def test_dump(subset_size, expected_actual_subset_size, tmp_path): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add 2 tests:
|
||
model = WeightsModel().ov_model | ||
dataset = get_dataset_for_test(model) # dataset.get_length() == 1 | ||
quantize_parameters = { | ||
"preset": QuantizationPreset.PERFORMANCE, | ||
"target_device": TargetDevice.CPU, | ||
"subset_size": subset_size, | ||
"fast_bias_correction": True, | ||
} | ||
quantized_model = quantize_impl(model, dataset, **quantize_parameters) | ||
ov.save_model(quantized_model, tmp_path / "ov_model.xml") | ||
core = ov.Core() | ||
dumped_model = core.read_model(tmp_path / "ov_model.xml") | ||
assert dumped_model.get_rt_info(["nncf", "quantization", "actual_subset_size"]) == str(expected_actual_subset_size) |
Oops, something went wrong.
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.
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.
if
__len()__
is not implemented, the actual subset size should be obtained as: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.
Sorry for the late reply. I found that the suggested changes do not work because the
calibration_dataset.get_inference_data()
iterator is consumed before dump_parameters. As a result,actual_subset_size
ends up being zero. Could you please provide some suggestions on how to handle this issue?Thank you very much! @l-bat
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.
@awayzjj after discussing within the team, we decided not to add
actual_subset_size
tort_info
becausert_info
is intended to contain quantization parameters provided to algorithms. If the provided dataset is shorter thansubset_size
, we should display a warning during the statistics collection process:nncf/nncf/common/tensor_statistics/aggregator.py
Line 76 in 408c67d