Skip to main content

ONNX Runtime Python bindings

Project description

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

C-API, Linux support for Dotnet Nuget package, Cuda 9.1 support.

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

onnxruntime-0.3.0-cp37-cp37m-win_amd64.whl (2.1 MB view details)

Uploaded CPython 3.7m Windows x86-64

onnxruntime-0.3.0-cp37-cp37m-manylinux1_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.7m

onnxruntime-0.3.0-cp37-cp37m-macosx_10_7_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.7m macOS 10.7+ x86-64

onnxruntime-0.3.0-cp36-cp36m-win_amd64.whl (2.1 MB view details)

Uploaded CPython 3.6m Windows x86-64

onnxruntime-0.3.0-cp36-cp36m-manylinux1_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.6m

onnxruntime-0.3.0-cp36-cp36m-macosx_10_7_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.6m macOS 10.7+ x86-64

onnxruntime-0.3.0-cp35-cp35m-win_amd64.whl (2.1 MB view details)

Uploaded CPython 3.5m Windows x86-64

onnxruntime-0.3.0-cp35-cp35m-manylinux1_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.5m

onnxruntime-0.3.0-cp35-cp35m-macosx_10_6_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.5m macOS 10.6+ x86-64

File details

Details for the file onnxruntime-0.3.0-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: onnxruntime-0.3.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 2.1 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for onnxruntime-0.3.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 0e7d9f13a5bf028094431c31e02624b9f21f91bce02382d77ffaac0a69dd992f
MD5 4365efa66fc3897fb7c4b53577051f27
BLAKE2b-256 b93fdbb5cebea90480407491918cbd00ffa45a1532ce192cca9e849f2acf8378

See more details on using hashes here.

File details

Details for the file onnxruntime-0.3.0-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: onnxruntime-0.3.0-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for onnxruntime-0.3.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 9e55cc18ef0f2d75867e9315f4801d43f043befe6621ac4efbe342cb9a9898bd
MD5 9c7276998b3befeb319893082ed950c0
BLAKE2b-256 ec9a90d8f93ec5865a3b756d23ed5e43d0affe2483711cca816067a4592dff29

See more details on using hashes here.

File details

Details for the file onnxruntime-0.3.0-cp37-cp37m-macosx_10_7_x86_64.whl.

File metadata

  • Download URL: onnxruntime-0.3.0-cp37-cp37m-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: CPython 3.7m, macOS 10.7+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for onnxruntime-0.3.0-cp37-cp37m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 8826bc4abb024feff15c4ed667f33e5d8141337156a3b29477739bd78127cf0f
MD5 aab21ae3d250c24fd0b1237d562f1b1a
BLAKE2b-256 5e77814612caac4c7c69c3458fb3bf70f4c31ec9420876c66a174b3f27183805

See more details on using hashes here.

File details

Details for the file onnxruntime-0.3.0-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: onnxruntime-0.3.0-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 2.1 MB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for onnxruntime-0.3.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 0d360de4ecd5d8045fd33b26d45567e99ba39b201f8be8107e902d761ed3f2e7
MD5 c9cf960762fc2546cefe6724e9afca6a
BLAKE2b-256 bb742c8a7d4ef6549525599c661a1cc0d95ec5523e35812258ad981446aa0815

See more details on using hashes here.

File details

Details for the file onnxruntime-0.3.0-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: onnxruntime-0.3.0-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for onnxruntime-0.3.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 117e1e5b40593407bebab619dded59d69c8bad407cec04bbce34dc5e91f3ab50
MD5 30733751d709afecdc21b4a428ca8bae
BLAKE2b-256 0da7dcec3fce9709492e3b5ea8b0dbda5a343bafab2adced2b001a14ce3bdd8f

See more details on using hashes here.

File details

Details for the file onnxruntime-0.3.0-cp36-cp36m-macosx_10_7_x86_64.whl.

File metadata

  • Download URL: onnxruntime-0.3.0-cp36-cp36m-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: CPython 3.6m, macOS 10.7+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for onnxruntime-0.3.0-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 e14c783ac59870be1e46dfa9b890fc4890c5dd7079da48928a24b0b9f5c7903a
MD5 190544dd63118484a8ccdb071f7493b9
BLAKE2b-256 5be5fc53bd8861219f4b46a1b43d3b1fac2e8694610e425eb81e053c5598ff14

See more details on using hashes here.

File details

Details for the file onnxruntime-0.3.0-cp35-cp35m-win_amd64.whl.

File metadata

  • Download URL: onnxruntime-0.3.0-cp35-cp35m-win_amd64.whl
  • Upload date:
  • Size: 2.1 MB
  • Tags: CPython 3.5m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for onnxruntime-0.3.0-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 e0bbb1f4500e31966c6f11486db81851332b1419202631637c2a8709355bf1fd
MD5 fa5c62f5a1eb023b6197b3ae4a41bf0d
BLAKE2b-256 fbfc3e946df70a8b00eca339d7f6387ac07deb2da90e84ce502573b5744811c0

See more details on using hashes here.

File details

Details for the file onnxruntime-0.3.0-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

  • Download URL: onnxruntime-0.3.0-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for onnxruntime-0.3.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 27f6e9e2d36f8ba3be4f65ee3b34720d0dd5394a7c66c87aa871028fc2863d5b
MD5 96155e214c9baadb63d777ab18bebb6a
BLAKE2b-256 1a04439221d2aab4ff54923a97891240bce4856495a4de2459099b5a7a1de7b2

See more details on using hashes here.

File details

Details for the file onnxruntime-0.3.0-cp35-cp35m-macosx_10_6_x86_64.whl.

File metadata

  • Download URL: onnxruntime-0.3.0-cp35-cp35m-macosx_10_6_x86_64.whl
  • Upload date:
  • Size: 3.0 MB
  • Tags: CPython 3.5m, macOS 10.6+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for onnxruntime-0.3.0-cp35-cp35m-macosx_10_6_x86_64.whl
Algorithm Hash digest
SHA256 05386d8f88b6485067f40fcbf7343fe869e49af63edce573ebfbe64b4d3fd5a4
MD5 89ef9dd7df2f18548627793cff28e214
BLAKE2b-256 d43190d91aec62b6df3352bfa1b978e3d61a76b50f09109a4e7adaebf7c41d56

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page