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

[bug-fix] enforce all converted quantized ONNX initializers are same dtype #1181

Merged
merged 1 commit into from
Nov 23, 2022

Conversation

bfineran
Copy link
Member

@bfineran bfineran commented Nov 23, 2022

torch 1.12 exports some Q/DQ inputs as initializers now instead of constants - this causes a pass in the quantized graph conversion step to miss a conversion from INT8 to UINT8. this PR adds an explicit pass to convert any missed INT8 to UINT8 initializers. without this fix, models may fail on ORT and deepsparse compile due to a mismatch between INT8 and UINT8 inputs

test_plan:
@KSGulin has reproduced the error to verify fix and commandeer
need to verify compilation + accuracy

Copy link
Contributor

@KSGulin KSGulin left a comment

Choose a reason for hiding this comment

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

Tested the scenarios:

  • Torch==1.12.1 + quantize_conv_activations: False in quantization modifier
  • Torch==1.12.1 + NO quantize_conv_activations: False in quantization modifier
  • Torch==1.9.1 + quantize_conv_activations: False in quantization modifier

All passed. Great fix! 🥳

Copy link
Contributor

@corey-nm corey-nm left a comment

Choose a reason for hiding this comment

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

lgtm!

@bfineran bfineran merged commit 51f051e into main Nov 23, 2022
@bfineran bfineran deleted the quant-convert-force-uint8 branch November 23, 2022 18:50
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.

None yet

3 participants