Instructions to use charcot-ai/marimba-quant-tensorrt with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- TensorRT
How to use charcot-ai/marimba-quant-tensorrt with TensorRT:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Add TensorRT engines, ONNX graphs and model card
Browse files- .gitattributes +20 -0
- README.md +145 -0
- engines/l4-trt10.12.0.36/trt-fp16-strong-2p/part_a.engine +3 -0
- engines/l4-trt10.12.0.36/trt-fp16-strong-2p/part_b.engine +3 -0
- engines/l4-trt10.12.0.36/trt-fp16-strong/part_a.engine +3 -0
- engines/l4-trt10.12.0.36/trt-fp16-strong/part_b.engine +3 -0
- engines/l4-trt10.12.0.36/trt-fp16/part_a.engine +3 -0
- engines/l4-trt10.12.0.36/trt-fp16/part_b.engine +3 -0
- engines/l4-trt10.12.0.36/trt-fp32/part_a.engine +3 -0
- engines/l4-trt10.12.0.36/trt-fp32/part_b.engine +3 -0
- engines/l4-trt10.12.0.36/trt-int8-a/part_a.engine +3 -0
- engines/l4-trt10.12.0.36/trt-int8-a/part_b.engine +3 -0
- engines/l4-trt10.12.0.36/trt-int8-conv/part_a.engine +3 -0
- engines/l4-trt10.12.0.36/trt-int8-conv/part_b.engine +3 -0
- engines/l4-trt10.12.0.36/trt-int8/part_a.engine +3 -0
- engines/l4-trt10.12.0.36/trt-int8/part_b.engine +3 -0
- engines/l4-trt10.16.1.11/trt-fp16-strong/part_a.engine +3 -0
- engines/l4-trt10.16.1.11/trt-fp16-strong/part_b.engine +3 -0
- engines/l4-trt10.16.1.11/trt-fp16/part_a.engine +3 -0
- engines/l4-trt10.16.1.11/trt-fp16/part_b.engine +3 -0
- marimba_trt.py +193 -0
- onnx/fp16/part_a.onnx +3 -0
- onnx/fp16/part_b.onnx +3 -0
- onnx/fp32/part_a.onnx +3 -0
- onnx/fp32/part_b.onnx +3 -0
- onnx/int8-qdq-conv/part_a.qdq.onnx +3 -0
- onnx/int8-qdq-conv/part_b.onnx +3 -0
- onnx/int8-qdq-layers-1-12/part_a.qdq.onnx +3 -0
- onnx/int8-qdq-layers-1-12/part_b.onnx +3 -0
- onnx/int8-qdq/part_a.qdq.onnx +3 -0
- onnx/int8-qdq/part_b.qdq.onnx +3 -0
- torch-tensorrt/l4-trt10.12.0.36/part_a.ep +3 -0
- torch-tensorrt/l4-trt10.12.0.36/part_b.ep +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,23 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
engines/l4-trt10.12.0.36/trt-fp16/part_a.engine filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
engines/l4-trt10.12.0.36/trt-fp16/part_b.engine filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
engines/l4-trt10.12.0.36/trt-fp16-strong/part_a.engine filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
engines/l4-trt10.12.0.36/trt-fp16-strong/part_b.engine filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
engines/l4-trt10.12.0.36/trt-fp16-strong-2p/part_a.engine filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
engines/l4-trt10.12.0.36/trt-fp16-strong-2p/part_b.engine filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
engines/l4-trt10.12.0.36/trt-fp32/part_a.engine filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
engines/l4-trt10.12.0.36/trt-fp32/part_b.engine filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
engines/l4-trt10.12.0.36/trt-int8/part_a.engine filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
engines/l4-trt10.12.0.36/trt-int8/part_b.engine filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
engines/l4-trt10.12.0.36/trt-int8-a/part_a.engine filter=lfs diff=lfs merge=lfs -text
|
| 47 |
+
engines/l4-trt10.12.0.36/trt-int8-a/part_b.engine filter=lfs diff=lfs merge=lfs -text
|
| 48 |
+
engines/l4-trt10.12.0.36/trt-int8-conv/part_a.engine filter=lfs diff=lfs merge=lfs -text
|
| 49 |
+
engines/l4-trt10.12.0.36/trt-int8-conv/part_b.engine filter=lfs diff=lfs merge=lfs -text
|
| 50 |
+
engines/l4-trt10.16.1.11/trt-fp16/part_a.engine filter=lfs diff=lfs merge=lfs -text
|
| 51 |
+
engines/l4-trt10.16.1.11/trt-fp16/part_b.engine filter=lfs diff=lfs merge=lfs -text
|
| 52 |
+
engines/l4-trt10.16.1.11/trt-fp16-strong/part_a.engine filter=lfs diff=lfs merge=lfs -text
|
| 53 |
+
engines/l4-trt10.16.1.11/trt-fp16-strong/part_b.engine filter=lfs diff=lfs merge=lfs -text
|
| 54 |
+
torch-tensorrt/l4-trt10.12.0.36/part_a.ep filter=lfs diff=lfs merge=lfs -text
|
| 55 |
+
torch-tensorrt/l4-trt10.12.0.36/part_b.ep filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: charcot-ai/marimba
|
| 4 |
+
library_name: marimba
|
| 5 |
+
tags:
|
| 6 |
+
- audio
|
| 7 |
+
- quantization
|
| 8 |
+
- tensorrt
|
| 9 |
+
- onnx
|
| 10 |
+
- int8
|
| 11 |
+
- fp16
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# Marimba audio encoder: TensorRT engines (fp16 and INT8)
|
| 15 |
+
|
| 16 |
+
TensorRT builds of the audio encoder used by [Marimba](https://huggingface.co/charcot-ai/marimba), with the ONNX graphs they were built from. The encoder is the frozen audio tower of [Qwen/Qwen3-ASR-0.6B](https://huggingface.co/Qwen/Qwen3-ASR-0.6B); Marimba reads its hidden states at layers 9, 12 and 18 and answers typed questions about an eight-second window of speech with small heads.
|
| 17 |
+
|
| 18 |
+
This repository holds **only the audio encoder**. The heads and the question API come from `charcot-ai/marimba` and the `marimba-audio` package.
|
| 19 |
+
|
| 20 |
+
## What is in the repository
|
| 21 |
+
|
| 22 |
+
The encoder is split in two graphs that share no weights, so a caller that needs only layers 9 and 12 never runs the last six layers:
|
| 23 |
+
|
| 24 |
+
- `part_a`: log-mel `[B, 128, 800]` → hidden states of layers 9 and 12, each `[B, 104, 896]`;
|
| 25 |
+
- `part_b`: hidden state of layer 12 → hidden state of layer 18, `[B, 104, 896]`.
|
| 26 |
+
|
| 27 |
+
| Path | Content |
|
| 28 |
+
|---|---|
|
| 29 |
+
| `onnx/fp16/` | ONNX graphs exported in fp16 (opset 17). Source of the strongly typed fp16 engines. |
|
| 30 |
+
| `onnx/fp32/` | ONNX graphs in fp32. Source of the fp32 and weakly typed fp16 engines. |
|
| 31 |
+
| `onnx/int8-qdq/` | ONNX graphs with explicit Q/DQ nodes on both parts. |
|
| 32 |
+
| `onnx/int8-qdq-layers-1-12/` | Q/DQ on part A only; part B is the fp16 graph. |
|
| 33 |
+
| `onnx/int8-qdq-conv/` | Q/DQ on the three convolutions of part A only; everything else is fp16. |
|
| 34 |
+
| `engines/l4-trt10.12.0.36/<variant>/` | Engines built on an NVIDIA L4 with TensorRT 10.12.0.36. |
|
| 35 |
+
| `engines/l4-trt10.16.1.11/<variant>/` | Engines built on an NVIDIA L4 with TensorRT 10.16.1.11. |
|
| 36 |
+
| `torch-tensorrt/l4-trt10.12.0.36/` | Torch-TensorRT 2.8.0 programs (`.ep`) built on an NVIDIA L4. |
|
| 37 |
+
| `marimba_trt.py` | Loads a pair of engines and rebuilds engines from the ONNX graphs. |
|
| 38 |
+
|
| 39 |
+
A TensorRT engine loads only on the GPU model and the TensorRT version it was built with. On any other GPU, build the engines from the ONNX graphs; it takes about one minute on an L4.
|
| 40 |
+
|
| 41 |
+
## Evaluation
|
| 42 |
+
|
| 43 |
+
1,170 public eight-second windows (16 kHz mono) drawn from Smart Turn v3.2 test, VoxConverse test, AMI IHM test, ESC-50 (classes without human sounds) and FLEURS `pt_br` validation. Each encoder variant feeds the unchanged Marimba heads; the reference row is the PyTorch encoder in fp32 on CPU. "Decisions changed" counts, over the six decisions and all windows, how many final decisions differ from the fp32 reference.
|
| 44 |
+
|
| 45 |
+
Engines built with TensorRT 10.12.0.36 on an NVIDIA L4:
|
| 46 |
+
|
| 47 |
+
| Artifact | Scheme | Size (MB) | `turn_end` AUROC | `voice_activity` AUROC (last 1 s) | `voice_activity` AUROC (8 s) | `same_speaker` AUROC | `speaker_change` AUROC | `speaker_count` accuracy | Largest probability change vs. fp32 | Decisions changed vs. fp32 |
|
| 48 |
+
|---|---|---|---|---|---|---|---|---|---|---|
|
| 49 |
+
| fp32 reference (PyTorch, CPU) | 32-bit float | 745 (in memory) | 0.9310 | 0.9969 | 0.9999 | 0.9926 | 0.9557 | 0.7862 | - | - |
|
| 50 |
+
| `trt-fp16-strong` | fp16, strongly typed | 377 | 0.9308 | 0.9969 | 0.9999 | 0.9927 | 0.9557 | 0.7851 | 0.082 | 4 |
|
| 51 |
+
| `trt-fp16-strong-2p` | fp16, strongly typed, two batch profiles | 489 | 0.9308 | 0.9969 | 0.9999 | 0.9927 | 0.9557 | 0.7851 | 0.082 | 4 |
|
| 52 |
+
| `torchtrt-fp16-strong` | fp16, explicit typing (Torch-TensorRT) | 502 | 0.9311 | 0.9969 | 0.9999 | 0.9926 | 0.9557 | 0.7862 | 0.083 | 3 |
|
| 53 |
+
| `trt-int8-a` | INT8 Q/DQ up to layer 12, fp16 above | 249 | 0.9294 | 0.9968 | 0.9999 | 0.9945 | 0.9559 | 0.7874 | 0.482 | 132 |
|
| 54 |
+
| `trt-int8-conv` | INT8 Q/DQ on the convolutions only, fp16 elsewhere | 373 | 0.9304 | 0.9969 | 0.9999 | 0.9927 | 0.9561 | 0.7885 | 0.470 | 49 |
|
| 55 |
+
| `trt-int8` | INT8 Q/DQ, fp16 where not quantized | 192 | 0.8151 | 0.9968 | 0.9999 | 0.9945 | 0.9559 | 0.7874 | 0.946 | 409 |
|
| 56 |
+
| `trt-fp16` | fp16 chosen by TensorRT (weak typing) | 377 | 0.5029 | 0.3805 | 0.3098 | 0.6281 | 0.5431 | 0.2805 | 1.000 | 3579 |
|
| 57 |
+
| `trt-fp32` | 32-bit float | 743 | 0.9310 | 0.9969 | 0.9999 | 0.9926 | 0.9557 | 0.7862 | 0.004 | 1 |
|
| 58 |
+
|
| 59 |
+
The same ONNX graphs built with TensorRT 10.16.1.11 on the same GPU:
|
| 60 |
+
|
| 61 |
+
| Artifact | Scheme | Size (MB) | `turn_end` AUROC | `voice_activity` AUROC (last 1 s) | `voice_activity` AUROC (8 s) | `same_speaker` AUROC | `speaker_change` AUROC | `speaker_count` accuracy | Largest probability change vs. fp32 | Decisions changed vs. fp32 |
|
| 62 |
+
|---|---|---|---|---|---|---|---|---|---|---|
|
| 63 |
+
| `trt-fp16` | fp16 chosen by TensorRT (weak typing) | 376 | 0.9307 | 0.9969 | 0.9999 | 0.9928 | 0.9558 | 0.7862 | 0.066 | 5 |
|
| 64 |
+
| `trt-fp16-strong` | fp16, strongly typed | 376 | 0.9308 | 0.9969 | 0.9999 | 0.9927 | 0.9557 | 0.7851 | 0.082 | 4 |
|
| 65 |
+
|
| 66 |
+
Notes on the rows:
|
| 67 |
+
|
| 68 |
+
- `trt-fp16` lets TensorRT choose the precision of each layer of the fp32 graph (the `FP16` builder flag). With TensorRT 10.12.0.36 the hidden states of that engine diverge from the reference (`turn_end` AUROC 0.5029, 3,579 decisions changed); with 10.16.1.11 the same graph gives 0.9307 and 5 decisions changed. The strongly typed engine, whose precision is fixed by the fp16 ONNX graph, gives the same numbers on both versions.
|
| 69 |
+
- `trt-int8` changes `turn_end`, the question that reads layer 18. The two partial INT8 variants keep the AUROCs but move individual probabilities much more than fp16 does.
|
| 70 |
+
|
| 71 |
+
## Latency
|
| 72 |
+
|
| 73 |
+
All rows: one NVIDIA L4 (24 GB), host AMD EPYC 9254, PyTorch 2.8.0+cu128 with 4 CPU threads, one process, p50 over repeated calls. A call takes `B` windows of raw audio, computes the log-mel on the GPU, runs the encoder and copies the hidden states to the host. `base-bf16` is the `marimba-audio` package (PyTorch, bf16) on the same machine; `graph-bf16` is the same PyTorch encoder loaded without the text decoder; `compile-default` is `torch.compile` on it.
|
| 74 |
+
|
| 75 |
+
| Variant | TensorRT | Layers 1-12, batch 1 (ms) | Layers 1-12, batch 16 (ms) | Layers 1-18, batch 1 (ms) | Layers 1-18, batch 16 (ms) | Windows/s, layers 1-12 | Windows/s, layers 1-18 | Peak VRAM (MB) | Load (s) |
|
| 76 |
+
|---|---|---|---|---|---|---|---|---|---|
|
| 77 |
+
| `base-bf16` | - | 7.4 | 34.4 | 7.1 | 40.0 | 465 | 401 | 4,140 | 10.69 |
|
| 78 |
+
| `graph-bf16` | - | 3.2 | 33.7 | 4.1 | 40.0 | 476 | 401 | 2,782 | 3.99 |
|
| 79 |
+
| `compile-default` | - | 3.2 | 28.9 | 4.1 | 33.8 | 555 | 472 | 2,362 | 5.3 |
|
| 80 |
+
| `trt-fp16-strong` | 10.12.0.36 | 4.3 | 26.6 | 6.0 | 31.3 | 599 | 512 | 2,274 | 0.31 |
|
| 81 |
+
| `trt-fp16-strong-2p` | 10.12.0.36 | 2.7 | 26.3 | 3.5 | 31.2 | 610 | 515 | 3,844 | 0.8 |
|
| 82 |
+
| `torchtrt-fp16-strong` | 10.12.0.36 | 4.3 | 26.2 | 5.8 | 31.1 | 609 | 516 | 3,922 | 67.76 |
|
| 83 |
+
| `trt-int8-a` | 10.12.0.36 | 3.0 | 20.0 | 4.6 | 25.4 | 794 | 629 | 2,165 | 0.35 |
|
| 84 |
+
| `trt-int8-conv` | 10.12.0.36 | 4.2 | 25.3 | 5.8 | 30.0 | 633 | 534 | 2,265 | 0.46 |
|
| 85 |
+
| `trt-int8` | 10.12.0.36 | 3.0 | 20.1 | 4.0 | 23.7 | 794 | 677 | 2,024 | 0.35 |
|
| 86 |
+
| `trt-fp16` | 10.12.0.36 | 4.4 | 26.8 | 6.1 | 31.6 | 598 | 508 | 3,464 | 0.22 |
|
| 87 |
+
| `trt-fp32` | 10.12.0.36 | 6.0 | 54.4 | 7.9 | 64.8 | 294 | 247 | 4,200 | 0.2 |
|
| 88 |
+
|
| 89 |
+
TensorRT 10.16.1.11, same machine:
|
| 90 |
+
|
| 91 |
+
| Variant | TensorRT | Layers 1-12, batch 1 (ms) | Layers 1-12, batch 16 (ms) | Layers 1-18, batch 1 (ms) | Layers 1-18, batch 16 (ms) | Windows/s, layers 1-12 | Windows/s, layers 1-18 | Peak VRAM (MB) | Load (s) |
|
| 92 |
+
|---|---|---|---|---|---|---|---|---|---|
|
| 93 |
+
| `trt-fp16` | 10.16.1.11 | 4.3 | 26.5 | 5.8 | 31.5 | 600 | 510 | 3,613 | 0.31 |
|
| 94 |
+
| `trt-fp16-strong` | 10.16.1.11 | 4.2 | 26.7 | 5.8 | 31.7 | 600 | 507 | 2,230 | 0.35 |
|
| 95 |
+
|
| 96 |
+
Two processes on the same L4, each with its own engine, batch 16, layers 1-12: `base-bf16` 425 windows/s in total, `trt-fp16-strong` 557, `trt-int8-a` 728.
|
| 97 |
+
|
| 98 |
+
## Usage
|
| 99 |
+
|
| 100 |
+
```python
|
| 101 |
+
import numpy as np
|
| 102 |
+
from huggingface_hub import snapshot_download
|
| 103 |
+
from marimba_trt import Encoder
|
| 104 |
+
|
| 105 |
+
path = snapshot_download(
|
| 106 |
+
"charcot-ai/marimba-quant-tensorrt",
|
| 107 |
+
allow_patterns=["marimba_trt.py", "engines/l4-trt10.12.0.36/trt-fp16-strong/*"],
|
| 108 |
+
)
|
| 109 |
+
encoder = Encoder(f"{path}/engines/l4-trt10.12.0.36/trt-fp16-strong")
|
| 110 |
+
|
| 111 |
+
windows = np.zeros((4, 128_000), dtype=np.float32) # four windows of 8 s at 16 kHz
|
| 112 |
+
states = encoder(windows, last_layer=18) # {9: ..., 12: ..., 18: ...}, float32 [4, 104, 896]
|
| 113 |
+
hop = encoder(windows, last_layer=12) # layers 9 and 12 only; part B does not run
|
| 114 |
+
on_gpu = encoder.states(windows) # the same states as CUDA tensors
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
+
On another GPU model or TensorRT version, build the engines first:
|
| 118 |
+
|
| 119 |
+
```bash
|
| 120 |
+
python marimba_trt.py build onnx/fp16 my-engines # one profile, batches 1-32
|
| 121 |
+
python marimba_trt.py build onnx/fp16 my-engines --two-profiles # faster batch 1, larger file
|
| 122 |
+
```
|
| 123 |
+
|
| 124 |
+
Versions used: Python 3.12, `tensorrt-cu12` 10.12.0.36 (and 10.16.1.11 for the second set), `torch` 2.8.0+cu128, `torch_tensorrt` 2.8.0, `transformers` 4.57.6, `onnx` 1.21.0, `nvidia-modelopt` 0.48.0, `marimba-audio` at commit `f58980ab80a54943929074aff23159caa026c7cf`, CUDA 12.8.
|
| 125 |
+
|
| 126 |
+
## How the artifacts were made
|
| 127 |
+
|
| 128 |
+
- **ONNX export:** `torch.onnx.export` of the two parts of the audio tower of `Qwen/Qwen3-ASR-0.6B` (revision `5eb144179a02acc5e5ba31e748d22b0cf3e303b0`), with a dynamic batch axis.
|
| 129 |
+
- **fp16 engines:** `STRONGLY_TYPED` network from the fp16 graph, one optimization profile with batches (1, 16, 32); the `-2p` variant has two profiles, (1, 1, 1) and (2, 16, 32).
|
| 130 |
+
- **INT8 engines:** explicit quantization (Q/DQ) with NVIDIA Model Optimizer 0.48.0 (`modelopt.onnx.quantization.quantize`, entropy calibration, fp16 for the layers left unquantized), then a strongly typed TensorRT build.
|
| 131 |
+
- **Calibration data:** 352 public eight-second windows, none of them in the evaluation set: Smart Turn v3.2 train (`pipecat-ai/smart-turn-data-v3.2-train`), VoxConverse dev and AMI IHM train (`diarizers-community/voxconverse`, `diarizers-community/ami`), and FLEURS train in English and Spanish (`google/fleurs`).
|
| 132 |
+
|
| 133 |
+
## Limitations
|
| 134 |
+
|
| 135 |
+
- Engines are tied to the GPU model and TensorRT version in their path. Loading one elsewhere fails or is unsupported.
|
| 136 |
+
- The engines accept batches of 1 to 32 windows of exactly eight seconds.
|
| 137 |
+
- The log-mel front end is not inside the engines; `marimba_trt.py` computes it on the GPU with PyTorch.
|
| 138 |
+
- The INT8 variants were calibrated, not trained, and the Marimba heads were not refitted on quantized states.
|
| 139 |
+
- Latency was measured on one GPU model. Other GPUs give other ratios between fp16 and INT8.
|
| 140 |
+
|
| 141 |
+
## Attribution
|
| 142 |
+
|
| 143 |
+
- Backbone: [Qwen/Qwen3-ASR-0.6B](https://huggingface.co/Qwen/Qwen3-ASR-0.6B), Apache-2.0.
|
| 144 |
+
- Heads and package: [charcot-ai/marimba](https://huggingface.co/charcot-ai/marimba), Apache-2.0.
|
| 145 |
+
- Tools: NVIDIA TensorRT 10.12.0.36 and 10.16.1.11, Torch-TensorRT 2.8.0, NVIDIA Model Optimizer 0.48.0.
|
engines/l4-trt10.12.0.36/trt-fp16-strong-2p/part_a.engine
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b816bf105dd9783c94afa12dabcaa7598db0f04a9eaba7139c96015447553a8b
|
| 3 |
+
size 340363252
|
engines/l4-trt10.12.0.36/trt-fp16-strong-2p/part_b.engine
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:250e290d729b1fc157ed17f51d82dbe994b875494ed8cd192b264d5b470ab04b
|
| 3 |
+
size 148924268
|
engines/l4-trt10.12.0.36/trt-fp16-strong/part_a.engine
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2b8dd51ab7876efa4941c941e9cc5150f34a8ecf5a4d6f5b8227cd72506af437
|
| 3 |
+
size 258742660
|
engines/l4-trt10.12.0.36/trt-fp16-strong/part_b.engine
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7bdcbe4c8180dc3ee3329315296fd68de82f7a5f54232b1e5f12156c994ec74b
|
| 3 |
+
size 118057908
|
engines/l4-trt10.12.0.36/trt-fp16/part_a.engine
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f9184e45b9da14fa3a544621894dcbe9e5908984e22066c6b343dfa1527b2945
|
| 3 |
+
size 258675492
|
engines/l4-trt10.12.0.36/trt-fp16/part_b.engine
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d853716603023dfa026422f5a5249e91cbdf0c03e73cdf378dc42d56218db199
|
| 3 |
+
size 118048116
|
engines/l4-trt10.12.0.36/trt-fp32/part_a.engine
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2f624221ef5b1d5e7cbc12936b1c8989c8ed48b37d003f64f24f8b019735402b
|
| 3 |
+
size 510081396
|
engines/l4-trt10.12.0.36/trt-fp32/part_b.engine
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9a9f303ba39e7386822a00a2304763c1b0da8e90c7052e399ea034ff293b9831
|
| 3 |
+
size 232456500
|
engines/l4-trt10.12.0.36/trt-int8-a/part_a.engine
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0af022461d13f8e5ff36417a0955699b158bb9b32abdcde77402038c415fdb18
|
| 3 |
+
size 131363828
|
engines/l4-trt10.12.0.36/trt-int8-a/part_b.engine
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7bdcbe4c8180dc3ee3329315296fd68de82f7a5f54232b1e5f12156c994ec74b
|
| 3 |
+
size 118057908
|
engines/l4-trt10.12.0.36/trt-int8-conv/part_a.engine
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8c8d54e3ec079234ca0939c4f55e96e7d5002a9c9888acad3055db136f23c400
|
| 3 |
+
size 254639444
|
engines/l4-trt10.12.0.36/trt-int8-conv/part_b.engine
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7bdcbe4c8180dc3ee3329315296fd68de82f7a5f54232b1e5f12156c994ec74b
|
| 3 |
+
size 118057908
|
engines/l4-trt10.12.0.36/trt-int8/part_a.engine
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0af022461d13f8e5ff36417a0955699b158bb9b32abdcde77402038c415fdb18
|
| 3 |
+
size 131363828
|
engines/l4-trt10.12.0.36/trt-int8/part_b.engine
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:62099c9d578683a0589ae74422b7107f1d6f63bce935e9bf19a2c16939247b6b
|
| 3 |
+
size 60280004
|
engines/l4-trt10.16.1.11/trt-fp16-strong/part_a.engine
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5cd8ff29cbd194cf92ad211a9dbad3a720ecce2ad7461d7a6ea8e6d3aa6dce37
|
| 3 |
+
size 257924756
|
engines/l4-trt10.16.1.11/trt-fp16-strong/part_b.engine
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7bb802f7932812d2f662412a457ed8a181360dde7a4375dfcedbfab47bf6d797
|
| 3 |
+
size 117901404
|
engines/l4-trt10.16.1.11/trt-fp16/part_a.engine
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b7f2d3c493199f7eab2bc508e19d3cafca15cc7b71a26668de1548eb4da5a65f
|
| 3 |
+
size 257881348
|
engines/l4-trt10.16.1.11/trt-fp16/part_b.engine
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8f4f1d342d5da658c316f4ae065795fb4ba4e1f7cddc050fb4b3c381939b7832
|
| 3 |
+
size 117891428
|
marimba_trt.py
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Run and rebuild the TensorRT engines of the Marimba audio encoder.
|
| 2 |
+
|
| 3 |
+
The encoder is split in two engines that share no weights:
|
| 4 |
+
|
| 5 |
+
* part A: log-mel ``[B, 128, 800]`` -> hidden states of layers 9 and 12, each ``[B, 104, 896]``;
|
| 6 |
+
* part B: hidden state of layer 12 -> hidden state of layer 18, ``[B, 104, 896]``.
|
| 7 |
+
|
| 8 |
+
encoder = Encoder("engines/l4-trt10.12.0.36/trt-fp16-strong")
|
| 9 |
+
states = encoder(windows, last_layer=18) # {9: ..., 12: ..., 18: ...}
|
| 10 |
+
|
| 11 |
+
A TensorRT engine only loads on the GPU model and TensorRT version it was built with. On any
|
| 12 |
+
other GPU, rebuild it from the ONNX files:
|
| 13 |
+
|
| 14 |
+
python marimba_trt.py build onnx/fp16 my-engines
|
| 15 |
+
"""
|
| 16 |
+
|
| 17 |
+
from __future__ import annotations
|
| 18 |
+
|
| 19 |
+
import argparse
|
| 20 |
+
import time
|
| 21 |
+
from pathlib import Path
|
| 22 |
+
|
| 23 |
+
import numpy as np
|
| 24 |
+
import tensorrt as trt
|
| 25 |
+
import torch
|
| 26 |
+
|
| 27 |
+
SAMPLES, BINS, MEL_FRAMES, FRAMES, DIM = 128_000, 128, 800, 104, 896
|
| 28 |
+
INPUT_SHAPES = {"part_a": (BINS, MEL_FRAMES), "part_b": (FRAMES, DIM)}
|
| 29 |
+
BACKBONE = "Qwen/Qwen3-ASR-0.6B"
|
| 30 |
+
BACKBONE_REVISION = "5eb144179a02acc5e5ba31e748d22b0cf3e303b0"
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
class LogMel(torch.nn.Module):
|
| 34 |
+
"""The Whisper log-mel arithmetic of the backbone, on the device."""
|
| 35 |
+
|
| 36 |
+
def __init__(self) -> None:
|
| 37 |
+
super().__init__()
|
| 38 |
+
from transformers import WhisperFeatureExtractor
|
| 39 |
+
|
| 40 |
+
extractor = WhisperFeatureExtractor.from_pretrained(BACKBONE, revision=BACKBONE_REVISION)
|
| 41 |
+
self.n_fft, self.hop = extractor.n_fft, extractor.hop_length
|
| 42 |
+
self.register_buffer("window", torch.hann_window(self.n_fft), persistent=False)
|
| 43 |
+
filters = torch.from_numpy(np.asarray(extractor.mel_filters)).to(torch.float32)
|
| 44 |
+
self.register_buffer("filters", filters, persistent=False)
|
| 45 |
+
|
| 46 |
+
def forward(self, waveform: torch.Tensor) -> torch.Tensor:
|
| 47 |
+
stft = torch.stft(waveform, self.n_fft, self.hop, window=self.window, return_complex=True)
|
| 48 |
+
magnitudes = stft[..., :-1].abs() ** 2
|
| 49 |
+
spectrum = torch.clamp(self.filters.T @ magnitudes, min=1e-10).log10()
|
| 50 |
+
spectrum = torch.maximum(spectrum, spectrum.amax(dim=(1, 2), keepdim=True) - 8.0)
|
| 51 |
+
return (spectrum + 4.0) / 4.0
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
class Engine:
|
| 55 |
+
"""One serialized engine, fed with torch CUDA tensors (no host copies)."""
|
| 56 |
+
|
| 57 |
+
def __init__(self, path: str | Path) -> None:
|
| 58 |
+
self.logger = trt.Logger(trt.Logger.WARNING)
|
| 59 |
+
self.runtime = trt.Runtime(self.logger)
|
| 60 |
+
self.engine = self.runtime.deserialize_cuda_engine(Path(path).read_bytes())
|
| 61 |
+
if self.engine is None:
|
| 62 |
+
raise RuntimeError(f"{path} does not load on this GPU and TensorRT {trt.__version__}")
|
| 63 |
+
# TensorRT adds its own synchronization when it is given the default stream.
|
| 64 |
+
self.stream = torch.cuda.Stream()
|
| 65 |
+
# One context per optimization profile; the weights are shared by all of them.
|
| 66 |
+
self.contexts = []
|
| 67 |
+
for index in range(self.engine.num_optimization_profiles):
|
| 68 |
+
context = self.engine.create_execution_context()
|
| 69 |
+
if index:
|
| 70 |
+
context.set_optimization_profile_async(index, self.stream.cuda_stream)
|
| 71 |
+
self.contexts.append(context)
|
| 72 |
+
self.stream.synchronize()
|
| 73 |
+
names = [self.engine.get_tensor_name(i) for i in range(self.engine.num_io_tensors)]
|
| 74 |
+
mode = trt.TensorIOMode
|
| 75 |
+
self.inputs = [n for n in names if self.engine.get_tensor_mode(n) == mode.INPUT]
|
| 76 |
+
self.outputs = [n for n in names if self.engine.get_tensor_mode(n) == mode.OUTPUT]
|
| 77 |
+
kinds = {trt.float32: torch.float32, trt.float16: torch.float16}
|
| 78 |
+
self.dtypes = {n: kinds[self.engine.get_tensor_dtype(n)] for n in names}
|
| 79 |
+
self.ranges = []
|
| 80 |
+
for index in range(len(self.contexts)):
|
| 81 |
+
low, _, high = self.engine.get_tensor_profile_shape(self.inputs[0], index)
|
| 82 |
+
self.ranges.append((int(low[0]), int(high[0])))
|
| 83 |
+
|
| 84 |
+
def context_for(self, batch: int) -> trt.IExecutionContext:
|
| 85 |
+
"""The context of the narrowest profile that holds this batch."""
|
| 86 |
+
fits = [
|
| 87 |
+
(high - low, index)
|
| 88 |
+
for index, (low, high) in enumerate(self.ranges)
|
| 89 |
+
if low <= batch <= high
|
| 90 |
+
]
|
| 91 |
+
if not fits:
|
| 92 |
+
raise ValueError(f"batch {batch} is outside the engine profiles {self.ranges}")
|
| 93 |
+
return self.contexts[min(fits)[1]]
|
| 94 |
+
|
| 95 |
+
def __call__(self, tensor: torch.Tensor) -> tuple[torch.Tensor, ...]:
|
| 96 |
+
name = self.inputs[0]
|
| 97 |
+
tensor = tensor.to(self.dtypes[name]).contiguous()
|
| 98 |
+
context = self.context_for(tensor.shape[0])
|
| 99 |
+
context.set_input_shape(name, tuple(tensor.shape))
|
| 100 |
+
context.set_tensor_address(name, tensor.data_ptr())
|
| 101 |
+
outputs = []
|
| 102 |
+
for output in self.outputs:
|
| 103 |
+
shape = tuple(context.get_tensor_shape(output))
|
| 104 |
+
buffer = torch.empty(shape, dtype=self.dtypes[output], device=tensor.device)
|
| 105 |
+
context.set_tensor_address(output, buffer.data_ptr())
|
| 106 |
+
outputs.append(buffer)
|
| 107 |
+
torch.cuda.current_stream().synchronize()
|
| 108 |
+
if not context.execute_async_v3(self.stream.cuda_stream):
|
| 109 |
+
raise RuntimeError("TensorRT execution failed")
|
| 110 |
+
self.stream.synchronize()
|
| 111 |
+
return tuple(outputs)
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
class Encoder:
|
| 115 |
+
"""Eight-second 16 kHz mono windows -> hidden states of layers 9, 12 and 18."""
|
| 116 |
+
|
| 117 |
+
def __init__(self, directory: str | Path) -> None:
|
| 118 |
+
directory = Path(directory)
|
| 119 |
+
self.frontend = LogMel().to("cuda")
|
| 120 |
+
self.part_a = Engine(directory / "part_a.engine")
|
| 121 |
+
self.part_b = Engine(directory / "part_b.engine")
|
| 122 |
+
|
| 123 |
+
@torch.inference_mode()
|
| 124 |
+
def states(self, windows: np.ndarray, last_layer: int = 18) -> dict[int, torch.Tensor]:
|
| 125 |
+
"""States as CUDA tensors. ``last_layer=12`` skips part B."""
|
| 126 |
+
waveform = torch.from_numpy(np.ascontiguousarray(windows)).to("cuda", torch.float32)
|
| 127 |
+
layer9, layer12 = self.part_a(self.frontend(waveform))[:2]
|
| 128 |
+
output = {9: layer9, 12: layer12}
|
| 129 |
+
if last_layer == 18:
|
| 130 |
+
output[18] = self.part_b(layer12)[0]
|
| 131 |
+
return output
|
| 132 |
+
|
| 133 |
+
def __call__(self, windows: np.ndarray, last_layer: int = 18) -> dict[int, np.ndarray]:
|
| 134 |
+
"""States as float32 arrays ``[B, 104, 896]`` on the host."""
|
| 135 |
+
# Marimba keeps layers 12 and 18 at float16 precision before the readouts.
|
| 136 |
+
return {
|
| 137 |
+
layer: (state if layer == 9 else state.to(torch.float16)).float().cpu().numpy()
|
| 138 |
+
for layer, state in self.states(windows, last_layer).items()
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
|
| 142 |
+
def build(
|
| 143 |
+
onnx_path: Path,
|
| 144 |
+
engine_path: Path,
|
| 145 |
+
profiles: tuple[tuple[int, int, int], ...] = ((1, 16, 32),),
|
| 146 |
+
strongly_typed: bool = True,
|
| 147 |
+
) -> float:
|
| 148 |
+
"""Builds one engine; each profile is (min, optimal, max) batch. Returns the seconds."""
|
| 149 |
+
logger = trt.Logger(trt.Logger.WARNING)
|
| 150 |
+
builder = trt.Builder(logger)
|
| 151 |
+
flags = 1 << int(trt.NetworkDefinitionCreationFlag.STRONGLY_TYPED) if strongly_typed else 0
|
| 152 |
+
network = builder.create_network(flags)
|
| 153 |
+
parser = trt.OnnxParser(network, logger)
|
| 154 |
+
if not parser.parse_from_file(str(onnx_path)):
|
| 155 |
+
errors = [str(parser.get_error(i)) for i in range(parser.num_errors)]
|
| 156 |
+
raise RuntimeError(f"ONNX parse failed: {errors}")
|
| 157 |
+
config = builder.create_builder_config()
|
| 158 |
+
name = network.get_input(0).name
|
| 159 |
+
shape = INPUT_SHAPES[onnx_path.name.split(".")[0]]
|
| 160 |
+
for sizes in profiles:
|
| 161 |
+
profile = builder.create_optimization_profile()
|
| 162 |
+
profile.set_shape(name, *[(batch, *shape) for batch in sizes])
|
| 163 |
+
config.add_optimization_profile(profile)
|
| 164 |
+
started = time.perf_counter()
|
| 165 |
+
serialized = builder.build_serialized_network(network, config)
|
| 166 |
+
if serialized is None:
|
| 167 |
+
raise RuntimeError("TensorRT build failed")
|
| 168 |
+
engine_path.write_bytes(bytes(serialized))
|
| 169 |
+
return time.perf_counter() - started
|
| 170 |
+
|
| 171 |
+
|
| 172 |
+
def main() -> None:
|
| 173 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 174 |
+
commands = parser.add_subparsers(dest="command", required=True)
|
| 175 |
+
command = commands.add_parser("build", help="build both engines from a directory of ONNX")
|
| 176 |
+
command.add_argument("onnx", type=Path)
|
| 177 |
+
command.add_argument("out", type=Path)
|
| 178 |
+
command.add_argument(
|
| 179 |
+
"--two-profiles",
|
| 180 |
+
action="store_true",
|
| 181 |
+
help="one profile for batch 1 and one for batches 2-32, instead of one for 1-32",
|
| 182 |
+
)
|
| 183 |
+
args = parser.parse_args()
|
| 184 |
+
args.out.mkdir(parents=True, exist_ok=True)
|
| 185 |
+
profiles = ((1, 1, 1), (2, 16, 32)) if args.two_profiles else ((1, 16, 32),)
|
| 186 |
+
for part in ("part_a", "part_b"):
|
| 187 |
+
source = next(args.onnx.glob(f"{part}*.onnx"))
|
| 188 |
+
seconds = build(source, args.out / f"{part}.engine", profiles)
|
| 189 |
+
print(f"{part}: {seconds:.1f} s")
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
if __name__ == "__main__":
|
| 193 |
+
main()
|
onnx/fp16/part_a.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d3462a8997f16a67e71f58563d3c9306fa4a2814b5c7a2aad84e2d480ddff6c1
|
| 3 |
+
size 253704704
|
onnx/fp16/part_b.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:dda4fce19c132ba038907dd6ff4be61b5c018141fc0bf3e08602ff4beb8d886d
|
| 3 |
+
size 115803090
|
onnx/fp32/part_a.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5c5984ca9a99cccbb2cbfedadc8d1dedf7f51365b137c385968ed43d9e696772
|
| 3 |
+
size 507284363
|
onnx/fp32/part_b.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:57dcd7c9effffc4cafe5761057634844a676630d8cdc0ffc716e0b7f54dad314
|
| 3 |
+
size 231547026
|
onnx/int8-qdq-conv/part_a.qdq.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9c47ca93881217e0a816e47c558b0f2c229227644fb3a78bf12f6fdc3bca00a3
|
| 3 |
+
size 253810138
|
onnx/int8-qdq-conv/part_b.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:dda4fce19c132ba038907dd6ff4be61b5c018141fc0bf3e08602ff4beb8d886d
|
| 3 |
+
size 115803090
|
onnx/int8-qdq-layers-1-12/part_a.qdq.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:25e23f6278dc824e005d91cc62b88f4809b964dc7e13a878d541beece412bf84
|
| 3 |
+
size 254588679
|
onnx/int8-qdq-layers-1-12/part_b.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:dda4fce19c132ba038907dd6ff4be61b5c018141fc0bf3e08602ff4beb8d886d
|
| 3 |
+
size 115803090
|
onnx/int8-qdq/part_a.qdq.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:25e23f6278dc824e005d91cc62b88f4809b964dc7e13a878d541beece412bf84
|
| 3 |
+
size 254588679
|
onnx/int8-qdq/part_b.qdq.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2f0b8eab9f2b23d57a2b0eda0de118f7fc437b99d07b78d61bb70d68e6026666
|
| 3 |
+
size 116229551
|
torch-tensorrt/l4-trt10.12.0.36/part_a.ep
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c2ea3534804ee0cd10b7661091c363d0c5a84a1341802361c22b71a56ffe6117
|
| 3 |
+
size 344803160
|
torch-tensorrt/l4-trt10.12.0.36/part_b.ep
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9ff8eadd7b99019f2a6884ba56b72b122d33775adfdfffd5cbb7926ca698644a
|
| 3 |
+
size 157419736
|