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

Conversation

KodiaqQ
Copy link
Contributor

@KodiaqQ KodiaqQ commented Jan 27, 2025

What does this PR do?

Fixes 161201

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests?

@KodiaqQ
Copy link
Contributor Author

KodiaqQ commented Jan 27, 2025

@AlexKoff88, @nikita-savelyevv, could you review this PR, please? Thanks.

@@ -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.

Comment on lines 134 to 141
(
"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.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@echarlaix echarlaix merged commit 3ef8ae2 into huggingface:main Jan 27, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants