microsoft/onnxscript
ONNX Script enables developers to naturally author ONNX functions and models using a subset of Python.
What it solves
ONNX Script provides a more natural and concise way for developers to author, debug, and optimize ONNX functions and models. Instead of manually constructing complex ONNX graphs, developers can use a subset of Python to define their models, making the process more expressive and easier to manage.
How it works
The project uses a Python decorator (@script) to parse Python code into an intermediate representation, which is then converted into an ONNX graph (a FunctionProto or ModelProto). It supports bidirectional conversion, allowing users to translate Python scripts into ONNX models and vice versa. Additionally, it includes a runtime shim that enables "eager mode" evaluation, allowing developers to execute and debug functions directly in Python using ONNX Runtime for operator execution.
Who it’s for
AI developers and machine learning engineers who need to create, modify, or optimize ONNX models and the underlying functions that power them.
Highlights
- Bidirectional Conversion: Translates between Python-based ONNX Script and ONNX graphs.
- Eager Mode Debugging: Allows for immediate evaluation of functions to validate intermediate results without needing to export a full model.
- ONNX Optimizer: Includes tools for constant folding and dead code elimination to improve model performance.
- ONNX Rewriter: Enables the replacement of specific graph patterns with user-defined rewrite rules for graph-level optimization.
Related
- Project
- Project
- Project
- Project
- Project