ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
Find a file
tmccrmck 1978b3c953 Add an HTTP server for hosting of ONNX models (#806)
* Simple integration into CMake build system

* Adds vcpkg as a submodule and updates build.py to install hosting dependencies

* Don't create vcpkg executable if already created

* Fixes how CMake finds toolchain file and quick changes to build.py

* Removes setting the CMAKE_TOOLCHAIN_FILE in build.py

* Adds Boost Beast echo server and Boost program_options

* Fixes spacing problem with program_options

* Adds Microsoft headers to all the beast server headers

* Removes CXX 14 from CMake file

* Adds TODO to create configuration class

* Run clang-format on main

* Better exception handling of program_options

* Remove vckpg submodule via ssh

* Add vcpkg as https

* Adds onnxruntime namespace to call classes

* Fixed places where namespaces were anonymous

* Adds a TODO to use the logger

* Moves all setting namespace shortnames outside of onnxruntime namespace

* Add onnxruntime session options to force app to link with it

* Set CMAKE_TOOLCHAIN_FILE in build.py

* Remove whitespace

* Adds initial ONNX Hosting tests (#5)

* Add initial test which is failing linking with no main

* Adds test_main to get hosting tests working

* Deletes useless add_executable line

* Merge changes from upstream

* Enable CI build in Vienna environment

* make hosting_run*.sh executable

* Add boost path in unittest

* Add boost to TEST_INC_DIR

* Add component detection task in ci yaml

* Get tests and hosting to compile with re2 (#7)

* Add finding boost packages before using it in unit tests

* Add predict.proto and build

* Ignore unused parameters in generated code

* Removes std::regex in favor of re2 (#8)

* Removes std::regex in favor of re2

* Adds back find_package in unit tests and fixes regexes

* Adds more negative test cases

* Adding more protos

* Fix google protobuf file path in the cmake file

* Ignore unused parameters for pb generated code

* Updates onnx submodule (#10)

* Remove duplicated lib in link

* Follow Google style guide (#11)

* Google style names
* Adds more 
* Adds an additional namespace
* Fixes header guards to match filepaths

* Consume protobuf

* Unit Test setup

* Json deserialization simple test cases

* Split hosting app to lib and exe for testability

* Add more cases

* Clean up

* Add more comments

* Update namespace and format the cmake files

* Update cmake/external/onnx to checkout 1ec81bc6d49ccae23cd7801515feaadd13082903

* Separate h and cc in http folder

* Clean up hosting application cmake file

* Enable logging and proper initialize the session

* Update const position for GetSession()

* Take latest onnx and onnx-tensorrt

* Creates configuration header file for program_options (#15)

* Sets up PredictRequest callback (#16)

* Init version, porting from prototype, e2e works

* More executor implementation

* Adds function on application startup (#17)

* Attempts to pass HostingEnvironment as a shared_ptr

* Removes logging and environment from all http classes

* Passes http details to OnStart function

* Using full protobuf for hosting app build

* MLValue2TensorProto

* Revert back changes in inference_session.cc

* Refactor logger access and predict handler

* Create an error handling callback (#19)

* Creates error callback

* Logs error and returns back as JSON

* Catches exceptions in user functions

* Refactor executor and add some test cases

* Fix build warning

* Add onnx as a dependency and in includes to hosting app (#20)

* Converter for specific types and more UTs

* More unit tests

* Update onnx submodule

* Fix string data test

* Clean up code

* Cleanup code

* Refactor logging to use unique id per request and take logging level from user (#21)

* Removes capturing env by reference in main

* Uses uuid for logging ids

* Take logging_level as a program argument

* Pass logging_level to default_logging_manager

* Change name of logger to HostingApp

* Log if request id is null

* Update GetHttpStatusCode signature

* Fix random result issue and camel-case names

* Rollback accidentally changed pybin_state.cc

* Rollback pybind_state.cc

* Generate protobuf status from onnxruntime status

* Fix function name in error message

* Clean up comments

* Support protobuf byte array as input

* Refactor predict handler and add unit tests

* Add one more test

* update cmake/external/onnx

* Accept more protobuf MIME types

* Update onnx-tensorrt

* Add build instruction and usage doc

* Address PR comments

* Install g++-7 in the Ubuntu 16.04 build image for vcpkg

* Fix onnx-tensorrt version

* Check return value during initialization

* Fix infinite loop when http port is in use (#29)

* Simplify Executor.cc by breaking up Run method (#27)

* Move request id to Executor constructor

* Refactor the logger to respect user verbosity level

* Use Arena allocator instead of device

* Creates initial executor tests

* Merge upstream master (#31)

* Remove all possible shared_ptrs (#30)

* Changes GetLogger to unique_ptr

* Reserve BFloat raw data vector size

* Change HostingEnvironment to being passed by lvalue and rvalue references

* Change routes to getting passed by const references

* Enable full protobuf if building hosting (#32)

* Building hosting application no longer needs use_full_protobuf flag

* Improve hosting application docs

* Move server core into separate folder (#34)

* Turn hosting project off by default (#38)

* Remove vcpkg as a submodule and download/install Boost from source (#39)

* Remove vcpkg

* Use CMake script to download and build Boost as part of the project

* Remove std::move for const references

* Remove error_code.proto

* Change wording of executable help description

* Better GenerateProtobufStatus description

* Remove error_code protobuf from CMake files

* Use all outputs if no filter is given

* Pass MLValue by const reference in MLValueToTensorProto

* Rename variables to argc and argv

* Revert "Use all outputs if no filter is given"

This reverts commit 7554190ab8e50ba6947648c2f3e2a3d4d9606ce0.

* Remove all header guards in favor of #pragma once

* Reserve size for output vector and optimize for-loop

* Use static libs by default for Boost

* Improves documentation for GenerateResponseInJson function

* Start Result enum at 0 instead of 1

* Remove g++ from Ubuntu's install.sh

* Update cmake files

* Give explanation for Result enum type

* Remove all program options shortcuts except for -h

* Add comments for predict.proto

* Fix JSON for error codes

* Add notice on hosting application docs that it's in beta

* Change HostingEnvironment back to a shared_ptr

* Handle empty output_filter field

* Fix build break

* Refactor unit tests location and groups

* First end-to-end test

* Add missing log

* Missing req id and client req id in error response

* Add one test case to validate failed resp header

* Add build flag for hosting app end to end tests

* Update pipeline setup to run e2e test for CI build

* Model Zoo data preparation and tests

* Add protobuf tests

* Remove mention of needing g++-7 in BUILD.md

* Make GetAppLogger const

* Make using_raw_data_ match the styling of other fields

* Avoid copy of strings when initializing model

* Escape JSON strings correctly for error messages (#44)

* Escape JSON strings correctly

* Add test examples with lots of carriage returns

* Add result validation

* Remove temporary path

* Optimize model zoo test execution

* Improve reliability of test cases

* Generate _pb2.py during the build time

* README for integration tests

* Pass environment by pointer instead of shared_ptr to executor (#49)

* More Integration tests

* Remove generated files

* Make session private and use a getter instead (#53)

* logging_level to log_level for CLI

* Single model prediction shortcut

* Health endpoint

* Integration tests

* Rename to onnxruntime server

* Build ONNX Server application on Windows (#57)

* Gets Boost compiling on Windows

* Fix integer conversion and comparison problems

* Use size_t in converter_tests instead of int

* Fix hosting integration tests on Windows

* Removes checks for port because it's an unsigned short

* Fixes comparison between signed and unsigned data types

* Pip install protobuf and numpy

* Missing test data from the rename change

* Fix server app path (#58)

* Pass shared_ptr by const reference to avoid ref count increase (#59)

* Download test model during test setup

* Make download into test_util

* Rename ci pipeline for onnx runtime server

*  Support up to 10MiB http request (#61)

* Changes minimum request size to 10MB to support all models in ONNX Model Zoo
2019-04-30 18:21:23 -07:00
.github/ISSUE_TEMPLATE Fix C-API sample. Update Issue template. (#750) 2019-04-02 13:37:50 -07:00
cmake Add an HTTP server for hosting of ONNX models (#806) 2019-04-30 18:21:23 -07:00
csharp Add link to build within Nuget package (#926) 2019-04-27 13:41:20 -07:00
dockerfiles ng ep update1 (#895) 2019-04-24 10:35:26 -07:00
docs Add an HTTP server for hosting of ONNX models (#806) 2019-04-30 18:21:23 -07:00
include/onnxruntime/core Convert constant folding to a transformer (#866) 2019-04-29 18:12:49 -07:00
onnxruntime Add an HTTP server for hosting of ONNX models (#806) 2019-04-30 18:21:23 -07:00
package/rpm bump version number for release (#911) 2019-04-26 16:28:16 -07:00
tools Add an HTTP server for hosting of ONNX models (#806) 2019-04-30 18:21:23 -07:00
.clang-format Initial bootstrap commit. 2018-11-19 16:48:22 -08:00
.clang-tidy Add remaining build options and make minor changes in documentation (#39) 2018-11-27 19:59:40 -08:00
.gitattributes Initial bootstrap commit. 2018-11-19 16:48:22 -08:00
.gitignore Add an HTTP server for hosting of ONNX models (#806) 2019-04-30 18:21:23 -07:00
.gitmodules Convert eigen to a submodule and update it to the latest version 2019-04-18 21:24:56 -07:00
build.amd64.1411.bat Initial bootstrap commit. 2018-11-19 16:48:22 -08:00
build.bat Initial bootstrap commit. 2018-11-19 16:48:22 -08:00
BUILD.md Add an HTTP server for hosting of ONNX models (#806) 2019-04-30 18:21:23 -07:00
build.sh update 2019-01-09 15:49:27 -08:00
cgmanifest.json Bump up onnx version (#936) 2019-04-30 08:44:32 -07:00
CODEOWNERS Fix codeowners file 2018-11-27 23:42:17 -08:00
CONTRIBUTING.md Miscellaneous fixes (#123) 2018-12-06 22:21:04 -08:00
LICENSE Initial bootstrap commit. 2018-11-19 16:48:22 -08:00
README.md Add locale configuration doc. 2019-04-27 21:16:49 -07:00
rename_manylinux.sh Bug bash (#43) 2018-11-27 18:52:50 -08:00
requirements-dev.txt Initial bootstrap commit. 2018-11-19 16:48:22 -08:00
requirements-doc.txt Update the documentation, run all examples during the generation of the documentation (replace #89) (#103) 2018-12-05 10:12:25 -08:00
requirements.txt Initial bootstrap commit. 2018-11-19 16:48:22 -08:00
setup.py Add nGraph Execution Provider (#832) 2019-04-20 17:02:35 -07:00
TensorRT-ExecutionProvider.md Build details for TensorRT execution provider. (#632) 2019-03-15 11:29:00 -07:00
ThirdPartyNotices.txt Add nGraph Execution Provider (#832) 2019-04-20 17:02:35 -07:00
VERSION_NUMBER bump version number for release (#911) 2019-04-26 16:28:16 -07:00

Build Status Build Status Build Status Build Status Build Status

ONNX Runtime is an open-source scoring engine for Open Neural Network Exchange (ONNX) models.

ONNX is an open format for machine learning (ML) models that is supported by various ML and DNN frameworks and tools. This format makes it easier to interoperate between frameworks and to maximize the reach of your hardware optimization investments. Learn more about ONNX on https://onnx.ai or view the Github Repo.

Why use ONNX Runtime

ONNX Runtime has an open architecture that is continually evolving to address the newest developments and challenges in AI and Deep Learning. ONNX Runtime stays up to date with the ONNX standard, supporting all ONNX releases with future compatibliity and maintaining backwards compatibility with prior releases.

ONNX Runtime continuously strives to provide top performance for a broad and growing number of usage scenarios in Machine Learning. Our investments focus on:

  1. Run any ONNX model
  2. High performance
  3. Cross platform

Run any ONNX model

Alignment with ONNX Releases

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. See ONNX version release details here.

As of May 2019, ONNX Runtime supports ONNX 1.5 (opset10). See this table for details on ONNX Runtime and ONNX versioning compatibility,

Traditional ML support

ONNX Runtime fully supports the ONNX-ML profile of the ONNX spec for traditional ML scenarios.

High Performance

ONNX Runtime supports both CPU and GPU hardware through a variety of execution providers. With a variety of graph optimizations and accelerators, ONNX Runtime often provides lower latency and higher efficiency compared to other runtimes. This provides faster end-to-end customer experiences and lower costs from improved machine utilization.

Currently ONNX Runtime supports CUDA, TensorRT, MLAS (Microsoft Linear Algebra Subprograms), MKL-DNN, MKL-ML, and nGraph for computation acceleration. See more details on available build options here.

We are continuously working to integrate new execution providers to provide improvements in latency and efficiency. If you are interested in contributing a new execution provider, please see this page.

Cross Platform

ONNX Runtime offers:

  • APIs for Python, C#, and C
  • Available for Linux, Windows, and Mac

See API documentation and package installation instructions below.

We have ongoing investments to make ONNX Runtime compatible with more platforms and architectures. If you have specific scenarios that are not currently supported, please share your suggestions via Github Issues.

Getting Started

ONNX models:

  • Check out the ONNX Model Zoo for ready-to-use pre-trained models.
  • To get an ONNX model by exporting from various frameworks, see ONNX Tutorials.

Once you have an ONNX model, you can install the runtime for your machine to try it out. There is also an ONNX-Ecosystem Docker container available and ready for use with the Python API.

One easy way to deploy the model on the cloud is by using Azure Machine Learning. See detailed instructions and sample notebooks.

Installation

System Requirements

  • ONNX Runtime binaries in CPU packages use OpenMP and depends on the library being available at runtime in the system.
    • For Windows, OpenMP support comes as part of VC runtime. It is also available as redist packages: vc_redist.x64.exe and vc_redist.x86.exe
    • For Linux, the system must have the libgomp.so.1 which can be installed using apt-get install libgomp1.
  • The official GPU builds require the CUDA 9.1 and cuDNN 7.1 runtime libraries being installed in the system.
  • Python binaries are compatible with Python 3.5-3.7.
  • Certain operators makes use of system locales. At the very least you will need to install English language package and configure en_US.UTF-8 locale.
    • For Ubuntu install language-pack-en package
    • Run the following commands:
      • locale-gen en_US.UTF-8
      • update-locale LANG=en_US.UTF-8
    • Follow similar procedure to configure other locales on other platforms.

APIs and Official Builds

API Documentation CPU package GPU package
Python Available on Pypi
  • Windows: x64
  • Linux: x64
  • Mac OS X: x64

Available on Pypi
  • Windows: x64
  • Linux: x64


C# Available on Nuget : MLAS+Eigen, MKL-ML
  • Windows: x64
  • Linux: x64
  • Mac OS X: x64 (MLAS+Eigen only)
Available on Nuget
  • Windows: x64
  • Linux: x64

C Available on Nuget : MLAS+Eigen, MKL-ML
  • Windows: x64
  • Linux: x64
  • Mac OS X: x64 (MLAS+Eigen only)

Files (.zip, .tgz)
  • Windows: x64, x86
  • Linux: x64, x86
  • Mac OS X: x64 (MLAS+Eigen only)
Available on Nuget
  • Windows: x64
  • Linux: x64


Files (.zip, .tgz)
  • Windows: x64
  • Linux: x64

C++ Build from source Build from source

For builds using other execution providers, see Build Details below.

Build Details

For details on the build configurations and information on how to create a build, see Build ONNX Runtime.

Versioning

See more details on API and ABI Versioning and ONNX Compatibility in Versioning.

Design and Key Features

For an overview of the high level architecture and key decisions in the technical design of ONNX Runtime, see Engineering Design.

ONNX Runtime is built with an extensible design that makes it versatile to support a wide array of models with high performance.

Contribute

We welcome your contributions! Please see the contribution guidelines.

Feedback

For any feedback or to report a bug, please file a GitHub Issue.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

License

MIT License