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

Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v0.5.0

0.4.0

Release Notes : https://github.com/Microsoft/onnxruntime/releases/tag/v0.4.0

0.3.1

Protobuf-lite, NuGet file fixes (patch to 0.3.0).

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.5.0-cp37-cp37m-win_amd64.whl (1.9 MB view details)

Uploaded CPython 3.7m Windows x86-64

onnxruntime-0.5.0-cp37-cp37m-manylinux2010_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

onnxruntime-0.5.0-cp37-cp37m-macosx_10_7_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.7m macOS 10.7+ x86-64

onnxruntime-0.5.0-cp36-cp36m-win_amd64.whl (1.9 MB view details)

Uploaded CPython 3.6m Windows x86-64

onnxruntime-0.5.0-cp36-cp36m-manylinux2010_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

onnxruntime-0.5.0-cp36-cp36m-macosx_10_7_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.6m macOS 10.7+ x86-64

onnxruntime-0.5.0-cp35-cp35m-win_amd64.whl (1.9 MB view details)

Uploaded CPython 3.5m Windows x86-64

onnxruntime-0.5.0-cp35-cp35m-manylinux2010_x86_64.whl (3.2 MB view details)

Uploaded CPython 3.5m manylinux: glibc 2.12+ x86-64

onnxruntime-0.5.0-cp35-cp35m-macosx_10_6_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.5m macOS 10.6+ x86-64

File details

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

File metadata

  • Download URL: onnxruntime-0.5.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 1.9 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.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8

File hashes

Hashes for onnxruntime-0.5.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 c77972deac9a4bac3177e03a4dd6fd373824b9a1730b649622d1d602c5c21fa7
MD5 62a849d5805456aa8751958432bc5c5c
BLAKE2b-256 005d20af72cd7a3d9e816c62b272cc28143b29fac2c44a29fffba5cd7f2756f3

See more details on using hashes here.

File details

Details for the file onnxruntime-0.5.0-cp37-cp37m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: onnxruntime-0.5.0-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 3.2 MB
  • Tags: CPython 3.7m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8

File hashes

Hashes for onnxruntime-0.5.0-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 e23824f4b4cf7d24a8dda36f3692378aeae6de9671a901e4ab5faf78e0a6fdb7
MD5 8ac147d9feffb081da08e6ed12506cb4
BLAKE2b-256 eb94554f91b0b9ced6d4654ec07c92c9848889ccab8dff3d0038a9de4be7b5b7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: onnxruntime-0.5.0-cp37-cp37m-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 2.6 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.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8

File hashes

Hashes for onnxruntime-0.5.0-cp37-cp37m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 ea25baa3c0198bd70367ceab77ead17a5f88fc45459ef90ba39120cb9149d862
MD5 cf602840230c4a6e655175640fad230a
BLAKE2b-256 984a40a8078cafe5b48c0c94853b4e2aa681ee8092f845edf1beba91f5d0a4ac

See more details on using hashes here.

File details

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

File metadata

  • Download URL: onnxruntime-0.5.0-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 1.9 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.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8

File hashes

Hashes for onnxruntime-0.5.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 518d5b5fcf7747885122bd9501922f6b94c3470982aa38c3976f2ab70821d005
MD5 437a5f582552ac09a83439e6f4887e95
BLAKE2b-256 aafee92c22a0f9aff67c04f94e37ac43f0983c91082647b8fb491904bc0b8f52

See more details on using hashes here.

File details

Details for the file onnxruntime-0.5.0-cp36-cp36m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: onnxruntime-0.5.0-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 3.2 MB
  • Tags: CPython 3.6m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8

File hashes

Hashes for onnxruntime-0.5.0-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 0eaf32755a11a40c0fc86d2cb696ff5214d29d6645a0469d300544dc4ff07ce6
MD5 a81484efe1f6acfebe619725bab1a67c
BLAKE2b-256 a1a37d71f481f3632320210676c19c9eb3ac565cf0e98a299883e0cb9324b3d7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: onnxruntime-0.5.0-cp36-cp36m-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 2.6 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.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8

File hashes

Hashes for onnxruntime-0.5.0-cp36-cp36m-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 ea02522a3799d94bceace0da9c1c9ffc1db4d694506a6184afd4c7b8c9e8aaef
MD5 ebaac1751c6432187dbc2ca8b6119c89
BLAKE2b-256 2213f6962a7d3da240656d376688d1e888e4fe3982160a54a0dd74220f3b021f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: onnxruntime-0.5.0-cp35-cp35m-win_amd64.whl
  • Upload date:
  • Size: 1.9 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.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8

File hashes

Hashes for onnxruntime-0.5.0-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 51be73e3c09cff6fcfef504f5f7132cf05a4dcf0eb08acf257b4a71e9a512c28
MD5 d93f886fb60131da59272170f27fff65
BLAKE2b-256 b03f7b9a99a1b2f6f27aff49fc5a4139028c29e0463349dc6509fc2fd3c40f8f

See more details on using hashes here.

File details

Details for the file onnxruntime-0.5.0-cp35-cp35m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: onnxruntime-0.5.0-cp35-cp35m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 3.2 MB
  • Tags: CPython 3.5m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8

File hashes

Hashes for onnxruntime-0.5.0-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 5c610b0d0cc5962a331e820e989fa0aa984cba477c55cb6163608b7d3e04d258
MD5 9f6999ceeb7dba836354d55143fc9c6b
BLAKE2b-256 2a2652b66fcea1a79b1c873df22bc9844895e6b1ef356c5bb7ee4da260af2ad2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: onnxruntime-0.5.0-cp35-cp35m-macosx_10_6_x86_64.whl
  • Upload date:
  • Size: 2.6 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.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8

File hashes

Hashes for onnxruntime-0.5.0-cp35-cp35m-macosx_10_6_x86_64.whl
Algorithm Hash digest
SHA256 a4e9208db338cb2f6e4121a44e50ec8f2a5a4f17ebb9f023cbb27ae31eb3b87f
MD5 b2fc4ebc5a00dbd8e7c9b6e540b062fa
BLAKE2b-256 7757d6a0e0eef6c5d666e17cd395fbe73b60ca9d3f71e433592f6a98d34d22f7

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