From efe30735d650312ac7043081ab0ea47ac68cc918 Mon Sep 17 00:00:00 2001 From: Justin Chu Date: Tue, 29 Oct 2024 17:44:18 -0700 Subject: [PATCH] Update opgen for it to be runnable (#1922) Previously the opgen module assumes that it is installed as a package and can be found at script import. Since we are now just running it as a standalone script, I updated to imports so that it can be run directly. Added a README. --- opgen/README.md | 17 +++++++++++++++++ opgen/__main__.py | 2 +- opgen/onnx_opset_builder.py | 3 +-- 3 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 opgen/README.md diff --git a/opgen/README.md b/opgen/README.md new file mode 100644 index 000000000..af6b7bbeb --- /dev/null +++ b/opgen/README.md @@ -0,0 +1,17 @@ +# Generator for onnx_opset + +Use this module the generate onnx_opset implementations when new opsets are introduced with new ONNX versions. + +## Generate + +```sh +python opgen +``` + +Run + +```sh +python opgen -h +``` + +for more information. diff --git a/opgen/__main__.py b/opgen/__main__.py index 081ee5da6..2318bc914 100644 --- a/opgen/__main__.py +++ b/opgen/__main__.py @@ -9,7 +9,7 @@ import textwrap from pathlib import Path -from opgen.onnx_opset_builder import ( +from onnx_opset_builder import ( OpsetId, OpsetsBuilder, format_opsetid, diff --git a/opgen/onnx_opset_builder.py b/opgen/onnx_opset_builder.py index 41b926940..01c7f3bc2 100644 --- a/opgen/onnx_opset_builder.py +++ b/opgen/onnx_opset_builder.py @@ -9,6 +9,7 @@ from textwrap import dedent from typing import Annotated, Any, Iterable, Optional, Set, TextIO +import pygen as cg from onnx.defs import ( AttributeProto, OpSchema, @@ -17,8 +18,6 @@ ) from onnx.helper import get_attribute_value -import opgen.pygen as cg - __all__ = [ "OpsetId", "parse_opsetid",