mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-29 20:14:01 +00:00
[Docs] TensorRT update docs to V2 API (#18569)
### Description I mainly wanted to update the docs to V2 API. I think my spellchecker did quite a few adjusts to whitespaces hope that's fine. @chilo-ms for viz
This commit is contained in:
parent
e64b07c4c7
commit
766400b477
1 changed files with 105 additions and 57 deletions
|
|
@ -9,7 +9,7 @@ redirect_from: /docs/reference/execution-providers/TensorRT-ExecutionProvider
|
|||
# TensorRT Execution Provider
|
||||
{: .no_toc }
|
||||
|
||||
With the TensorRT execution provider, the ONNX Runtime delivers better inferencing performance on the same hardware compared to generic GPU acceleration.
|
||||
With the TensorRT execution provider, the ONNX Runtime delivers better inferencing performance on the same hardware compared to generic GPU acceleration.
|
||||
|
||||
The TensorRT execution provider in the ONNX Runtime makes use of NVIDIA's [TensorRT](https://developer.nvidia.com/tensorrt) Deep Learning inferencing engine to accelerate ONNX model in their family of GPUs. Microsoft and NVIDIA worked closely to integrate the TensorRT execution provider with ONNX Runtime.
|
||||
|
||||
|
|
@ -100,47 +100,55 @@ There are two ways to configure TensorRT settings, either by **TensorRT Executio
|
|||
| trt_profile_max_shapes | ORT_TENSORRT_PROFILE_MAX_SHAPES | string |
|
||||
| trt_profile_opt_shapes | ORT_TENSORRT_PROFILE_OPT_SHAPES | string |
|
||||
|
||||
> Note: for bool type options, assign them with **True**/**False** in python, or **1**/**0** in C++.
|
||||
> Note: for bool type options, assign them with **True**/**False** in python, or **1**/**0** in C++.
|
||||
|
||||
### Execution Provider Options
|
||||
|
||||
TensorRT configurations can be set by execution provider options. It's useful when each model and inference session have their own configurations. In this case, execution provider option settings will override any environment variable settings. All configurations should be set explicitly, otherwise default value will be taken.
|
||||
TensorRT configurations can be set by execution provider options. It's useful when each model and inference session have their own configurations. In this case, execution provider option settings will override any environment variable settings. All configurations should be set explicitly, otherwise default value will be taken.
|
||||
|
||||
* `trt_max_workspace_size`: maximum workspace size for TensorRT engine.
|
||||
* `device_id`: The device ID.
|
||||
* Default value: 0
|
||||
|
||||
* `user_compute_stream`: Defines the compute stream for the inference to run on. It implicitly sets the `has_user_compute_stream` option. It cannot be set through `UpdateTensorRTProviderOptions`, but rather `UpdateTensorRTProviderOptionsWithValue`.
|
||||
* This cannot be used in combination with an external allocator.
|
||||
* This can not be set using the python API.
|
||||
|
||||
* `trt_max_workspace_size`: maximum workspace size for TensorRT engine.
|
||||
* Default value: 1073741824 (1GB).
|
||||
|
||||
* `trt_max_partition_iterations`: maximum number of iterations allowed in model partitioning for TensorRT.
|
||||
* If target model can't be successfully partitioned when the maximum number of iterations is reached, the whole model will fall back to other execution providers such as CUDA or CPU.
|
||||
* `trt_max_partition_iterations`: maximum number of iterations allowed in model partitioning for TensorRT.
|
||||
* If target model can't be successfully partitioned when the maximum number of iterations is reached, the whole model will fall back to other execution providers such as CUDA or CPU.
|
||||
* Default value: 1000.
|
||||
|
||||
* `trt_min_subgraph_size`: minimum node size in a subgraph after partitioning.
|
||||
* Subgraphs with smaller size will fall back to other execution providers.
|
||||
* `trt_min_subgraph_size`: minimum node size in a subgraph after partitioning.
|
||||
* Subgraphs with smaller size will fall back to other execution providers.
|
||||
* Default value: 1.
|
||||
|
||||
* `trt_fp16_enable`: Enable FP16 mode in TensorRT.
|
||||
* `trt_fp16_enable`: Enable FP16 mode in TensorRT.
|
||||
> Note: not all Nvidia GPUs support FP16 precision.
|
||||
|
||||
* `trt_int8_enable`: Enable INT8 mode in TensorRT.
|
||||
* `trt_int8_enable`: Enable INT8 mode in TensorRT.
|
||||
> Note: not all Nvidia GPUs support INT8 precision.
|
||||
|
||||
* `trt_int8_calibration_table_name`: Specify INT8 calibration table file for non-QDQ models in INT8 mode.
|
||||
> Note: calibration table should not be provided for QDQ model because TensorRT doesn't allow calibration table to be loded if there is any Q/DQ node in the model. By default the name is empty.
|
||||
|
||||
* `trt_int8_use_native_calibration_table`: Select what calibration table is used for non-QDQ models in INT8 mode.
|
||||
* If `True`, native TensorRT generated calibration table is used;
|
||||
* `trt_int8_use_native_calibration_table`: Select what calibration table is used for non-QDQ models in INT8 mode.
|
||||
* If `True`, native TensorRT generated calibration table is used;
|
||||
* If `False`, ONNXRUNTIME tool generated calibration table is used.
|
||||
> Note: Please copy up-to-date calibration table file to `trt_engine_cache_path` before inference. Calibration table is specific to models and calibration data sets. Whenever new calibration table is generated, old file in the path should be cleaned up or be replaced.
|
||||
|
||||
* `trt_dla_enable`: Enable DLA (Deep Learning Accelerator).
|
||||
* `trt_dla_enable`: Enable DLA (Deep Learning Accelerator).
|
||||
> Note: Not all Nvidia GPUs support DLA.
|
||||
|
||||
* `trt_dla_core`: Specify DLA core to execute on. Default value: 0.
|
||||
|
||||
* `trt_engine_cache_enable`: Enable TensorRT engine caching.
|
||||
|
||||
* The purpose of using engine caching is to save engine build time in the case that TensorRT may take long time to optimize and build engine.
|
||||
* `trt_engine_cache_enable`: Enable TensorRT engine caching.
|
||||
|
||||
* Engine will be cached when it's built for the first time so next time when new inference session is created the engine can be loaded directly from cache. In order to validate that the loaded engine is usable for current inference, engine profile is also cached and loaded along with engine. If current input shapes are in the range of the engine profile, the loaded engine can be safely used. Otherwise if input shapes are out of range, profile cache will be updated to cover the new shape and engine will be recreated based on the new profile (and also refreshed in the engine cache).
|
||||
* The purpose of using engine caching is to save engine build time in the case that TensorRT may take long time to optimize and build engine.
|
||||
|
||||
* Engine will be cached when it's built for the first time so next time when new inference session is created the engine can be loaded directly from cache. In order to validate that the loaded engine is usable for current inference, engine profile is also cached and loaded along with engine. If current input shapes are in the range of the engine profile, the loaded engine can be safely used. Otherwise if input shapes are out of range, profile cache will be updated to cover the new shape and engine will be recreated based on the new profile (and also refreshed in the engine cache).
|
||||
|
||||
* Note each engine is created for specific settings such as model path/name, precision (FP32/FP16/INT8 etc), workspace, profiles etc, and specific GPUs and it's not portable, so it's essential to make sure those settings are not changing, otherwise the engine needs to be rebuilt and cached again.
|
||||
|
||||
|
|
@ -152,7 +160,7 @@ TensorRT configurations can be set by execution provider options. It's useful wh
|
|||
|
||||
* `trt_engine_cache_path`: Specify path for TensorRT engine and profile files if `trt_engine_cache_enable` is `True`, or path for INT8 calibration table file if `trt_int8_enable` is `True`.
|
||||
|
||||
* `trt_dump_subgraphs`: Dumps the subgraphs that are transformed into TRT engines in onnx format to the filesystem.
|
||||
* `trt_dump_subgraphs`: Dumps the subgraphs that are transformed into TRT engines in onnx format to the filesystem.
|
||||
* This can help debugging subgraphs, e.g. by using `trtexec --onnx my_model.onnx` and check the outputs of the parser.
|
||||
|
||||
* `trt_force_sequential_engine_build`: Sequentially build TensorRT engines across provider instances in multi-GPU environment.
|
||||
|
|
@ -161,37 +169,38 @@ TensorRT configurations can be set by execution provider options. It's useful wh
|
|||
|
||||
* `trt_layer_norm_fp32_fallback`: Force Pow + Reduce ops in layer norm to FP32.
|
||||
|
||||
* `trt_timing_cache_enable`: Enable TensorRT timing cache.
|
||||
* `trt_timing_cache_enable`: Enable TensorRT timing cache.
|
||||
* Check [Timing cache](#timing-cache) for details.
|
||||
|
||||
* `trt_force_timing_cache`: Force the TensorRT timing cache to be used even if device profile does not match.
|
||||
* A perfect match is only the exact same GPU model as the on that produced the timing cache.
|
||||
|
||||
* `trt_detailed_build_log`: Enable detailed build step logging on TensorRT EP with timing for each engine build.
|
||||
|
||||
* `trt_build_heuristics_enable`: Build engine using heuristics to reduce build time.
|
||||
|
||||
* `trt_sparsity_enable`: Control if sparsity can be used by TRT.
|
||||
* `trt_sparsity_enable`: Control if sparsity can be used by TRT.
|
||||
* Check `--sparsity` in `trtexec` command-line flags for [details](https://docs.nvidia.com/deeplearning/tensorrt/developer-guide/index.html#trtexec-flags).
|
||||
|
||||
* `trt_builder_optimization_level`: Set the builder optimization level.
|
||||
* `trt_builder_optimization_level`: Set the builder optimization level.
|
||||
> WARNING: levels below 3 do not guarantee good engine performance, but greatly improve build time. Default 3, valid range [0-5]. Check `--builderOptimizationLevel` in `trtexec` command-line flags for [details](https://docs.nvidia.com/deeplearning/tensorrt/developer-guide/index.html#trtexec-flags).
|
||||
|
||||
* `trt_auxiliary_streams`: Set maximum number of auxiliary streams per inference stream.
|
||||
* Setting this value to 0 will lead to optimal memory usage.
|
||||
* Default -1 = heuristics.
|
||||
* `trt_auxiliary_streams`: Set maximum number of auxiliary streams per inference stream.
|
||||
* Setting this value to 0 will lead to optimal memory usage.
|
||||
* Default -1 = heuristics.
|
||||
* Check `--maxAuxStreams` in `trtexec` command-line flags for [details](https://docs.nvidia.com/deeplearning/tensorrt/developer-guide/index.html#trtexec-flags).
|
||||
|
||||
* `trt_tactic_sources`: Specify the tactics to be used by adding (+) or removing (-) tactics from the default tactic sources (default = all available tactics)
|
||||
* `trt_tactic_sources`: Specify the tactics to be used by adding (+) or removing (-) tactics from the default tactic sources (default = all available tactics)
|
||||
* e.g. "-CUDNN,+CUBLAS" available keys: "CUBLAS", "CUBLAS_LT", "CUDNN" or "EDGE_MASK_CONVOLUTIONS".
|
||||
|
||||
* `trt_extra_plugin_lib_paths`: Specify extra TensorRT plugin library paths.
|
||||
* ORT TRT by default supports any TRT plugins registered in TRT registry in TRT plugin library (i.e., `libnvinfer_plugin.so`).
|
||||
* Moreover, if users want to use other TRT plugins that are not in TRT plugin library,
|
||||
* for example, FasterTransformer has many TRT plugin implementations for different models, user can specify like this `ORT_TENSORRT_EXTRA_PLUGIN_LIB_PATHS=libvit_plugin.so;libvit_int8_plugin.so`.
|
||||
* `trt_extra_plugin_lib_paths`: Specify extra TensorRT plugin library paths.
|
||||
* ORT TRT by default supports any TRT plugins registered in TRT registry in TRT plugin library (i.e., `libnvinfer_plugin.so`).
|
||||
* Moreover, if users want to use other TRT plugins that are not in TRT plugin library,
|
||||
* for example, FasterTransformer has many TRT plugin implementations for different models, user can specify like this `ORT_TENSORRT_EXTRA_PLUGIN_LIB_PATHS=libvit_plugin.so;libvit_int8_plugin.so`.
|
||||
|
||||
* `trt_profile_min_shapes`, `trt_profile_max_shapes` and `trt_profile_opt_shapes` : Build with dynamic shapes using a profile with the min/max/opt shapes provided.
|
||||
* The format of the profile shapes is `input_tensor_1:dim_1xdim_2x...,input_tensor_2:dim_3xdim_4x...,...`
|
||||
* These three flags should all be provided in order to enable explicit profile shapes feature.
|
||||
* `trt_profile_min_shapes`, `trt_profile_max_shapes` and `trt_profile_opt_shapes` : Build with dynamic shapes using a profile with the min/max/opt shapes provided.
|
||||
* The format of the profile shapes is `input_tensor_1:dim_1xdim_2x...,input_tensor_2:dim_3xdim_4x...,...`
|
||||
* These three flags should all be provided in order to enable explicit profile shapes feature.
|
||||
* Check [Explicit shape range for dynamic shape input](#explicit-shape-range-for-dynamic-shape-input) and TRT doc [optimization profiles](https://docs.nvidia.com/deeplearning/tensorrt/developer-guide/index.html#opt_profiles) for more details.
|
||||
|
||||
|
||||
|
|
@ -203,20 +212,58 @@ Besides, `device_id` can also be set by execution provider option.
|
|||
|
||||
```c++
|
||||
Ort::SessionOptions session_options;
|
||||
OrtTensorRTProviderOptions trt_options{};
|
||||
|
||||
// note: for bool type options in c++ API, set them as 0/1
|
||||
trt_options.device_id = 1;
|
||||
trt_options.trt_max_workspace_size = 2147483648;
|
||||
trt_options.trt_max_partition_iterations = 10;
|
||||
trt_options.trt_min_subgraph_size = 5;
|
||||
trt_options.trt_fp16_enable = 1;
|
||||
trt_options.trt_int8_enable = 1;
|
||||
trt_options.trt_int8_use_native_calibration_table = 1;
|
||||
trt_options.trt_engine_cache_enable = 1;
|
||||
trt_options.trt_engine_cache_path = "/path/to/cache"
|
||||
trt_options.trt_dump_subgraphs = 1;
|
||||
session_options.AppendExecutionProvider_TensorRT(trt_options);
|
||||
const auto& api = Ort::GetApi();
|
||||
OrtTensorRTProviderOptionsV2* tensorrt_options;
|
||||
Ort::ThrowOnError(api.CreateTensorRTProviderOptions(&tensorrt_options));
|
||||
|
||||
std::vector<const char*> option_keys = {
|
||||
"device_id",
|
||||
"trt_max_workspace_size",
|
||||
"trt_max_partition_iterations",
|
||||
"trt_min_subgraph_size",
|
||||
"trt_fp16_enable",
|
||||
"trt_int8_enable",
|
||||
"trt_int8_use_native_calibration_table",
|
||||
"trt_dump_subgraphs",
|
||||
// below options are strongly recommended !
|
||||
"trt_engine_cache_enable",
|
||||
"trt_engine_cache_path",
|
||||
"trt_timing_cache_enable",
|
||||
"trt_timing_cache_path",
|
||||
};
|
||||
std::vector<const char*> option_values = {
|
||||
"1",
|
||||
"2147483648",
|
||||
"10",
|
||||
"5",
|
||||
"1",
|
||||
"1",
|
||||
"1",
|
||||
"1",
|
||||
"1",
|
||||
"1",
|
||||
"/path/to/cache",
|
||||
"1",
|
||||
"/path/to/cache", // can be same as the engine cache folder
|
||||
};
|
||||
|
||||
Ort::ThrowOnError(api.UpdateTensorRTProviderOptions(tensorrt_options,
|
||||
option_keys.data(), option_values.data(), option_keys.size()));
|
||||
|
||||
|
||||
cudaStream_t cuda_stream;
|
||||
cudaStreamCreate(&cuda_stream);
|
||||
// this implicitly sets "has_user_compute_stream"
|
||||
Ort::ThrowOnError(api.UpdateTensorRTProviderOptionsWithValue(cuda_options, "user_compute_stream", cuda_stream))
|
||||
|
||||
session_options.AppendExecutionProvider_TensorRT_V2(tensorrt_options);
|
||||
/// below code can be used to print all options
|
||||
OrtAllocator* allocator;
|
||||
char* options;
|
||||
Ort::ThrowOnError(api.GetAllocatorWithDefaultOptions(&allocator));
|
||||
Ort::ThrowOnError(api.GetTensorRTProviderOptionsAsString(tensorrt_options, allocator, &options));
|
||||
|
||||
```
|
||||
|
||||
</details>
|
||||
|
|
@ -257,7 +304,7 @@ sess = ort.InferenceSession(model_path, sess_options=sess_opt, providers=provide
|
|||
Following environment variables can be set for TensorRT execution provider. Click below for more details.
|
||||
|
||||
<details>
|
||||
|
||||
|
||||
* `ORT_TENSORRT_MAX_WORKSPACE_SIZE`: maximum workspace size for TensorRT engine. Default value: 1073741824 (1GB).
|
||||
|
||||
* `ORT_TENSORRT_MAX_PARTITION_ITERATIONS`: maximum number of iterations allowed in model partitioning for TensorRT. If target model can't be successfully partitioned when the maximum number of iterations is reached, the whole model will fall back to other execution providers such as CUDA or CPU. Default value: 1000.
|
||||
|
|
@ -273,7 +320,7 @@ Following environment variables can be set for TensorRT execution provider. Clic
|
|||
* `ORT_TENSORRT_INT8_USE_NATIVE_CALIBRATION_TABLE`: Select what calibration table is used for non-QDQ models in INT8 mode. If 1, native TensorRT generated calibration table is used; if 0, ONNXRUNTIME tool generated calibration table is used. Default value: 0.
|
||||
* **Note: Please copy up-to-date calibration table file to `ORT_TENSORRT_CACHE_PATH` before inference. Calibration table is specific to models and calibration data sets. Whenever new calibration table is generated, old file in the path should be cleaned up or be replaced.**
|
||||
|
||||
* `ORT_TENSORRT_DLA_ENABLE`: Enable DLA (Deep Learning Accelerator). 1: enabled, 0: disabled. Default value: 0. Note not all Nvidia GPUs support DLA.
|
||||
* `ORT_TENSORRT_DLA_ENABLE`: Enable DLA (Deep Learning Accelerator). 1: enabled, 0: disabled. Default value: 0. Note not all Nvidia GPUs support DLA.
|
||||
|
||||
* `ORT_TENSORRT_DLA_CORE`: Specify DLA core to execute on. Default value: 0.
|
||||
|
||||
|
|
@ -310,7 +357,7 @@ Following environment variables can be set for TensorRT execution provider. Clic
|
|||
|
||||
* `ORT_TENSORRT_TACTIC_SOURCES`: Specify the tactics to be used by adding (+) or removing (-) tactics from the default tactic sources (default = all available tactics) e.g. "-CUDNN,+CUBLAS" available keys: "CUBLAS", "CUBLAS_LT", "CUDNN" or "EDGE_MASK_CONVOLUTIONS".
|
||||
|
||||
* `ORT_TENSORRT_EXTRA_PLUGIN_LIB_PATHS`: Specify extra TensorRT plugin library paths. ORT TRT by default supports any TRT plugins registered in TRT registry in TRT plugin library (i.e., `libnvinfer_plugin.so`). Moreover, if users want to use other TRT plugins that are not in TRT plugin library, for example, FasterTransformer has many TRT plugin implementations for different models, user can specify like this `ORT_TENSORRT_EXTRA_PLUGIN_LIB_PATHS=libvit_plugin.so;libvit_int8_plugin.so`.
|
||||
* `ORT_TENSORRT_EXTRA_PLUGIN_LIB_PATHS`: Specify extra TensorRT plugin library paths. ORT TRT by default supports any TRT plugins registered in TRT registry in TRT plugin library (i.e., `libnvinfer_plugin.so`). Moreover, if users want to use other TRT plugins that are not in TRT plugin library, for example, FasterTransformer has many TRT plugin implementations for different models, user can specify like this `ORT_TENSORRT_EXTRA_PLUGIN_LIB_PATHS=libvit_plugin.so;libvit_int8_plugin.so`.
|
||||
|
||||
* `ORT_TENSORRT_PROFILE_MIN_SHAPES`, `ORT_TENSORRT_PROFILE_MAX_SHAPES` and `ORT_TENSORRT_PROFILE_OPT_SHAPES` : Build with dynamic shapes using a profile with the min/max/opt shapes provided. The format of the profile shapes is "input_tensor_1:dim_1xdim_2x...,input_tensor_2:dim_3xdim_4x...,..." and these three flags should all be provided in order to enable explicit profile shapes feature. Check [Explicit shape range for dynamic shape input](#explicit-shape-range-for-dynamic-shape-input) and TRT doc [optimization profiles](https://docs.nvidia.com/deeplearning/tensorrt/developer-guide/index.html#opt_profiles) for more details.
|
||||
|
||||
|
|
@ -320,7 +367,7 @@ One can override default values by setting environment variables. e.g. on Linux:
|
|||
# Override default max workspace size to 2GB
|
||||
export ORT_TENSORRT_MAX_WORKSPACE_SIZE=2147483648
|
||||
|
||||
# Override default maximum number of iterations to 10
|
||||
# Override default maximum number of iterations to 10
|
||||
export ORT_TENSORRT_MAX_PARTITION_ITERATIONS=10
|
||||
|
||||
# Override default minimum subgraph node size to 5
|
||||
|
|
@ -337,7 +384,7 @@ export ORT_TENSORRT_INT8_USE_NATIVE_CALIBRATION_TABLE=1
|
|||
|
||||
# Enable TensorRT engine caching
|
||||
export ORT_TENSORRT_ENGINE_CACHE_ENABLE=1
|
||||
# Please Note warning above. This feature is experimental.
|
||||
# Please Note warning above. This feature is experimental.
|
||||
# Engine cache files must be invalidated if there are any changes to the model, ORT version, TensorRT version or if the underlying hardware changes. Engine files are not portable across devices.
|
||||
|
||||
# Specify TensorRT cache path
|
||||
|
|
@ -362,7 +409,7 @@ If some operators in the model are not supported by TensorRT, ONNX Runtime will
|
|||
|
||||
### TensorRT Plugins Support
|
||||
ORT TRT can leverage the TRT plugins which come with TRT plugin library in official release. To use TRT plugins, firstly users need to create the custom node (a one-to-one mapping to TRT plugin) with a registered plugin name and `trt.plugins` domain in the ONNX model. So, ORT TRT can recognize this custom node and pass the node together with the subgraph to TRT. Please see following python example to create a new custom node in the ONNX model:
|
||||
|
||||
|
||||
Click below for Python API example:
|
||||
|
||||
<details>
|
||||
|
|
@ -405,7 +452,9 @@ def generate_model(model_name):
|
|||
Note: If users want to use TRT plugins that are not in the TRT plugin library in official release, please see the ORT TRT provider option `trt_extra_plugin_lib_paths` for more details.
|
||||
|
||||
### Timing cache
|
||||
Enabling `trt_timing_cache_enable` will enable ORT TRT to use TensorRT timing cache to accelerate engine build time on a device with the same compute capability. This will work across models as it simply stores kernel latencies for specific configurations. Those files are usually very small (only a few KB or MB) which makes them very easy to ship with an application to accelerate the build time on the user end.
|
||||
Enabling `trt_timing_cache_enable` will enable ORT TRT to use TensorRT timing cache to accelerate engine build time on a device with the same compute capability. This will work across models as it simply stores kernel latencies for specific configurations and cubins (TRT 9.0+). Those files are usually very small (only a few KB or MB) which makes them very easy to ship with an application to accelerate the build time on the user end.
|
||||
|
||||
_Note:_ A timing cache can be used across one [GPU compute capability](https://developer.nvidia.com/cuda-gpus) similar to an engine. Nonetheless the preferred way is to use one per GPU model, but practice shows that sharing across one compute capability works well in most cases.
|
||||
|
||||
The following examples shows build time reduction with timing cache:
|
||||
|
||||
|
|
@ -448,9 +497,9 @@ sess.run(
|
|||
|
||||
</details>
|
||||
|
||||
### Explicit shape range for dynamic shape input
|
||||
### Explicit shape range for dynamic shape input
|
||||
|
||||
ORT TRT lets you explicitly specify min/max/opt shapes for each dynamic shape input through three provider options, `trt_profile_min_shapes`, `trt_profile_max_shapes` and `trt_profile_opt_shapes`. If these three provider options are not specified
|
||||
ORT TRT lets you explicitly specify min/max/opt shapes for each dynamic shape input through three provider options, `trt_profile_min_shapes`, `trt_profile_max_shapes` and `trt_profile_opt_shapes`. If these three provider options are not specified
|
||||
and model has dynamic shape input, ORT TRT will determine the min/max/opt shapes for the dynamic shape input based on incoming input tensor. The min/max/opt shapes are required for TRT optimization profile (An optimization profile describes a range of dimensions for each TRT network input and the dimensions that the auto-tuner will use for optimization. When using runtime dimensions, you must create at least one optimization profile at build time.)
|
||||
|
||||
To use the engine cache built with optimization profiles specified by explicit shape ranges, user still needs to provide those three provider options as well as engine cache enable flag.
|
||||
|
|
@ -522,16 +571,16 @@ This example shows how to run the Faster R-CNN model on TensorRT execution provi
|
|||
```
|
||||
|
||||
3. To test model with sample input and verify the output, run `onnx_test_runner` under ONNX Runtime build directory.
|
||||
|
||||
|
||||
> Models and test_data_set_ folder need to be stored under the same path. `onnx_test_runner` will test all models under this path.
|
||||
|
||||
```bash
|
||||
./onnx_test_runner -e tensorrt /path/to/onnx/model/
|
||||
```
|
||||
|
||||
4. To test on model performance, run `onnxruntime_perf_test` on your shape-inferred Faster-RCNN model
|
||||
4. To test on model performance, run `onnxruntime_perf_test` on your shape-inferred Faster-RCNN model
|
||||
|
||||
> Download sample test data with model from [model zoo](https://github.com/onnx/models/tree/main/vision/object_detection_segmentation/faster-rcnn), and put test_data_set folder next to your inferred model
|
||||
> Download sample test data with model from [model zoo](https://github.com/onnx/models/tree/main/vision/object_detection_segmentation/faster-rcnn), and put test_data_set folder next to your inferred model
|
||||
|
||||
```bash
|
||||
# e.g.
|
||||
|
|
@ -542,4 +591,3 @@ This example shows how to run the Faster R-CNN model on TensorRT execution provi
|
|||
```
|
||||
|
||||
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.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue