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

Fix default num samples #1129

Merged
merged 3 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion optimum/intel/openvino/quantization.py
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,7 @@ def _full_quantization(
quantized_model = nncf.quantize(
model,
calibration_dataset,
subset_size=quantization_config.num_samples,
subset_size=quantization_config.num_samples if quantization_config.num_samples else 128,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
subset_size=quantization_config.num_samples if quantization_config.num_samples else 128,
subset_size=quantization_config.num_samples if quantization_config.num_samples else 300,

For nncf.quantize() the default value is currently 300.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@AlexKoff88, could you please clarify, which numbers should be as the default.

Copy link
Collaborator

Choose a reason for hiding this comment

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

300 is a default value for CNNs. We noticed that for LLMs it can be less. I think it is ok to use 128 and keep it aligned with weight compression.

ignored_scope=quantization_config.get_ignored_scope_instance(),
model_type=nncf.ModelType(quantization_config.model_type),
preset=nncf.QuantizationPreset.PERFORMANCE if quantization_config.sym else nncf.QuantizationPreset.MIXED,
Expand Down
8 changes: 8 additions & 0 deletions tests/openvino/test_exporters_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,14 @@ class OVCLIExportTestCase(unittest.TestCase):
(13,),
(16,),
),
(
"text-generation",
"llama",
"int8",
"--dataset wikitext2 --trust-remote-code",
(13,),
(16,),
),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you remove --num-samples 1 from the previous test instead of adding this one? This will have less impact on testing time and maintain the same coverage.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

]

TEST_4BIT_CONFIGURATIONS = [
Expand Down
Loading