Skip to content

Commit

Permalink
Merge branch 'MaanavD-website_revamp_final' into gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
MaanavD committed Sep 26, 2023
2 parents 3b3adec + f3fa223 commit e2309cd
Show file tree
Hide file tree
Showing 27 changed files with 848 additions and 234 deletions.
2 changes: 1 addition & 1 deletion docs/build/eps.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ See more information on the OpenVINO™ Execution Provider [here](../execution-p

Follow [documentation](https://docs.openvino.ai/2023.0/index.html) for detailed instructions.

*2023.0 is the recommended OpenVINO™ version. [OpenVINO™ 2022.1](https://docs.openvino.ai/2022.1/index.html) is minimal OpenVINO™ version requirement.*
*2023.0 is the recommended OpenVINO™ version. [OpenVINO™ 2022.1](https://docs.openvino.ai/archive/2022.1/index.html) is minimal OpenVINO™ version requirement.*
*The minimum ubuntu version to support 2023.0 is 18.04.*

2. Configure the target hardware with specific follow on instructions:
Expand Down
7 changes: 6 additions & 1 deletion docs/build/web.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ This support is added/removed by appending the following flags to the build comm

ONNX Runtime Web can be built with WebGPU support via JavaScript Execution Provider (JSEP). To build with JSEP support, use flag `--use_jsep`.

A complete build for ONNX runtime WebAssembly artifacts will contain 6 ".wasm" files (ON/OFF configurations of the flags in the table above) with a few ".js" files.
ONNX Runtime Web can also be built to support the training APIs. To build with training APIs included, use the flag `--enable-training-apis`.

A complete build for ONNX runtime WebAssembly artifacts will contain 7 ".wasm" files (ON/OFF configurations of the flags in the table above) with a few ".js" files.
The build command below should be run for each of the configurations.

in `<ORT_ROOT>/`, run one of the following commands to build WebAssembly:
Expand Down Expand Up @@ -106,6 +108,7 @@ A full list of required build artifacts:
| ort-wasm-simd.wasm | ort-wasm-simd.jsep.wasm | `--use_jsep` `--enable_wasm_simd` |
| ort-wasm-simd-threaded.js | ort-wasm-simd-threaded.jsep.js | `--use_jsep` `--enable_wasm_simd` `--enable_wasm_threads` |
| ort-wasm-simd-threaded.wasm | ort-wasm-simd-threaded.jsep.wasm | `--use_jsep` `--enable_wasm_simd` `--enable_wasm_threads` |
| ort-training-wasm-simd.wasm | | `--enable_wasm_simd` `--enable_training_apis` |

NOTE: WebGPU is currently supported as experimental feature for ONNX Runtime Web. The build instructions may change. Please make sure to refer to latest documents from [this gist](https://gist.github.com/fs-eire/a55b2c7e10a6864b9602c279b8b75dce) for a detailed build/consume instruction for ORT Web WebGpu.

Expand Down Expand Up @@ -184,6 +187,7 @@ This is the last stage in the build process, please follow the sections in a seq
* ort-wasm-simd-threaded.wasm (build with flags `--enable_wasm_threads --enable_wasm_simd`)
* ort-wasm-simd.jsep.wasm (renamed from file `ort-wasm-simd.wasm`, build with flags `--use_jsep --enable_wasm_simd`)
* ort-wasm-simd-threaded.jsep.wasm (renamed from file `ort-wasm-simd-threaded.wasm`, build with flags `--use_jsep --enable_wasm_simd --enable_wasm_threads`)
* ort-training-wasm-simd.wasm (build with flags `--enable_wasm_simd --enable_training_apis`)

3. Copy following files from build output folder to `<ORT_ROOT>/js/web/lib/wasm/binding/`:

Expand All @@ -192,6 +196,7 @@ This is the last stage in the build process, please follow the sections in a seq
* ort-wasm-threaded.worker.js (build with flag `--enable_wasm_threads`)
* ort-wasm-simd.jsep.js (renamed from file `ort-wasm-simd.js`, build with flags `--use_jsep --enable_wasm_simd`)
* ort-wasm-simd-threaded.jsep.js (renamed from file `ort-wasm-simd-threaded.js`, build with flags `--use_jsep --enable_wasm_simd --enable_wasm_threads`)
* ort-training-wasm-simd.js (build with flags `--enable_wasm_simd --enable_training_apis`)

### Finalizing onnxruntime build

Expand Down
2 changes: 1 addition & 1 deletion docs/ecosystem/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ONNX Runtime functions as part of an ecosystem of tools and platforms to deliver
* [Azure Container Instance: Facial Expression Recognition](https://github.com/Azure/MachineLearningNotebooks/blob/master/how-to-use-azureml/deployment/onnx/onnx-inference-facial-expression-recognition-deploy.ipynb){:target="_blank"}
* [Azure Container Instance: MNIST](https://github.com/Azure/MachineLearningNotebooks/blob/master/how-to-use-azureml/deployment/onnx/onnx-inference-mnist-deploy.ipynb){:target="_blank"}
* [Azure Container Instance: Image classification (Resnet)](https://github.com/Azure/MachineLearningNotebooks/blob/master/how-to-use-azureml/deployment/onnx/onnx-modelzoo-aml-deploy-resnet50.ipynb){:target="_blank"}
* [Azure Kubernetes Services: FER+](https://github.com/microsoft/onnxruntime/blob/main/docs/python/inference/notebooks/onnx-inference-byoc-gpu-cpu-aks.ipynb){:target="_blank"}
* [Azure Kubernetes Services: FER+](https://github.com/microsoft/onnxruntime/blob/main/docs/python/notebooks/onnx-inference-byoc-gpu-cpu-aks.ipynb){:target="_blank"}
* [Azure IoT Sedge (Intel UP2 device with OpenVINO)](https://github.com/Azure-Samples/onnxruntime-iot-edge/blob/master/AzureML-OpenVINO/README.md){:target="_blank"}
* [Automated Machine Learning](https://github.com/Azure/MachineLearningNotebooks/blob/master/how-to-use-azureml/automated-machine-learning/classification-bank-marketing-all-features/auto-ml-classification-bank-marketing-all-features.ipynb){:target="_blank"}

Expand Down
2 changes: 1 addition & 1 deletion docs/execution-providers/Azure-ExecutionProvider.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Cloud - Azure
description: Instructions to infer an ONNX model remotely with an Azure endpoint
parent: Execution Providers
nav_order: 11
nav_order: 13
redirect_from: /docs/reference/execution-providers/Azure-ExecutionProvider
---

Expand Down
2 changes: 1 addition & 1 deletion docs/execution-providers/MIGraphX-ExecutionProvider.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: AMD - MIGraphX
description: Instructions to execute ONNX Runtime with the AMD MIGraphX execution provider
parent: Execution Providers
nav_order: 10
nav_order: 11
redirect_from: /docs/reference/execution-providers/MIGraphX-ExecutionProvider
---

Expand Down
2 changes: 1 addition & 1 deletion docs/execution-providers/TensorRT-ExecutionProvider.md
Original file line number Diff line number Diff line change
Expand Up @@ -540,5 +540,5 @@ This example shows how to run the Faster R-CNN model on TensorRT execution provi
./onnxruntime_perf_test -r 1 -e tensorrt -i "trt_fp16_enable|true" /path/to/onnx/your_inferred_model.onnx
```

Please see [this Notebook](https://github.com/microsoft/onnxruntime/blob/main/docs/python/inference/notebooks/onnx-inference-byoc-gpu-cpu-aks.ipynb) for an example of running a model on GPU using ONNX Runtime through Azure Machine Learning Services.
Please see [this Notebook](https://github.com/microsoft/onnxruntime/blob/main/docs/python/notebooks/onnx-inference-byoc-gpu-cpu-aks.ipynb) for an example of running a model on GPU using ONNX Runtime through Azure Machine Learning Services.

2 changes: 1 addition & 1 deletion docs/execution-providers/Vitis-AI-ExecutionProvider.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: AMD - Vitis AI
description: Instructions to execute ONNX Runtime on AMD devices with the Vitis AI execution provider
parent: Execution Providers
nav_order: 6
nav_order: 12
redirect_from: /docs/execution-providers/community-maintained/Vitis-AI-ExecutionProvider
---

Expand Down
2 changes: 1 addition & 1 deletion docs/execution-providers/add-execution-provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Add a new provider
description: Instructions to add a new execution provider to ONNX Runtime
parent: Execution Providers
nav_order: 13
nav_order: 15
redirect_from: /docs/how-to/add-execution-provider
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ It is also possible to use a precompiled model.

The compiled model can be obtained using the [OctoML platform](https://onnx.octoml.ai)
or compiled directly (see **Support precompiled model** section in
[Sample notebook for ResNet50 inference with TVM EP](https://github.com/microsoft/onnxruntime/blob/main/docs/python/inference/notebooks/onnxruntime-tvm-tutorial.ipynb)
[Sample notebook for ResNet50 inference with TVM EP](https://github.com/microsoft/onnxruntime/blob/main/docs/python/notebooks/onnxruntime-tvm-tutorial.ipynb)
for more information on model compilation).

In order to use the precompiled model, only need to pass two options:
Expand All @@ -247,7 +247,7 @@ the files of the precompiled model are located.
You can read more about these options in section [Configuration options](#configuration-options) above.

## Samples
- [Sample notebook for ResNet50 inference with TVM EP](https://github.com/microsoft/onnxruntime/blob/main/docs/python/inference/notebooks/onnxruntime-tvm-tutorial.ipynb)
- [Sample notebook for ResNet50 inference with TVM EP](https://github.com/microsoft/onnxruntime/blob/main/docs/python/notebooks/onnxruntime-tvm-tutorial.ipynb)

## Known issues
- At this moment, the TVM EP has only been verified on UNIX/Linux and Windows systems.
Expand Down
2 changes: 1 addition & 1 deletion docs/execution-providers/community-maintained/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Community-maintained
parent: Execution Providers
has_children: true
nav_order: 12
nav_order: 14
---
# Community-maintained Providers
This list of providers for specialized hardware is contributed and maintained by ONNX Runtime community partners.
Expand Down
27 changes: 23 additions & 4 deletions docs/extensions/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,41 @@ nav_order: 7

[![Build Status](https://dev.azure.com/onnxruntime/onnxruntime/_apis/build/status%2Fmicrosoft.onnxruntime-extensions?branchName=main)](https://dev.azure.com/onnxruntime/onnxruntime/_build/latest?definitionId=209&branchName=main)

ONNXRuntime-Extensions is a library that extends the capability of the ONNX models and inference with ONNX Runtime, via the ONNX Runtime custom operator interface. It includes a set of Custom Operators to support common model pre and post-processing for audio, vision, text, and language models. As with ONNX Runtime, Extensions also supports multiple languages and platforms (Python on Windows/Linux/macOS, Android and iOS mobile platforms and Web-Assembly for web.
ONNXRuntime-Extensions is a library that extends the capability of the ONNX models and inference with ONNX Runtime, via the ONNX Runtime custom operator interface. It includes a set of Custom Operators to support common model pre and post-processing for audio, vision, text, and language models. As with ONNX Runtime, Extensions also supports multiple languages and platforms (Python on Windows/Linux/macOS, Android and iOS mobile platforms and Web assembly for web).

The basic workflow is to add the custom operators to an ONNX model and then to perform inference on the enhanced model with ONNX Runtime and ONNXRuntime-Extensions packages.


<img src="../../images/combine-ai-extensions-img.png" alt="Pre and post-processing custom operators for vision, text, and NLP models" width="100%"/>
<sub>This image was created using <a href="https://github.com/sayanshaw24/combine" target="_blank">Combine.AI</a>, which is powered by Bing Chat, Bing Image Creator, and EdgeGPT.</sub>

## Quickstart

### **Python installation**

```bash
pip install onnxruntime-extensions
```

#### **Nightly Build**

##### on Windows

```cmd
pip install --index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/ORT-Nightly/pypi/simple/ onnxruntime-extensions
```
Please ensure that you have met the prerequisites of onnxruntime-extensions (e.g., onnx and onnxruntime) in your Python environment.
#### <strong>on Linux/macOS</strong>

The onnxruntime-extensions package depends on onnx and onnxruntime.

##### on Linux/MacOS

Please make sure the compiler toolkit like gcc(later than g++ 8.0) or clang are installed before the following command

```bash
python -m pip install git+https://github.com/microsoft/onnxruntime-extensions.git
```

### **NuGet installation (with .NET CLI)**

```bash
dotnet add package Microsoft.ML.OnnxRuntime.Extensions --version 0.8.1-alpha
```
Expand Down Expand Up @@ -81,13 +87,16 @@ In your Android Studio Project, make the following changes to:
```
## Add pre and post-processing to the model
There are multiple ways to add pre and post processing to an ONNX graph:
- [Use the pre-processing pipeline API if the model and its pre-processing is supported by the pipeline API](https://github.com/microsoft/onnxruntime-extensions/blob/main/onnxruntime_extensions/tools/pre_post_processing/pre_post_processor.py)
- [Export to ONNX from a PyTorch model](https://github.com/microsoft/onnxruntime-extensions/blob/main/tutorials/superresolution_e2e.py#L69)
- [Create an ONNX model with a model graph that includes your custom op node](https://github.com/microsoft/onnxruntime-extensions/blob/main/onnxruntime_extensions/_ortapi2.py#L50)
- [Compose the pre-processing with an ONNX model using ONNX APIs if you already have the pre processing in an ONNX graph](https://onnx.ai/onnx/api/compose.html)
If the pre processing operator is a HuggingFace tokenizer, you can also easily get the ONNX processing graph by converting from Huggingface transformer data processing classes such as in the following example:
```python
import onnxruntime as _ort
from transformers import AutoTokenizer
Expand All @@ -98,17 +107,21 @@ model = OrtPyFunction(gen_processing_models(tokenizer, pre_kwargs={})[0])
```

For more information, you can check the API using the following:

```python
help(onnxruntime_extensions.gen_processing_models)
```

### What if I cannot find the custom operator I am looking for?

Find the custom operators we currently support [here](https://github.com/microsoft/onnxruntime-extensions/tree/main/operators). If you do not find the custom operator you are looking for, you can add a new custom operator to ONNX Runtime Extensions like [this](./add-op.md). Note that if you do add a new operator, you will have to [build from source](./build.md).

## Inference with ONNX Runtime and Extensions

### Python

There are individual packages for the following languages, please install it for the build.

```python
import onnxruntime as _ort
from onnxruntime_extensions import get_library_path as _lib_path
Expand All @@ -122,7 +135,9 @@ sess.run (...)
```

### C++

Register Extensions with a path to the Extensions shared library.

```c++
Ort::Env env = ...;

Expand All @@ -141,6 +156,7 @@ Ort::Session session(env, model_uri, session_options);
```
Register Extensions by calling the `RegisterCustomOps` function directly.
```c++
Ort::Env env = ...;
Expand All @@ -158,6 +174,7 @@ Ort::Session session(env, model_uri, session_options);
```

### Java

```java
var env = OrtEnvironment.getEnvironment();
var sess_opt = new OrtSession.SessionOptions();
Expand All @@ -167,6 +184,7 @@ sess_opt.registerCustomOpLibrary(OrtxPackage.getLibraryPath());
```

### C#

```java
SessionOptions options = new SessionOptions();
options.RegisterOrtExtensions();
Expand All @@ -176,6 +194,7 @@ session = new InferenceSession(model, options);
## Tutorials

Check out some end to end tutorials with our custom operators:

- NLP: [An end-to-end BERT tutorial](https://github.com/microsoft/onnxruntime-extensions/blob/main/tutorials/bert_e2e.py)
- Audio: [Using audio encoding and decoding for Whisper](https://github.com/microsoft/onnxruntime-extensions/blob/main/tutorials/whisper_e2e.py)
- Vision: [The YOLO model with our DrawBoundingBoxes operator](https://github.com/microsoft/onnxruntime-extensions/blob/main/tutorials/yolo_e2e.py)
Expand Down
Loading

0 comments on commit e2309cd

Please sign in to comment.