microsoft / onnxruntime

ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
https://onnxruntime.ai
MIT License
13.91k stars 2.81k forks source link

"Quantize_qat" for PyTorch QAT model #7764

Open Kentaro-Mikami opened 3 years ago

Kentaro-Mikami commented 3 years ago

Is your feature request related to a problem? Please describe. We tried to use "Quantize_qat" function for PyTorch QAT model. We followed PyTorch QAT tutrial, we could create QAT model. (Attached model) Then we tried to use "Quantize_qat" API for this model, but the error occured. Would you give us your advise about this error?

Traceback (most recent call last): File "C:/Users/UserName/PycharmProjects/pytorch_qat/turorial.py", line 450, in quantized_model = quantize_qat(model_fp32, model_quant, weight_type=QuantType.QUInt8) File "C:\Users\UserName\AppData\Local\Programs\Python\Python37\lib\site-packages\onnxruntime\quantization\quantize.py"   , line 339, in quantize_qat quantizer.quantize_model() File "C:\Users\UserName\AppData\Local\Programs\Python\Python37\lib\site-packages\onnxruntime\quantization\onnx_quantiz   er.py", line 188, in quantize_model self.remove_fake_quantized_nodes() File "C:\Users\UserName\AppData\Local\Programs\Python\Python37\lib\site-packages\onnxruntime\quantization\onnx_quantiz   er.py", line 129, in remove_fake_quantized_nodes curr_node.name)) ValueError: Remove fake-quantized node pair Error: Parent node is not found for QuantizeLinear_2.

System information

mobilenet_quantization_scripted.zip

Hrayo712 commented 2 years ago

I am running into a similar issue using torch 1.9.0 and ORT 1.8. Any hint/update into what might be the issue ?

stale[bot] commented 2 years ago

This issue has been automatically marked as stale due to inactivity and will be closed in 7 days if no further activity occurs. If further support is needed, please provide an update and/or more details.