ONNXifier
A simple tool to convert any IR format to ONNX file.
| Framework | Status |
|---|---|
| OpenVINO | ✅ |
| ONNXRuntime | ✅ |
| TensorRT | 🚧 |
| TensorRT-LLM | 🚧 |
- ✅: well supported
- 🪛: partially supported
- 🚧: developing
Usage
- Install from PyPI
pip install onnxifier
- Convert IR using CLI
onnxify model.xml
usage: onnxify input_model.onnx [output_model.onnx]
onnxify command-line api
options:
-h, --help show this help message and exit
--install-completion [{bash,pwsh}]
install shell completion for the specified shell and
exit.
-a [ACTIVATE ...], --activate [ACTIVATE ...]
select passes to be activated, activate L1, L2 and L3
passes if not set.
-r [REMOVE ...], --remove [REMOVE ...]
specify passes to be removed from activated passes.
-n, --no-passes do not run any optimizing passes, just convert the
model
--print [PRINT] print the name of all optimizing passes
--format {protobuf,textproto,json,onnxtxt}
onnx file format
-s, --infer-shapes infer model shapes
-c CONFIG_FILE, --config-file CONFIG_FILE
specify a json-format config file for passes
-u, --uncheck no checking output model
--check check optimized model with random inputs
-d, --dry-run only run passes without saving the output model
--checker-backend {onnx,openvino,onnxruntime}
backend for accuracy checking, defaults to onnxruntime
-v OPSET_VERSION, --opset-version OPSET_VERSION
target opset version, defaults to 20
-vv [{DEBUG,INFO,WARNING,ERROR,CRITICAL}], --log-level [{DEBUG,INFO,WARNING,ERROR,CRITICAL}]
specify the level of log messages to be printed,
defaults to INFO
-R, --recursive recursively optimize nested functions
--nodes [NODES ...] specify a set of node names to apply passes only on
these nodes
To print pass information:
onnxify --print all
onnxify --print fuse_swish
onnxify --print l1
Shell Completion
onnxify provides tab-completion for Bash and PowerShell to help you quickly select pass names and options.
After installing onnxifier from PyPI, run the built-in installer once for your shell:
Bash
onnxify --install-completion bash
source ~/.bashrc
PowerShell
onnxify --install-completion pwsh
. $PROFILE
The installer is idempotent — running it again will not duplicate entries in your profile.
Once enabled, you can use Tab to complete pass names after -a / -r / --print, for example:
# Complete a single pass
onnxify model.onnx -a ins<TAB>
# → inspect_sparsity_ratio inspect_weights_distribution insert_conv_before_act_shave
# Complete multiple space-separated passes
onnxify model.onnx -a infer_shape fold_const<TAB>
# → fold_constant
# Complete comma-separated passes
onnxify model.onnx -a fuse_gelu,ins<TAB>
# → fuse_gelu,inspect_sparsity_ratio ...
# Complete --print arguments
onnxify --print l<TAB>
# → l1 l2 l3
Custom Domain Shape Inference
ONNXifier supports shape inference for custom domain ops (e.g., trt::CausalConv1d, com.microsoft::MyOp) through a registration API.
Usage
Shape inference for domain ops is automatic when using the --infer-shapes flag:
onnxify model_with_trt_ops.onnx --infer-shapes
Registering Shape Inference for Custom Ops
Developers register shape inference using ONNXScript functions. The decorator inserts the function into the model during infer_shapes, then cleans it up afterward.
import onnxscript
from onnxscript.onnx_opset import opset19 as op
from onnxscript.values import Opset
from onnxifier.domain.shape_inference import register_shape_inference
@register_shape_inference("com.mycompany", "MyOp")
@onnxscript.script(Opset("com.mycompany", 1), default_opset=op)
def my_op_shape_infer(input_0, input_1):
# Return shapes for each output
return op.Identity(input_0), op.Identity(input_1)
If domain/op_type are omitted, they are inferred from the ONNXScript function metadata:
@register_shape_inference() # Uses function.name and function.opset.domain
@onnxscript.script(Opset("com.mycompany", 1), default_opset=op)
def MyOp(input_0):
return op.Identity(input_0)
See quickstart.md for detailed examples.
TODO
Contribute
- pyright type checking
pip install -U pyright
pyright onnxifier
- mypy type checking
pip install -U mypy
mypy onnxifier --disable-error-code=import-untyped --disable-error=override --disable-error=call-overload
- pre-commit checking
pip install -U pre-commit
pre-commit run --all-files
Metadata
Release files for onnxifier 2.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| onnxifier-2.2.2.tar.gz | 175.7 kB | With provenance | Details for onnxifier-2.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| onnxifier-2.2.2-py3-none-any.whl | Python 3 | none | any | Details for onnxifier-2.2.2-py3-none-any.whl |
Total release size: 526.1 kB
Release files / onnxifier-2.2.2.tar.gz
| Download URL | onnxifier-2.2.2.tar.gz |
|---|---|
| Size | 175.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2ad9ee6cbd151c19fd3c27062775e4b995b855de61a1485d96f12a901f22cade
|
|
BLAKE2b-256 checksum How to use checksums |
12f535022fa297fa703ce4149a6db7d1ef5a4ea6d8416dadc7dc6cb280822acc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logRelease files / onnxifier-2.2.2-py3-none-any.whl
| Download URL | onnxifier-2.2.2-py3-none-any.whl |
|---|---|
| Size | 350.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7917a0bf08afbd8407a9b0e1e436999ca9970ec6d63fc15571b5b99680cb0a3b
|
|
BLAKE2b-256 checksum How to use checksums |
dbe097aae53fbc6fdd71ea10db326b8ffd95b667dbca8ca06e88c2d19081732a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logSecurity for onnxifier 2.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for onnxifier-2.2.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.