RuntimeError: Exporting the operator fake_quantize_per_tensor_affine to ONNX opset version 9 is not supported. Support for this operator was added in version 10, try exporting with this version. #1515
When I try to fill a quantization, my code causes an error:
RuntimeError: Exporting the operator fake_quantize_per_tensor_affine to ONNX opset version 9 is not supported. Support for this operator was added in version 10, try exporting with this version.
Traceback (most recent call last):
File "/home/banana/Docs/VScode/Python/RSM_projects/Auto_Pilot/Qantization_test/main.py", line 110, in <module>
trainer.qat(model=net, training_params=train_params, train_loader=train_loader, valid_loader=valid_loader, calib_loader=train_loader)
File "/home/banana/Docs/VScode/Python/RSM_projects/Auto_Pilot/Qantization_test/QAT_TEST/lib/python3.10/site-packages/super_gradients/training/sg_trainer/sg_trainer.py", line 2436, in qat
_ = self.ptq(
File "/home/banana/Docs/VScode/Python/RSM_projects/Auto_Pilot/Qantization_test/QAT_TEST/lib/python3.10/site-packages/super_gradients/training/sg_trainer/sg_trainer.py", line 2590, in ptq
export_result = model.export(
File "/home/banana/Docs/VScode/Python/RSM_projects/Auto_Pilot/Qantization_test/QAT_TEST/lib/python3.10/site-packages/super_gradients/module_interfaces/exportable_detector.py", line 490, in export
torch.onnx.export(model=complete_model, args=onnx_input, f=output, output_names=output_names, **onnx_export_kwargs)
File "/home/banana/Docs/VScode/Python/RSM_projects/Auto_Pilot/Qantization_test/QAT_TEST/lib/python3.10/site-packages/torch/onnx/__init__.py", line 305, in export
return utils.export(model, args, f, export_params, verbose, training,
File "/home/banana/Docs/VScode/Python/RSM_projects/Auto_Pilot/Qantization_test/QAT_TEST/lib/python3.10/site-packages/torch/onnx/utils.py", line 118, in export
_export(model, args, f, export_params, verbose, training, input_names, output_names,
File "/home/banana/Docs/VScode/Python/RSM_projects/Auto_Pilot/Qantization_test/QAT_TEST/lib/python3.10/site-packages/torch/onnx/utils.py", line 719, in _export
_model_to_graph(model, args, verbose, input_names,
File "/home/banana/Docs/VScode/Python/RSM_projects/Auto_Pilot/Qantization_test/QAT_TEST/lib/python3.10/site-packages/torch/onnx/utils.py", line 503, in _model_to_graph
graph = _optimize_graph(graph, operator_export_type,
File "/home/banana/Docs/VScode/Python/RSM_projects/Auto_Pilot/Qantization_test/QAT_TEST/lib/python3.10/site-packages/torch/onnx/utils.py", line 232, in _optimize_graph
graph = torch._C._jit_pass_onnx(graph, operator_export_type)
File "/home/banana/Docs/VScode/Python/RSM_projects/Auto_Pilot/Qantization_test/QAT_TEST/lib/python3.10/site-packages/torch/onnx/__init__.py", line 354, in _run_symbolic_function
return utils._run_symbolic_function(*args, **kwargs)
File "/home/banana/Docs/VScode/Python/RSM_projects/Auto_Pilot/Qantization_test/QAT_TEST/lib/python3.10/site-packages/torch/onnx/utils.py", line 1057, in _run_symbolic_function
symbolic_fn = _find_symbolic_in_registry(domain, op_name, opset_version, operator_export_type)
File "/home/banana/Docs/VScode/Python/RSM_projects/Auto_Pilot/Qantization_test/QAT_TEST/lib/python3.10/site-packages/torch/onnx/utils.py", line 1011, in _find_symbolic_in_registry
return sym_registry.get_registered_op(op_name, domain, opset_version)
File "/home/banana/Docs/VScode/Python/RSM_projects/Auto_Pilot/Qantization_test/QAT_TEST/lib/python3.10/site-packages/torch/onnx/symbolic_registry.py", line 129, in get_registered_op
raise RuntimeError(msg)
RuntimeError: Exporting the operator fake_quantize_per_tensor_affine to ONNX opset version 9 is not supported. Support for this operator was added in version 10, try exporting with this version.
Versions
Collecting environment information...
PyTorch version: 1.11.0+cu113
Is debug build: False
CUDA used to build PyTorch: 11.3
ROCM used to build PyTorch: N/A
OS: Ubuntu 22.04.3 LTS (x86_64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: Could not collect
CMake version: version 3.24.1
Libc version: glibc-2.35
Python version: 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] (64-bit runtime)
Python platform: Linux-6.2.0-34-generic-x86_64-with-glibc2.35
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True
CPU:
Архитектура: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 39 bits physical, 48 bits virtual
Порядок байт: Little Endian
CPU(s): 8
On-line CPU(s) list: 0-7
ID прроизводителя: GenuineIntel
Имя модели: Intel(R) Core(TM) i5-9300H CPU @ 2.40GHz
Семейство ЦПУ: 6
Модель: 158
Потоков на ядро: 2
Ядер на сокет: 4
Сокетов: 1
Степпинг: 10
CPU max MHz: 4100,0000
CPU min MHz: 800,0000
BogoMIPS: 4800.00
Флаги: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d arch_capabilities
Виртуализация: VT-x
L1d cache: 128 KiB (4 instances)
L1i cache: 128 KiB (4 instances)
L2 cache: 1 MiB (4 instances)
L3 cache: 8 MiB (1 instance)
NUMA node(s): 1
NUMA node0 CPU(s): 0-7
Vulnerability Gather data sampling: Mitigation; Microcode
Vulnerability Itlb multihit: KVM: Mitigation: VMX disabled
Vulnerability L1tf: Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable
Vulnerability Mds: Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Meltdown: Mitigation; PTI
Vulnerability Mmio stale data: Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Retbleed: Mitigation; IBRS
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; IBRS, IBPB conditional, STIBP conditional, RSB filling, PBRSB-eIBRS Not affected
Vulnerability Srbds: Mitigation; Microcode
Vulnerability Tsx async abort: Not affected
Versions of relevant libraries:
[pip3] numpy==1.23.0
[pip3] onnx==1.13.0
[pip3] onnx-graphsurgeon==0.3.27
[pip3] onnx-simplifier==0.4.33
[pip3] onnxruntime==1.13.1
[pip3] pytorch-quantization==2.1.2
[pip3] torch==1.11.0+cu113
[pip3] torchaudio==0.11.0+cu113
[pip3] torchmetrics==0.8.0
[pip3] torchvision==0.12.0+cu113
[conda] Could not collect
🐛 Describe the bug
When I try to fill a quantization, my code causes an error: RuntimeError: Exporting the operator fake_quantize_per_tensor_affine to ONNX opset version 9 is not supported. Support for this operator was added in version 10, try exporting with this version.
I got the following error:
Versions
Collecting environment information... PyTorch version: 1.11.0+cu113 Is debug build: False CUDA used to build PyTorch: 11.3 ROCM used to build PyTorch: N/A
OS: Ubuntu 22.04.3 LTS (x86_64) GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 Clang version: Could not collect CMake version: version 3.24.1 Libc version: glibc-2.35
Python version: 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] (64-bit runtime) Python platform: Linux-6.2.0-34-generic-x86_64-with-glibc2.35 Is CUDA available: False CUDA runtime version: No CUDA CUDA_MODULE_LOADING set to: N/A GPU models and configuration: No CUDA Nvidia driver version: No CUDA cuDNN version: No CUDA HIP runtime version: N/A MIOpen runtime version: N/A Is XNNPACK available: True
CPU: Архитектура: x86_64 CPU op-mode(s): 32-bit, 64-bit Address sizes: 39 bits physical, 48 bits virtual Порядок байт: Little Endian CPU(s): 8 On-line CPU(s) list: 0-7 ID прроизводителя: GenuineIntel Имя модели: Intel(R) Core(TM) i5-9300H CPU @ 2.40GHz Семейство ЦПУ: 6 Модель: 158 Потоков на ядро: 2 Ядер на сокет: 4 Сокетов: 1 Степпинг: 10 CPU max MHz: 4100,0000 CPU min MHz: 800,0000 BogoMIPS: 4800.00 Флаги: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d arch_capabilities Виртуализация: VT-x L1d cache: 128 KiB (4 instances) L1i cache: 128 KiB (4 instances) L2 cache: 1 MiB (4 instances) L3 cache: 8 MiB (1 instance) NUMA node(s): 1 NUMA node0 CPU(s): 0-7 Vulnerability Gather data sampling: Mitigation; Microcode Vulnerability Itlb multihit: KVM: Mitigation: VMX disabled Vulnerability L1tf: Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable Vulnerability Mds: Mitigation; Clear CPU buffers; SMT vulnerable Vulnerability Meltdown: Mitigation; PTI Vulnerability Mmio stale data: Mitigation; Clear CPU buffers; SMT vulnerable Vulnerability Retbleed: Mitigation; IBRS Vulnerability Spec rstack overflow: Not affected Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization Vulnerability Spectre v2: Mitigation; IBRS, IBPB conditional, STIBP conditional, RSB filling, PBRSB-eIBRS Not affected Vulnerability Srbds: Mitigation; Microcode Vulnerability Tsx async abort: Not affected
Versions of relevant libraries: [pip3] numpy==1.23.0 [pip3] onnx==1.13.0 [pip3] onnx-graphsurgeon==0.3.27 [pip3] onnx-simplifier==0.4.33 [pip3] onnxruntime==1.13.1 [pip3] pytorch-quantization==2.1.2 [pip3] torch==1.11.0+cu113 [pip3] torchaudio==0.11.0+cu113 [pip3] torchmetrics==0.8.0 [pip3] torchvision==0.12.0+cu113 [conda] Could not collect