Tensorrt Support
I wanted to convert the kokoro onnx model to tensorrt .engine or atleast use tensorrt execution provider for c++ inference. But having issue due to dynamic shape of nodes and unsupported ops like SequenceAt, sequenceInsert, splitToSequence, etc.
~/speech/tts$ trtexec --onnx=dump/model.onnx --saveEngine=model.engine
&&&& RUNNING TensorRT.trtexec [TensorRT v8613] # trtexec --onnx=dump/model.onnx --saveEngine=model.engine
[09/29/2025-12:04:28] [I] === Model Options ===
[09/29/2025-12:04:28] [I] Format: ONNX
[09/29/2025-12:04:28] [I] Model: dump/model.onnx
[09/29/2025-12:04:28] [I] Output:
[09/29/2025-12:04:28] [I] === Build Options ===
[09/29/2025-12:04:28] [I] Max batch: explicit batch
[09/29/2025-12:04:28] [I] Memory Pools: workspace: default, dlaSRAM: default, dlaLocalDRAM: default, dlaGlobalDRAM: default
[09/29/2025-12:04:28] [I] minTiming: 1
[09/29/2025-12:04:28] [I] avgTiming: 8
[09/29/2025-12:04:28] [I] Precision: FP32
[09/29/2025-12:04:28] [I] LayerPrecisions:
[09/29/2025-12:04:28] [I] Layer Device Types:
[09/29/2025-12:04:28] [I] Calibration:
[09/29/2025-12:04:28] [I] Refit: Disabled
[09/29/2025-12:04:28] [I] Version Compatible: Disabled
[09/29/2025-12:04:28] [I] TensorRT runtime: full
[09/29/2025-12:04:28] [I] Lean DLL Path:
[09/29/2025-12:04:28] [I] Tempfile Controls: { in_memory: allow, temporary: allow }
[09/29/2025-12:04:28] [I] Exclude Lean Runtime: Disabled
[09/29/2025-12:04:28] [I] Sparsity: Disabled
[09/29/2025-12:04:28] [I] Safe mode: Disabled
[09/29/2025-12:04:28] [I] Build DLA standalone loadable: Disabled
[09/29/2025-12:04:28] [I] Allow GPU fallback for DLA: Disabled
[09/29/2025-12:04:28] [I] DirectIO mode: Disabled
[09/29/2025-12:04:28] [I] Restricted mode: Disabled
[09/29/2025-12:04:28] [I] Skip inference: Disabled
[09/29/2025-12:04:28] [I] Save engine: model.engine
[09/29/2025-12:04:28] [I] Load engine:
[09/29/2025-12:04:28] [I] Profiling verbosity: 0
[09/29/2025-12:04:28] [I] Tactic sources: Using default tactic sources
[09/29/2025-12:04:28] [I] timingCacheMode: local
[09/29/2025-12:04:28] [I] timingCacheFile:
[09/29/2025-12:04:28] [I] Heuristic: Disabled
[09/29/2025-12:04:28] [I] Preview Features: Use default preview flags.
[09/29/2025-12:04:28] [I] MaxAuxStreams: -1
[09/29/2025-12:04:28] [I] BuilderOptimizationLevel: -1
[09/29/2025-12:04:28] [I] Calibration Profile Index: 0
[09/29/2025-12:04:28] [I] Input(s)s format: fp32:CHW
[09/29/2025-12:04:28] [I] Output(s)s format: fp32:CHW
[09/29/2025-12:04:28] [I] Input build shapes: model
[09/29/2025-12:04:28] [I] Input calibration shapes: model
[09/29/2025-12:04:28] [I] === System Options ===
[09/29/2025-12:04:28] [I] Device: 0
[09/29/2025-12:04:28] [I] DLACore:
[09/29/2025-12:04:28] [I] Plugins:
[09/29/2025-12:04:28] [I] setPluginsToSerialize:
[09/29/2025-12:04:28] [I] dynamicPlugins:
[09/29/2025-12:04:28] [I] ignoreParsedPluginLibs: 0
[09/29/2025-12:04:28] [I]
[09/29/2025-12:04:28] [I] === Inference Options ===
[09/29/2025-12:04:28] [I] Batch: Explicit
[09/29/2025-12:04:28] [I] Input inference shapes: model
[09/29/2025-12:04:28] [I] Iterations: 10
[09/29/2025-12:04:28] [I] Duration: 3s (+ 200ms warm up)
[09/29/2025-12:04:28] [I] Sleep time: 0ms
[09/29/2025-12:04:28] [I] Idle time: 0ms
[09/29/2025-12:04:28] [I] Inference Streams: 1
[09/29/2025-12:04:28] [I] ExposeDMA: Disabled
[09/29/2025-12:04:28] [I] Data transfers: Enabled
[09/29/2025-12:04:28] [I] Spin-wait: Disabled
[09/29/2025-12:04:28] [I] Multithreading: Disabled
[09/29/2025-12:04:28] [I] CUDA Graph: Disabled
[09/29/2025-12:04:28] [I] Separate profiling: Disabled
[09/29/2025-12:04:28] [I] Time Deserialize: Disabled
[09/29/2025-12:04:28] [I] Time Refit: Disabled
[09/29/2025-12:04:28] [I] NVTX verbosity: 0
[09/29/2025-12:04:28] [I] Persistent Cache Ratio: 0
[09/29/2025-12:04:28] [I] Optimization Profile Index: 0
[09/29/2025-12:04:28] [I] Inputs:
[09/29/2025-12:04:28] [I] === Reporting Options ===
[09/29/2025-12:04:28] [I] Verbose: Disabled
[09/29/2025-12:04:28] [I] Averages: 10 inferences
[09/29/2025-12:04:28] [I] Percentiles: 90,95,99
[09/29/2025-12:04:28] [I] Dump refittable layers:Disabled
[09/29/2025-12:04:28] [I] Dump output: Disabled
[09/29/2025-12:04:28] [I] Profile: Disabled
[09/29/2025-12:04:28] [I] Export timing to JSON file:
[09/29/2025-12:04:28] [I] Export output to JSON file:
[09/29/2025-12:04:28] [I] Export profile to JSON file:
[09/29/2025-12:04:28] [I]
[09/29/2025-12:04:28] [I] === Device Information ===
[09/29/2025-12:04:28] [I] Selected Device: Orin
[09/29/2025-12:04:28] [I] Compute Capability: 8.7
[09/29/2025-12:04:28] [I] SMs: 16
[09/29/2025-12:04:28] [I] Device Global Memory: 28953 MiB
[09/29/2025-12:04:28] [I] Shared Memory per SM: 164 KiB
[09/29/2025-12:04:28] [I] Memory Bus Width: 256 bits (ECC disabled)
[09/29/2025-12:04:28] [I] Application Compute Clock Rate: 1.275 GHz
[09/29/2025-12:04:28] [I] Application Memory Clock Rate: 1.275 GHz
[09/29/2025-12:04:28] [I]
[09/29/2025-12:04:28] [I] Note: The application clock rates do not reflect the actual clock rates that the GPU is currently running at.
[09/29/2025-12:04:28] [I]
[09/29/2025-12:04:28] [I] TensorRT version: 8.6.13
[09/29/2025-12:04:28] [I] Loading standard plugins
[09/29/2025-12:04:28] [I] [TRT] [MemUsageChange] Init CUDA: CPU +418, GPU +0, now: CPU 438, GPU 6279 (MiB)
[09/29/2025-12:04:31] [I] [TRT] [MemUsageChange] Init builder kernel library: CPU +833, GPU +676, now: CPU 1303, GPU 6989 (MiB)
[09/29/2025-12:04:31] [I] Start parsing network model.
[09/29/2025-12:04:31] [I] [TRT] ----------------------------------------------------------------
[09/29/2025-12:04:31] [I] [TRT] Input filename: dump/model.onnx
[09/29/2025-12:04:31] [I] [TRT] ONNX IR version: 0.0.8
[09/29/2025-12:04:31] [I] [TRT] Opset version: 15
[09/29/2025-12:04:31] [I] [TRT] Producer name: pytorch
[09/29/2025-12:04:31] [I] [TRT] Producer version: 2.8.0
[09/29/2025-12:04:31] [I] [TRT] Domain:
[09/29/2025-12:04:31] [I] [TRT] Model version: 0
[09/29/2025-12:04:31] [I] [TRT] Doc string:
[09/29/2025-12:04:31] [I] [TRT] ----------------------------------------------------------------
[09/29/2025-12:04:31] [W] [TRT] onnx2trt_utils.cpp:391: One or more weights outside the range of INT32 was clamped
[09/29/2025-12:04:31] [W] [TRT] onnx2trt_utils.cpp:391: One or more weights outside the range of INT32 was clamped
[09/29/2025-12:04:31] [W] [TRT] onnx2trt_utils.cpp:391: One or more weights outside the range of INT32 was clamped
[09/29/2025-12:04:31] [W] [TRT] onnx2trt_utils.cpp:391: One or more weights outside the range of INT32 was clamped
[09/29/2025-12:04:31] [W] [TRT] onnx2trt_utils.cpp:391: One or more weights outside the range of INT32 was clamped
[09/29/2025-12:04:31] [W] [TRT] onnx2trt_utils.cpp:391: One or more weights outside the range of INT32 was clamped
[09/29/2025-12:04:31] [W] [TRT] onnx2trt_utils.cpp:391: One or more weights outside the range of INT32 was clamped
[09/29/2025-12:04:31] [W] [TRT] onnx2trt_utils.cpp:391: One or more weights outside the range of INT32 was clamped
[09/29/2025-12:04:31] [W] [TRT] onnx2trt_utils.cpp:391: One or more weights outside the range of INT32 was clamped
[09/29/2025-12:04:31] [W] [TRT] onnx2trt_utils.cpp:391: One or more weights outside the range of INT32 was clamped
[09/29/2025-12:04:31] [W] [TRT] onnx2trt_utils.cpp:391: One or more weights outside the range of INT32 was clamped
[09/29/2025-12:04:31] [W] [TRT] onnx2trt_utils.cpp:391: One or more weights outside the range of INT32 was clamped
[09/29/2025-12:04:31] [W] [TRT] onnx2trt_utils.cpp:391: One or more weights outside the range of INT32 was clamped
[09/29/2025-12:04:31] [W] [TRT] builtin_op_importers.cpp:4900: TensorRT is using FLOAT32 precision to run an INT32 TopK. Rounding errors may occur for large integer values
[09/29/2025-12:04:31] [W] [TRT] onnx2trt_utils.cpp:391: One or more weights outside the range of INT32 was clamped
[09/29/2025-12:04:31] [W] [TRT] builtin_op_importers.cpp:4900: TensorRT is using FLOAT32 precision to run an INT32 TopK. Rounding errors may occur for large integer values
[09/29/2025-12:04:31] [W] [TRT] onnx2trt_utils.cpp:391: One or more weights outside the range of INT32 was clamped
[09/29/2025-12:04:31] [W] [TRT] builtin_op_importers.cpp:4900: TensorRT is using FLOAT32 precision to run an INT32 TopK. Rounding errors may occur for large integer values
[09/29/2025-12:04:31] [W] [TRT] onnx2trt_utils.cpp:391: One or more weights outside the range of INT32 was clamped
[09/29/2025-12:04:31] [E] [TRT] ModelImporter.cpp:771: While parsing node number 2170 [Squeeze -> "onnx::Shape_3420"]:
[09/29/2025-12:04:31] [E] [TRT] ModelImporter.cpp:772: --- Begin node ---
[09/29/2025-12:04:31] [E] [TRT] ModelImporter.cpp:773: input: "/Cast_3_output_0"
output: "onnx::Shape_3420"
name: "/Squeeze"
op_type: "Squeeze"
[09/29/2025-12:04:31] [E] [TRT] ModelImporter.cpp:774: --- End node ---
[09/29/2025-12:04:31] [E] [TRT] ModelImporter.cpp:776: ERROR: builtin_op_importers.cpp:4798 In function importSqueeze:
[8] Assertion failed: !isDynamic(shape) && "Cannot infer squeeze dimensions from a dynamic shape! Please re-export your model with the Squeeze axes input set."
[09/29/2025-12:04:31] [E] Failed to parse onnx file
[09/29/2025-12:04:31] [I] Finished parsing network model. Parse time: 0.701293
[09/29/2025-12:04:31] [E] Parsing model failed
[09/29/2025-12:04:31] [E] Failed to create engine from model or file.
[09/29/2025-12:04:31] [E] Engine set up failed
&&&& FAILED TensorRT.trtexec [TensorRT v8613] # trtexec --onnx=dump/model.onnx --saveEngine=model.engine