Skip to main content

ONNX Runtime enables high-performance evaluation of trained machine learning (ML) models while keeping resource usage low. Building on Microsoft’s dedication to the Open Neural Network Exchange (ONNX) community, it supports traditional ML models as well as Deep Learning algorithms in the ONNX-ML format. Documentation is available at Python Bindings for ONNX Runtime.

Example

The following example demonstrates an end-to-end example in a very common scenario. A model is trained with scikit-learn but it has to run very fast in a optimized environment. The model is then converted into ONNX format and ONNX Runtime replaces scikit-learn to compute the predictions.

# Train a model.
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForest
iris = load_iris()
X, y = iris.data, iris.target
X_train, X_test, y_train, y_test = train_test_split(X, y)
clr = RandomForest()
clr.fit(X_train, y_train)

# Convert into ONNX format with onnxmltools
from onnxmltools import convert_sklearn
from onnxmltools.utils import save_model
from onnxmltools.convert.common.data_types import FloatTensorType
initial_type = [('float_input', FloatTensorType([1, 4]))]
onx = convert_sklearn(clr, initial_types=initial_type)
save_model(onx, "rf_iris.onnx")

# Compute the prediction with ONNX Runtime
import onnxruntime as rt
import numpy
sess = rt.InferenceSession("rf_iris.onnx")
input_name = sess.get_inputs()[0].name
label_name = sess.get_outputs()[0].name
pred_onx = sess.run([label_name], {input_name: X_test.astype(numpy.float32)})[0]

Changes

0.1.4

GA release as part of open sourcing onnxruntime.

0.1.3

Fixes a crash on machines which do not support AVX instructions.

0.1.2

First release on Ubuntu 16.04 for CPU and GPU with Cuda 9.1 and Cudnn 7.0, supports runtime for deep learning models architecture such as AlexNet, ResNet, XCeption, VGG, Inception, DenseNet, standard linear learner, standard ensemble learners, and transform scaler, imputer.

Release files for onnxruntime 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for onnxruntime 0.1.4
File
onnxruntime-0.1.4-cp37-cp37m-manylinux1_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64 Details
onnxruntime-0.1.4-cp37-cp37m-macosx_10_7_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.7+ x86-64 Details
onnxruntime-0.1.4-cp36-cp36m-win_amd64.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-64 Details
onnxruntime-0.1.4-cp36-cp36m-manylinux1_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 Details
onnxruntime-0.1.4-cp36-cp36m-macosx_10_7_x86_64.whl CPython 3.6 CPython 3.6 pymalloc macOS 10.7+ x86-64 Details
onnxruntime-0.1.4-cp35-cp35m-win_amd64.whl CPython 3.5 CPython 3.5 pymalloc Windows x86-64 Details
onnxruntime-0.1.4-cp35-cp35m-manylinux1_x86_64.whl CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64 Details
onnxruntime-0.1.4-cp35-cp35m-macosx_10_6_x86_64.whl CPython 3.5 CPython 3.5 pymalloc macOS 10.6+ x86-64 Details

Total release size: 31.5 MB

Release files / onnxruntime-0.1.4-cp37-cp37m-manylinux1_x86_64.whl

Download URL onnxruntime-0.1.4-cp37-cp37m-manylinux1_x86_64.whl
Size 4.6 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
865af4ebaddddacfbd0568fede025c75743f3fa9ecb4c925123949d1e13c6069
BLAKE2b-256 checksum
How to use checksums
01fc6c38d9fd8fffc7a433c8d4fadcc9f158c60f9e9efbefe3c554547ef9faf4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/38.5.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.0

Release files / onnxruntime-0.1.4-cp37-cp37m-macosx_10_7_x86_64.whl

Download URL onnxruntime-0.1.4-cp37-cp37m-macosx_10_7_x86_64.whl
Size 4.0 MB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
5e56f9679912f56c30421cb83fe500514719b14019f91f8edecc933674414f93
BLAKE2b-256 checksum
How to use checksums
26849e3b83dd92358215ab1916666ea99c019120776e6f39ade4a3e58cae05a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/38.5.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.0

Release files / onnxruntime-0.1.4-cp36-cp36m-win_amd64.whl

Download URL onnxruntime-0.1.4-cp36-cp36m-win_amd64.whl
Size 2.8 MB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
9752ff961ec2620357771e1c6cba9f55dbb6685a53156cc43f724d33c4bbd53c
BLAKE2b-256 checksum
How to use checksums
ec056412d93525f7197e68392f715fe99250457f69cd9430f0a7480ac6ae7115
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/38.5.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.0

Release files / onnxruntime-0.1.4-cp36-cp36m-manylinux1_x86_64.whl

Download URL onnxruntime-0.1.4-cp36-cp36m-manylinux1_x86_64.whl
Size 4.6 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
2496ed145bcdf197fe1019e4422917bcb8daedbd27bedb70b7465e4be5748e42
BLAKE2b-256 checksum
How to use checksums
7a88ae4c8805218dfe7be90da472a902b1349c1d1bc186e5362edc12b36ce5a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/38.5.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.0

Release files / onnxruntime-0.1.4-cp36-cp36m-macosx_10_7_x86_64.whl

Download URL onnxruntime-0.1.4-cp36-cp36m-macosx_10_7_x86_64.whl
Size 4.0 MB
Tags CPython 3.6 CPython 3.6 pymalloc macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
801f8f68783b5c991fae513d100e264810380f22bd58a235344da1160e21b2ef
BLAKE2b-256 checksum
How to use checksums
77fa131f7c54dc157886606c8c76f7575931eb904bfb6857fb988dca134917bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/38.5.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.0

Release files / onnxruntime-0.1.4-cp35-cp35m-win_amd64.whl

Download URL onnxruntime-0.1.4-cp35-cp35m-win_amd64.whl
Size 2.8 MB
Tags CPython 3.5 CPython 3.5 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
3e60d1784c139b5043936dee7900bd85ad55d5cbd6ed8cb62344af9f6acc890c
BLAKE2b-256 checksum
How to use checksums
20b30738440370077c8af92e12b569eb5f67a7f17642f43f5ee0c0469e1c8b88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/38.5.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.0

Release files / onnxruntime-0.1.4-cp35-cp35m-manylinux1_x86_64.whl

Download URL onnxruntime-0.1.4-cp35-cp35m-manylinux1_x86_64.whl
Size 4.6 MB
Tags CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
030d91fbcade9051c8d74c7937db81e7a2ad499534fb1bc5d03fb68547c4275c
BLAKE2b-256 checksum
How to use checksums
e69739c630134268a29a7c26f5f1c8fd2f7ff089ccee567cb076087ddf1cb6e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/38.5.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.0

Release files / onnxruntime-0.1.4-cp35-cp35m-macosx_10_6_x86_64.whl

Download URL onnxruntime-0.1.4-cp35-cp35m-macosx_10_6_x86_64.whl
Size 4.0 MB
Tags CPython 3.5 CPython 3.5 pymalloc macOS 10.6+ x86-64
SHA-256 checksum
How to use checksums
e26d380f73bbd07600a99e8590412f0010759d8c4894822d00c9d60e6858adf4
BLAKE2b-256 checksum
How to use checksums
40b1f1f5eba0e46fd7531846c0a52fe984170dbf65cb3ebe9360ceb553568acb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/38.5.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.0

Release history Release notifications | RSS feed

1.9.0

20 release files

1.6.0

15 release files

1.5.2

15 release files

1.5.1

15 release files

1.4.0

15 release files

1.3.0

15 release files

1.2.0

12 release files

1.1.2

9 release files

1.1.1

9 release files

1.1.0

9 release files

1.0.0

9 release files

0.5.0

9 release files

0.4.0

9 release files

0.3.0

9 release files

0.2.1

9 release files

This release

0.1.4 This release

8 release files

0.1.3

3 release files

0.1.2

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page