You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: python/README.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,8 @@
2
2
3
3
## API
4
4
5
-
[Run the ONNX Runtime session creation and inference API](https://github.com/microsoft/onnxruntime-inference-examples/tree/main/python/api)
5
+
The [api directory](https://github.com/microsoft/onnxruntime-inference-examples/tree/main/python/api) contains samples that demonstrate how to use the ONNX Runtime Python API.
6
+
These samples show very minimal API usage that is not execution provider specific.
This directory contains sample scripts demonstrating various ONNX Runtime Python API features:
4
+
5
+
-`getting_started.py`
6
+
Introduces the basics of exporting a simple PyTorch model to ONNX, running inference with ONNX Runtime, and handling inputs/outputs as NumPy arrays.
7
+
8
+
-`compile_api.py`
9
+
Shows how to programmatically compile an ONNX model for a specific execution provider (e.g., TensorRT RTX) to an [EP context](https://onnxruntime.ai/docs/execution-providers/EP-Context-Design.html) ONNX. The sample measures model load and compile times to demonstrate performance improvements and has the option to specify an input model.
10
+
- For `NvTensorRTRTXExecutionProvider` try adding the provider option for a runtime cache (`-p NvTensorRTRTXExecutionProvider -popt "nv_runtime_cache_path=./cache"`) which will further increase the load speed of a compiled model.
11
+
12
+
-`device_bindings.py`
13
+
Demonstrates advanced device bindings, including running ONNX models on CPU or GPU, using ONNX Runtime's `OrtValue` for device memory, and direct inference with PyTorch tensors on the selected device. It also demonstrates how to interact with ORT using dlpack.
14
+
15
+
Each sample is self-contained and includes comments explaining the main concepts.
16
+
17
+
### Setup
18
+
19
+
Besides installing the ONNX Runtime package there are some other dependencies for the samples to work correctly.
20
+
Please pick your selected [onnxruntime package](https://onnxruntime.ai/docs/get-started/with-python.html#install-onnx-runtime) manually.
21
+
```
22
+
pip install -r requirements.txt
23
+
# to install ORT GPU with required cuda dependencies
0 commit comments