From 74056fe9fe566a6951edefa7801862613fb30aaf Mon Sep 17 00:00:00 2001 From: AwesomeCodingBoy <43309460+ZhangZhiPku@users.noreply.github.com> Date: Tue, 30 Jan 2024 15:57:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=BA=86=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=20onnx=20domain=20=E7=9A=84=E7=9B=B8=E5=85=B3=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新的 onnx checker 会对 ai.onnx 这个 domain 报错,这个补丁将其修改为 "" --- ppq/parser/onnxruntime_exporter.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ppq/parser/onnxruntime_exporter.py b/ppq/parser/onnxruntime_exporter.py index 7f37f5c3..6a9a5e9e 100644 --- a/ppq/parser/onnxruntime_exporter.py +++ b/ppq/parser/onnxruntime_exporter.py @@ -587,7 +587,11 @@ def export(self, file_path: str, graph: BaseGraph, for key, value in extra_opsets.items(): op = onnx.OperatorSetIdProto() - op.domain = key + # PATCH 2024.01.30 + # 我也不知道为什么 onnx checker 会对 ai.onnx 这个 domain 报错 + # 按照规范 ai.onnx 与 "" 是等价的写法 + if key == 'ai.onnx': key = "" + op.domain = key op.version = value opsets.append(op) @@ -613,4 +617,4 @@ def export(self, file_path: str, graph: BaseGraph, ppq_warning('Exported Onnx Model is not executable, following Op has onnxruntime-unsupported quant policy:') for op in unsupportable_quant_op: ppq_warning(f'{op.name} (bitwidth != 8)') - ppq_warning('For Generating onnxruntime-executable Model, use TargetPlatform = Onnxruntime or OnnxruntimeQuantizer instead.') \ No newline at end of file + ppq_warning('For Generating onnxruntime-executable Model, use TargetPlatform = Onnxruntime or OnnxruntimeQuantizer instead.')