From 2b38779815f7f1e5e23b7ebce229b89666ba17ac Mon Sep 17 00:00:00 2001 From: Kaz Nishimura Date: Tue, 26 Mar 2024 22:19:02 +0900 Subject: [PATCH] Ensure ONNX model generation considers opset version This commit modifies the `gen_processing_models` function in `onnxruntime_extensions/cvt.py` to explicitly include the `opset_version` argument when calling `make_onnx_model` for both pre-processing and post-processing graphs. Previously, the function only generated models if `pre_g` or `post_g` existed, without specifying the opset version. This update ensures that generated ONNX models adhere to the desired opset level, improving compatibility and deployment options. --- onnxruntime_extensions/cvt.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/onnxruntime_extensions/cvt.py b/onnxruntime_extensions/cvt.py index 820964155..f2a5959d7 100644 --- a/onnxruntime_extensions/cvt.py +++ b/onnxruntime_extensions/cvt.py @@ -90,7 +90,7 @@ def gen_processing_models(processor: Union[str, object], **pre_kwargs) if pre_kwargs is not None else None post_g = _converter.post_processing( **post_kwargs) if post_kwargs is not None else None - return make_onnx_model(pre_g) if pre_g else None, \ - make_onnx_model(post_g) if post_g else None + return make_onnx_model(pre_g, opset_version=opset) if pre_g else None, \ + make_onnx_model(post_g, opset_version=opset) if post_g else None else: raise ValueError(f"Unsupported processor/tokenizer: {cls_name}")