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 RandomForestClassifier
iris = load_iris()
X, y = iris.data, iris.target
X_train, X_test, y_train, y_test = train_test_split(X, y)
clr = RandomForestClassifier()
clr.fit(X_train, y_train)

# Convert into ONNX format with onnxmltools
from skl2onnx import convert_sklearn
from skl2onnx.common.data_types import FloatTensorType
initial_type = [('float_input', FloatTensorType([1, 4]))]
onx = convert_sklearn(clr, initial_types=initial_type)
with open("rf_iris.onnx", "wb") as f:
    f.write(onx.SerializeToString())

# 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.2.1

C-API, Linux support for Dotnet Nuget package, Cuda 10.0 support (patch to 0.2.0).

0.2.0

C-API, Linux support for Dotnet Nuget package, Cuda 10.0 support

0.1.5

GA release as part of open sourcing onnxruntime (patch to 0.1.4).

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.2.1

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.2.1
File
onnxruntime-0.2.1-cp37-cp37m-win_amd64.whl CPython 3.7 CPython 3.7 pymalloc Windows x86-64 Details
onnxruntime-0.2.1-cp37-cp37m-manylinux1_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64 Details
onnxruntime-0.2.1-cp37-cp37m-macosx_10_7_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.7+ x86-64 Details
onnxruntime-0.2.1-cp36-cp36m-win_amd64.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-64 Details
onnxruntime-0.2.1-cp36-cp36m-manylinux1_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 Details
onnxruntime-0.2.1-cp36-cp36m-macosx_10_7_x86_64.whl CPython 3.6 CPython 3.6 pymalloc macOS 10.7+ x86-64 Details
onnxruntime-0.2.1-cp35-cp35m-win_amd64.whl CPython 3.5 CPython 3.5 pymalloc Windows x86-64 Details
onnxruntime-0.2.1-cp35-cp35m-manylinux1_x86_64.whl CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64 Details
onnxruntime-0.2.1-cp35-cp35m-macosx_10_6_x86_64.whl CPython 3.5 CPython 3.5 pymalloc macOS 10.6+ x86-64 Details

Total release size: 39.6 MB

Release files / onnxruntime-0.2.1-cp37-cp37m-win_amd64.whl

Download URL onnxruntime-0.2.1-cp37-cp37m-win_amd64.whl
Size 3.2 MB
Tags CPython 3.7 CPython 3.7 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
3d0d588414d4859c63b1c41fac5a56e771f6f4cff0ecece7edb851fe73123b7e
BLAKE2b-256 checksum
How to use checksums
c34967875e00676e89020e9060803e0f8da3b96cf5339608571986deed719de1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.29.1 CPython/3.6.6

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

Download URL onnxruntime-0.2.1-cp37-cp37m-manylinux1_x86_64.whl
Size 5.4 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
f3f1f1185c53a9ea92c10f8bc8ddce6a61dbd9e07fb645cf01c214dc0b4835b6
BLAKE2b-256 checksum
How to use checksums
066e353fc650b3d0fe654ad6e8c4d97251dfb565f64c329463f10e89e92becc9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.29.1 CPython/3.6.6

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

Download URL onnxruntime-0.2.1-cp37-cp37m-macosx_10_7_x86_64.whl
Size 4.5 MB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
c5b8da43b0f197318714f4900fbd37bdb06e17440928a6ef3d3961eb485b0e3e
BLAKE2b-256 checksum
How to use checksums
ecfede7d4143a5921a722aede2cb5c94ad31027d53a88e3de81f9432877d22f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.29.1 CPython/3.6.6

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

Download URL onnxruntime-0.2.1-cp36-cp36m-win_amd64.whl
Size 3.2 MB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
7210b84262a59e354e9feb488f771d6275199907e55687779b6a7d3329b30818
BLAKE2b-256 checksum
How to use checksums
63aa3b611415e3cc713eda51008b241680eb6902243d4f7a82b60ae9c1f1e41a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.29.1 CPython/3.6.6

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

Download URL onnxruntime-0.2.1-cp36-cp36m-manylinux1_x86_64.whl
Size 5.4 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
6abe49111d4ddb1ca37e6c4664ada378b89b4de67a802c9acffcf2b8182f0fc5
BLAKE2b-256 checksum
How to use checksums
742add3cc993dfc41143ea382b43488eab927b71eff2f44e90ada32db9c0a54e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.29.1 CPython/3.6.6

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

Download URL onnxruntime-0.2.1-cp36-cp36m-macosx_10_7_x86_64.whl
Size 4.5 MB
Tags CPython 3.6 CPython 3.6 pymalloc macOS 10.7+ x86-64
SHA-256 checksum
How to use checksums
cedf9ac8a7992b80af60e214053abe9329a9f1dce45af23cc6763a94e14cfbbf
BLAKE2b-256 checksum
How to use checksums
046bbb0c4a5d44e41ebffafaf2c80ca5bbe0f2beb0a99df8b08b30346fa9d692
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.29.1 CPython/3.6.6

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

Download URL onnxruntime-0.2.1-cp35-cp35m-win_amd64.whl
Size 3.2 MB
Tags CPython 3.5 CPython 3.5 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
928cbecdded21706f6e482a1e0602a173245ea52da1d4968fdc8e1df2b7a2ee9
BLAKE2b-256 checksum
How to use checksums
a3095def0d4a0433571c405582d20c3030db86a11cf7f31cd1402efc459b9a99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.29.1 CPython/3.6.6

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

Download URL onnxruntime-0.2.1-cp35-cp35m-manylinux1_x86_64.whl
Size 5.4 MB
Tags CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
075461b99be5f9cf8f2352345cf53c68e72cb2a7403ff65bd3c4c61a298a147f
BLAKE2b-256 checksum
How to use checksums
158496254f8f1ab5f353efc3a57732707bbf459fefdcd49b2eb54c68b9422297
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.29.1 CPython/3.6.6

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

Download URL onnxruntime-0.2.1-cp35-cp35m-macosx_10_6_x86_64.whl
Size 4.5 MB
Tags CPython 3.5 CPython 3.5 pymalloc macOS 10.6+ x86-64
SHA-256 checksum
How to use checksums
dc1d1c8496e70266318ca508d2d84d38de58f5217d05a2438a1317de370f269f
BLAKE2b-256 checksum
How to use checksums
36943865f9e0bed21daa973fa4ac116313850d22fad49d6453b3c30de682d01d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.29.1 CPython/3.6.6

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

This release

0.2.1 This release

9 release files

0.1.4

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