yet-another-onnx-builder documentation#

core scikit-learn tensorflow pytorch https://github.com/xadupre/yet-another-onnx-builder/actions/workflows/docs.yml/badge.svg https://github.com/xadupre/yet-another-onnx-builder/actions/workflows/style.yml/badge.svg https://github.com/xadupre/yet-another-onnx-builder/actions/workflows/spelling.yml/badge.svg https://codecov.io/gh/xadupre/yet-another-onnx-builder/branch/main/graph/badge.svg https://img.shields.io/github/repo-size/xadupre/yet-another-onnx-builder

yet-another-onnx-builder on GitHub

yet-another-onnx-builder (yobx) proposes a unique API and a unique function yobx.to_onnx() to convert machine learning models to ONNX format and manipulating ONNX graphs programmatically. It can export from many libraries. Each converters relies on a common GraphBuilder API (GraphBuilderExtendedProtocol) to build the final ONNX model. One default implementation is provided but it can also be replaced by any implementation of your own. Any user can implement its own. You can see OnnxScriptGraphBuilder or SpoxGraphBuilder for a reference. These API are close to onnx API, using NodeProto for nodes and strings for names. This is on purpose: what this API produces is what you see in the final ONNX model. You can add your own metadata, choose your own names.

yobx.to_onnx() is the single entry point for all supported frameworks. It inspects the type of model at runtime and automatically delegates to the appropriate backend-specific converter:

All extra keyword arguments are forwarded verbatim to the selected converter, so the backend-specific parameters (export_options, function_options, extra_converters, …) remain fully accessible through the top-level function.

standard machine learning

data manipulations

This is work in progress. Many packages produce SQL queries. It starts by converting a SQL query into ONNX. A lightweight DataFrame function tracer (dataframe_to_onnx()) records pandas-inspired operations on a DataFrame and compiles them to ONNX directly.

deep learning

The package is built upon a single graph builder API for constructing and optimizing ONNX graphs with built-in shape inference with can also linked to spox or onnxscript/ir-py. Its unique API:

# the model is called
expected = model(*args, **kwargs)
onnx_model = to_onnx(model, args, kwargs, dynamic_shapes, **options)

This package was initially started using vibe coding. AI is able to translate an existing code into another one such as ONNX but it tends sometime to favor ugly functions definition not friendly to the users.

Indices and tables#

Older versions#