skillfed

onnxruntime_extensions

ONNXRuntime Extensions

onnxruntime-extensions v0.15.2 207.9K downloads/30d#9,540 on PyPI474
Permissive license MIT License Active released

What it is and what it does

ONNXRuntime-Extensions is a C/C++ library that plugs into ONNX Runtime to add custom operators for common pre- and post-processing tasks in vision, text, and NLP models. It works by registering a custom operator library with an ONNX Runtime session, allowing you to build enhanced ONNX models that include these operators and run them end-to-end without leaving the ONNX Runtime inference engine. The package provides Python bindings (plus Java and C# support) and includes utilities to convert Hugging Face transformer data processing classes into ONNX graphs that can be merged with your model.

The typical workflow is to generate or enhance an ONNX model with preprocessing operators, then load it with ONNXRuntime-Extensions registered to handle those custom ops during inference. It supports Windows, macOS, Linux, and mobile platforms like Android and iOS, with compiled wheels available for recent Python versions.

Use it for:

  • Embed tokenization and text normalization directly in ONNX models for end-to-end NLP inference without Python preprocessing.
  • Add image resizing, normalization, and augmentation operators to vision models for deployment without external preprocessing.
  • Convert Hugging Face transformer preprocessing pipelines into ONNX graphs for portable, framework-agnostic model deployment.
  • Build mobile-ready ONNX models with built-in preprocessing for Android and iOS inference.
  • Combine multiple models with standardized pre- and post-processing in a single ONNX graph.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Extends ONNX Runtime with custom operators for pre- and post-processing in vision, text, and NLP models, available as a C/C++ library with Python, Java, and C# bindings.

Yes, if you are building ONNX-based inference pipelines and need to embed preprocessing or postprocessing operators directly in your models. The package is actively maintained, has no known vulnerabilities, and uses a permissive MIT license. Install friction is moderate due to compiled wheels, but prebuilt binaries are available for common platforms and Python versions. Not necessary if you handle all preprocessing in application code before inference.

Install

onnxruntime-extensions on PyPI

pip

pip install onnxruntime-extensions

uv

uv add onnxruntime-extensions

poetry

poetry add onnxruntime-extensions

Installing onnxruntime_extensions

Before you install

Medium install friction due to compiled wheels for multiple Python versions and platforms (cp310–cp313 on macOS and Linux). Repository is actively maintained with recent commits and no archived status.

License in practice

MIT License permits commercial and private use with minimal restrictions; suitable for most production deployments.

Quickstart

pip install onnxruntime-extensions

import onnxruntime as _ort
from onnxruntime_extensions import get_library_path as _lib_path

so = _ort.SessionOptions()
so.register_custom_ops_library(_lib_path())
# sess = _ort.InferenceSession(model, so)

Requires onnxruntime to be installed separately; ONNX package needed for generating pre-/post-processing models.

Verify before relying

  • Whether the package works with all Python versions or only cp310–cp313 as wheel availability suggests.
  • Specific minimum versions of onnxruntime required for compatibility.
  • Performance characteristics or overhead of custom operator registration.

Package facts

License MIT License (permissive)
Python support not specified
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance actively maintained — 191 days since the last release
Last repo commit
First released
Downloads 207,857/month — #9,540 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: onnxruntime_extensions-0.15.2-cp310-cp310-macosx_11_0_arm64.whl; onnxruntime_extensions-0.15.2-cp310-cp310-macosx_11_0_universal2.whl; onnxruntime_extensions-0.15.2-cp310-cp310-macosx_11_0_x86_64.whl; onnxruntime_extensions-0.15.2-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; onnxruntime_extensions-0.15.2-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; onnxruntime_extensions-0.15.2-cp311-cp311-macosx_11_0_arm64.whl; onnxruntime_extensions-0.15.2-cp311-cp311-macosx_11_0_universal2.whl; onnxruntime_extensions-0.15.2-cp311-cp311-macosx_11_0_x86_64.whl; onnxruntime_extensions-0.15.2-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; onnxruntime_extensions-0.15.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; onnxruntime_extensions-0.15.2-cp312-cp312-macosx_11_0_arm64.whl; onnxruntime_extensions-0.15.2-cp312-cp312-macosx_11_0_universal2.whl; onnxruntime_extensions-0.15.2-cp312-cp312-macosx_11_0_x86_64.whl; onnxruntime_extensions-0.15.2-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; onnxruntime_extensions-0.15.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; onnxruntime_extensions-0.15.2-cp313-cp313-macosx_11_0_arm64.whl; onnxruntime_extensions-0.15.2-cp313-cp313-macosx_11_0_universal2.whl; onnxruntime_extensions-0.15.2-cp313-cp313-macosx_11_0_x86_64.whl; onnxruntime_extensions-0.15.2-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; onnxruntime_extensions-0.15.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Development Status :: 4 - BetaEnvironment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIX :: LinuxProgramming Language :: C++Programming Language :: PythonProgramming Language :: Python :: Implementation :: CPython

Tags

onnx runtime custom operatorsonnx model preprocessingvision nlp text processing onnxonnx runtime extensionscustom ops for onnx inferenceonnx model post-processinghuggingface transformer onnx
onnx-inferencemodel-preprocessingcustom-operators

More Artificial Intelligence packages