ONNX Runtime is a performance-focused inference engine for ONNX (Open Neural Network Exchange) models.
Models in the Tensorflow, Keras, PyTorch, scikit-learn, CoreML, and other popular supported formats can be converted to the standard ONNX format, providing framework interoperability and helping to maximize the reach of hardware optimization investments. This provides a solution for systems to integrate a single inference engine to support models trained from a variety of frameworks, while taking advantage of specific hardware accelerators where available.
ONNX Runtime was designed with a focus on performance and scalability in order to support heavy workloads in high-scale production scenarios. It also has extensibility options for compatibility with emerging hardware developments.
ONNX Runtime stays up to date with the ONNX standard and supports all operators from the ONNX v1.2+ spec and is backwards compatible with older versions. Please refer to this page for ONNX opset compatibility details.
Table of Contents
- Functional Overview
- Contributions and Feedback
- Cross Platform: The runtime provides a cross platform API compatible with Windows, Linux, and Mac and a variety of architectures. Both CPU and GPUs are supported, and language bindings are available for a variety of languages and architectures See more details (below). If you have specific scenarios that are not supported, please share your suggestions and scenario details via Github Issues.
- Run any ONNX model: ONNX Runtime provides comprehensive support of the ONNX spec and can be used to run all models based on ONNX v1.2.1 and higher. Both ONNX (DNN) and ONNX-ML (traditional ML) operator sets are supported. The full set of operators and types supported is listed here. Some operators not supported in the current ONNX version may be available as a Contrib Operator.
- Backwards Compatible: Newer versions of ONNX Runtime support all models that worked with prior versions, so updates should not break integrations. See version compatibility details here.
Performance Focused Design
Using various graph optimizations and accelerators, ONNX Runtime can provide lower latency compared to other runtimes for faster end-to-end customer experiences and minimized machine utilization costs. See Performance Tuning guidance.
The list of currently supported accelerators (termed Execution Providers) is below. Please see BUILD.md for build instructions. If you are interested in contributing a new execution provider, please see this page.
- Default CPU - MLAS (Microsoft Linear Algebra Subprograms) + Eigen
- Intel DNNL
- Intel nGraph
- Intel MKL-ML
- Add a custom operator/kernel
- Add a new graph transform
- Add a new rewrite rule
- Add an execution provider
Quick Start: The ONNX-Ecosystem Docker container image is available on Dockerhub and includes ONNX Runtime (CPU, Python), dependencies, tools to convert from various frameworks, and Jupyter notebooks to help get started. Additional dockerfiles can be found here.
|Python||3.5, 3.6, 3.7
Python Dev Notes
|Ruby (external project)||2.4-2.7||Samples|
Builds and Packages
Official builds are published for the default CPU Provider (Eigen + MLAS), as well as GPU with CUDA. Python packages can be found on PyPi, and C#/C/C++ packages on Nuget. Please view the table on aka.ms/onnxruntime for instructions for different build combinations.
pip to download the Python binaries, run
pip install --upgrade pip prior to downloading.
Other package repositories:
Contributed non-official packages (including Homebrew, Linuxbrew, and nixpkgs) are listed here. These are not maintained by the core ONNX Runtime team and will have limited support; use at your discretion.
These system requirements must be met for using the compiled binaries.
- Installation of the English language package and configuring
en_US.UTF-8 localeis required, as certain operators makes use of system locales.
- For Ubuntu, install language-pack-en package
- Run the following commands:
- Follow similar procedure to configure other locales on other platforms.
- Run the following commands:
- ONNX Runtime binaries in the CPU packages use OpenMP and depend on the library being available at runtime in the system.
Default GPU (CUDA)
- The default GPU build requires CUDA runtime libraries being installed on the system:
- Version: CUDA 10.1 and cuDNN 7.6.5
- Version dependencies from older ONNX Runtime releases can be found in prior release notes.
Other Execution Providers
- For requirements and dependencies of other build options, see detailed build instructions on the BUILD.md page.
Please see Samples and Tutorials for examples.
Getting ONNX Models
Deploying ONNX Runtime
ONNX Runtime Server (beta) is a hosted application for serving ONNX models using ONNX Runtime, providing a REST API for prediction. Usage details can be found here, and image installation instructions are here.
IoT and edge devices
The expanding focus and selection of IoT devices with sensors and consistent signal streams introduces new opportunities to move AI workloads to the edge.
This is particularly important when there are massive volumes of incoming data/signals that may not be efficient or useful to push to the cloud due to storage or latency considerations. Consider: surveillance tapes where 99% of footage is uneventful, or real-time person detection scenarios where immediate action is required. In these scenarios, directly executing model inferencing on the target device is crucial for optimal assistance.
To deploy AI workloads to these edge devices and take advantage of hardware acceleration capabilities on the target device, see these reference implementations.
On newer Windows 10 devices (1809+), ONNX Runtime is available by default as part of the OS and is accessible via the Windows Machine Learning APIs. Find tutorials here for building a Windows Desktop or UWP application using WinML.
This project may collect usage data and send it to Microsoft to help improve our products and services. See the privacy statement for more details.
We welcome contributions! Please see the contribution guidelines.
For any feedback or to report a bug, please file a GitHub Issue.