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

[Quant tool] Ensure MSFT opset for Q/DQ models #19335

Merged
merged 3 commits into from
Jan 31, 2024

Conversation

adrianlizarraga
Copy link
Contributor

Description

Updates qdq quantization to ensure the final model has the com.microsoft opset import if the model uses Q/DQ ops with the com.microsoft domain (e.g., for int16 quantization)

Motivation and Context

Need to ensure the MSFT domain is correctly set for all relevant cases. Otherwise, shape inferencing tools will raise an exception.

@adrianlizarraga adrianlizarraga changed the title Adrianl/quant ensure ms domain [Quant tool] Ensure MSFT opset for Q/DQ models Jan 30, 2024
if extra_options and extra_options.get("UseQDQContribOps", False):
qdq_model = onnx.load_model(model_qdq_path)
ms_opset = next((opset for opset in qdq_model.opset_import if opset.domain == "com.microsoft"), None)
self.assertTrue(ms_opset is not None)

Check notice

Code scanning / CodeQL

Imprecise assert Note test

assertTrue(a is not b) cannot provide an informative message. Using assertIsNot(a, b) instead will give more informative messages.
Copy link

Choose a reason for hiding this comment

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

@adrianlizarraga adrianlizarraga merged commit 0c38e96 into main Jan 31, 2024
98 checks passed
@adrianlizarraga adrianlizarraga deleted the adrianl/quant-ensure-ms-domain branch January 31, 2024 01:19
@sophies927 sophies927 added the triage:approved Approved for cherrypicks for release label Feb 7, 2024
YUNQIUGUO pushed a commit that referenced this pull request Feb 8, 2024
### Description
Updates qdq quantization to ensure the final model has the
`com.microsoft` opset import if the model uses Q/DQ ops with the
`com.microsoft` domain (e.g., for int16 quantization)


### Motivation and Context
Need to ensure the MSFT domain is correctly set for all relevant cases.
Otherwise, shape inferencing tools will raise an exception.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:1.17.1 triage:approved Approved for cherrypicks for release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants