Skip to main content

ONNX Runtime 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 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.

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.1.4-cp37-cp37m-manylinux1_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.7m

onnxruntime-0.1.4-cp37-cp37m-macosx_10_7_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.7m macOS 10.7+ x86-64

onnxruntime-0.1.4-cp36-cp36m-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.6m Windows x86-64

onnxruntime-0.1.4-cp36-cp36m-manylinux1_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.6m

onnxruntime-0.1.4-cp36-cp36m-macosx_10_7_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.6m macOS 10.7+ x86-64

onnxruntime-0.1.4-cp35-cp35m-win_amd64.whl (2.8 MB view details)

Uploaded CPython 3.5m Windows x86-64

onnxruntime-0.1.4-cp35-cp35m-manylinux1_x86_64.whl (4.6 MB view details)

Uploaded CPython 3.5m

onnxruntime-0.1.4-cp35-cp35m-macosx_10_6_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.5m macOS 10.6+ x86-64

File details

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

File metadata

  • Download URL: onnxruntime-0.1.4-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 4.6 MB
  • Tags: CPython 3.7m
  • Uploaded using 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

File hashes

Hashes for onnxruntime-0.1.4-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 865af4ebaddddacfbd0568fede025c75743f3fa9ecb4c925123949d1e13c6069
MD5 4115fd79c68ce3b4c1ac6b3bbdf72872
BLAKE2b-256 01fc6c38d9fd8fffc7a433c8d4fadcc9f158c60f9e9efbefe3c554547ef9faf4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: onnxruntime-0.1.4-cp37-cp37m-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 4.0 MB
  • Tags: CPython 3.7m, macOS 10.7+ x86-64
  • Uploaded using 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

File hashes

Hashes for onnxruntime-0.1.4-cp37-cp37m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 5e56f9679912f56c30421cb83fe500514719b14019f91f8edecc933674414f93
MD5 4624a212d3337d6c193dcfc8199bf569
BLAKE2b-256 26849e3b83dd92358215ab1916666ea99c019120776e6f39ade4a3e58cae05a3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: onnxruntime-0.1.4-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 2.8 MB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using 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

File hashes

Hashes for onnxruntime-0.1.4-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 9752ff961ec2620357771e1c6cba9f55dbb6685a53156cc43f724d33c4bbd53c
MD5 c55b80de02068fdb642cae8da39ba382
BLAKE2b-256 ec056412d93525f7197e68392f715fe99250457f69cd9430f0a7480ac6ae7115

See more details on using hashes here.

File details

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

File metadata

  • Download URL: onnxruntime-0.1.4-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 4.6 MB
  • Tags: CPython 3.6m
  • Uploaded using 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

File hashes

Hashes for onnxruntime-0.1.4-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 2496ed145bcdf197fe1019e4422917bcb8daedbd27bedb70b7465e4be5748e42
MD5 4265345ef3e527a3e0333573ac25e3fc
BLAKE2b-256 7a88ae4c8805218dfe7be90da472a902b1349c1d1bc186e5362edc12b36ce5a2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: onnxruntime-0.1.4-cp36-cp36m-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 4.0 MB
  • Tags: CPython 3.6m, macOS 10.7+ x86-64
  • Uploaded using 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

File hashes

Hashes for onnxruntime-0.1.4-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 801f8f68783b5c991fae513d100e264810380f22bd58a235344da1160e21b2ef
MD5 3884a6b2d4674a8a424ebc826cf54f71
BLAKE2b-256 77fa131f7c54dc157886606c8c76f7575931eb904bfb6857fb988dca134917bf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: onnxruntime-0.1.4-cp35-cp35m-win_amd64.whl
  • Upload date:
  • Size: 2.8 MB
  • Tags: CPython 3.5m, Windows x86-64
  • Uploaded using 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

File hashes

Hashes for onnxruntime-0.1.4-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 3e60d1784c139b5043936dee7900bd85ad55d5cbd6ed8cb62344af9f6acc890c
MD5 036224cb68b4eaf8cb3cdd68fc3d0308
BLAKE2b-256 20b30738440370077c8af92e12b569eb5f67a7f17642f43f5ee0c0469e1c8b88

See more details on using hashes here.

File details

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

File metadata

  • Download URL: onnxruntime-0.1.4-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 4.6 MB
  • Tags: CPython 3.5m
  • Uploaded using 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

File hashes

Hashes for onnxruntime-0.1.4-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 030d91fbcade9051c8d74c7937db81e7a2ad499534fb1bc5d03fb68547c4275c
MD5 0ab3874d5f5749be31b9584baa9edd95
BLAKE2b-256 e69739c630134268a29a7c26f5f1c8fd2f7ff089ccee567cb076087ddf1cb6e0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: onnxruntime-0.1.4-cp35-cp35m-macosx_10_6_x86_64.whl
  • Upload date:
  • Size: 4.0 MB
  • Tags: CPython 3.5m, macOS 10.6+ x86-64
  • Uploaded using 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

File hashes

Hashes for onnxruntime-0.1.4-cp35-cp35m-macosx_10_6_x86_64.whl
Algorithm Hash digest
SHA256 e26d380f73bbd07600a99e8590412f0010759d8c4894822d00c9d60e6858adf4
MD5 0cdc22970dec3af1335b04872ac394eb
BLAKE2b-256 40b1f1f5eba0e46fd7531846c0a52fe984170dbf65cb3ebe9360ceb553568acb

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