Hi, I want to kown does QAT model in pytorch can convert to ONNX model?
I have tried FX model quantization and Pytorch 2 export quantization, and I can running quantization aware training both of them on YOLOV5s, i want to export to onnx model to accelerate inference in chip. But I tried torch.onnx.export and torch.onnx.dynamo_export, raise error like this:
from user code:
File "<eval_with_key>.5", line 7, in forward
quantize_per_tensor = torch.quantize_per_tensor(x, model_0_conv_input_scale_0, model_0_conv_input_zero_point_0, torch.quint8); x = model_0_conv_input_scale_0 = model_0_conv_input_zero_point_0 = None
Set TORCH_LOGS="+dynamo" and TORCHDYNAMO_VERBOSE=1 for more information
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/root/yolov5/train.py", line 1021, in <module>
main(opt)
File "/root/yolov5/train.py", line 723, in main
train(opt.hyp, opt, device, callbacks)
File "/root/yolov5/train.py", line 475, in train
torch.onnx.dynamo_export(
File "/opt/conda/lib/python3.10/site-packages/torch/onnx/__init__.py", line 517, in dynamo_export
return dynamo_export(
File "/opt/conda/lib/python3.10/site-packages/torch/onnx/_internal/_exporter_legacy.py", line 1233, in dynamo_export
raise errors.OnnxExporterError(message) from e
torch.onnx.OnnxExporterError: Failed to export the model to ONNX. Generating SARIF report at 'report_dynamo_export.sarif'. SARIF is a standard format for the output of static analysis tools. SARIF logs can be loaded in VS Code SARIF viewer extension, or SARIF web viewer (https://microsoft.github.io/sarif-web-component/). Please report a bug on PyTorch Github: https://github.com/pytorch/pytorch/issues
So i want to know is there some documentation to guide export QAT model to ONNX model?