-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Naming conflict when quantizing models with Pad nodes #17760
Comments
Thanks for reporting this problem. A minimal repro is required to debug this problem. Could you please make the script runnable on our side by simple copy-and-paste? The current |
Thanks for your response. I've edited the script above. You just need to change the input path, and it should be runnable. |
I see a bunch of
By removing those empty string (e.g., if "mode" not in kwargs or kwargs["mode"] == b"constant":
- if len(node.input) > 2 and node.input[2] != "": # There is 3rd input 'constant_value'
+ if len(node.input) > 2 and node.input[2] != "": # There is 3rd input 'constant_value'
zp_tensor = self.quantizer.model.get_initializer(quantized_input_value.zp_name)
scale_tensor = self.quantizer.model.get_initializer(quantized_input_value.scale_name)
if zp_tensor is None or scale_tensor is None:
super().quantize()
return |
Fix #17760. Upstream exporter creates empty string as Pad's 3rd input and the quantization tool 1) considers that as a valid tensor name and 2) adds corresponding invalid quantization nodes. This PR adds a condition check to make quantization tool working.
Fix microsoft#17760. Upstream exporter creates empty string as Pad's 3rd input and the quantization tool 1) considers that as a valid tensor name and 2) adds corresponding invalid quantization nodes. This PR adds a condition check to make quantization tool working.
Describe the issue
The default name of the constant input to the Pad node after quantization is always '_quantized'. Because of this naming conflict, the resulting quantized model has floating QuantizeLinear nodes that are not connected to anything. Also, the Pad ops all share a single input QuantizeLinear. There is also a DequantizeLinear node that leads to nowhere.
To reproduce
Here's the model.
And the script is below:
Urgency
No response
Platform
Linux
OS Version
Ubuntu 20.04.6 LTS
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
1.16.0
ONNX Runtime API
Python
Architecture
X64
Execution Provider
Default CPU
Execution Provider Library Version
No response
The text was updated successfully, but these errors were encountered: