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
|
Download README.md from charcot-ai/marimba-quant-tensorrt: direct link, hf CLI and curl.
- Browser
- Download file 10.6 kB
-
https://huggingface.co/charcot-ai/marimba-quant-tensorrt/resolve/main/README.md
- Command line
-
hf download hf://charcot-ai/marimba-quant-tensorrt/README.md
-
curl -L -o README.md https://huggingface.co/charcot-ai/marimba-quant-tensorrt/resolve/main/README.md
10.6 kB
| license: apache-2.0 | |
| base_model: charcot-ai/marimba | |
| library_name: marimba | |
| tags: | |
| - audio | |
| - quantization | |
| - tensorrt | |
| - onnx | |
| - int8 | |
| - fp16 | |
| # Marimba audio encoder: TensorRT engines (fp16 and INT8) | |
| 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. | |
| This repository holds **only the audio encoder**. The heads and the question API come from `charcot-ai/marimba` and the `marimba-audio` package. | |
| ## What is in the repository | |
| 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: | |
| - `part_a`: log-mel `[B, 128, 800]` → hidden states of layers 9 and 12, each `[B, 104, 896]`; | |
| - `part_b`: hidden state of layer 12 → hidden state of layer 18, `[B, 104, 896]`. | |
| | Path | Content | | |
| |---|---| | |
| | `onnx/fp16/` | ONNX graphs exported in fp16 (opset 17). Source of the strongly typed fp16 engines. | | |
| | `onnx/fp32/` | ONNX graphs in fp32. Source of the fp32 and weakly typed fp16 engines. | | |
| | `onnx/int8-qdq/` | ONNX graphs with explicit Q/DQ nodes on both parts. | | |
| | `onnx/int8-qdq-layers-1-12/` | Q/DQ on part A only; part B is the fp16 graph. | | |
| | `onnx/int8-qdq-conv/` | Q/DQ on the three convolutions of part A only; everything else is fp16. | | |
| | `engines/l4-trt10.12.0.36/<variant>/` | Engines built on an NVIDIA L4 with TensorRT 10.12.0.36. | | |
| | `engines/l4-trt10.16.1.11/<variant>/` | Engines built on an NVIDIA L4 with TensorRT 10.16.1.11. | | |
| | `torch-tensorrt/l4-trt10.12.0.36/` | Torch-TensorRT 2.8.0 programs (`.ep`) built on an NVIDIA L4. | | |
| | `marimba_trt.py` | Loads a pair of engines and rebuilds engines from the ONNX graphs. | | |
| 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. | |
| ## Evaluation | |
| 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. | |
| Engines built with TensorRT 10.12.0.36 on an NVIDIA L4: | |
| | 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 | | |
| |---|---|---|---|---|---|---|---|---|---|---| | |
| | fp32 reference (PyTorch, CPU) | 32-bit float | 745 (in memory) | 0.9310 | 0.9969 | 0.9999 | 0.9926 | 0.9557 | 0.7862 | - | - | | |
| | `trt-fp16-strong` | fp16, strongly typed | 377 | 0.9308 | 0.9969 | 0.9999 | 0.9927 | 0.9557 | 0.7851 | 0.082 | 4 | | |
| | `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 | | |
| | `torchtrt-fp16-strong` | fp16, explicit typing (Torch-TensorRT) | 502 | 0.9311 | 0.9969 | 0.9999 | 0.9926 | 0.9557 | 0.7862 | 0.083 | 3 | | |
| | `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 | | |
| | `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 | | |
| | `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 | | |
| | `trt-fp16` | fp16 chosen by TensorRT (weak typing) | 377 | 0.5029 | 0.3805 | 0.3098 | 0.6281 | 0.5431 | 0.2805 | 1.000 | 3579 | | |
| | `trt-fp32` | 32-bit float | 743 | 0.9310 | 0.9969 | 0.9999 | 0.9926 | 0.9557 | 0.7862 | 0.004 | 1 | | |
| The same ONNX graphs built with TensorRT 10.16.1.11 on the same GPU: | |
| | 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 | | |
| |---|---|---|---|---|---|---|---|---|---|---| | |
| | `trt-fp16` | fp16 chosen by TensorRT (weak typing) | 376 | 0.9307 | 0.9969 | 0.9999 | 0.9928 | 0.9558 | 0.7862 | 0.066 | 5 | | |
| | `trt-fp16-strong` | fp16, strongly typed | 376 | 0.9308 | 0.9969 | 0.9999 | 0.9927 | 0.9557 | 0.7851 | 0.082 | 4 | | |
| Notes on the rows: | |
| - `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. | |
| - `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. | |
| ## Latency | |
| 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. | |
| | 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) | | |
| |---|---|---|---|---|---|---|---|---|---| | |
| | `base-bf16` | - | 7.4 | 34.4 | 7.1 | 40.0 | 465 | 401 | 4,140 | 10.69 | | |
| | `graph-bf16` | - | 3.2 | 33.7 | 4.1 | 40.0 | 476 | 401 | 2,782 | 3.99 | | |
| | `compile-default` | - | 3.2 | 28.9 | 4.1 | 33.8 | 555 | 472 | 2,362 | 5.3 | | |
| | `trt-fp16-strong` | 10.12.0.36 | 4.3 | 26.6 | 6.0 | 31.3 | 599 | 512 | 2,274 | 0.31 | | |
| | `trt-fp16-strong-2p` | 10.12.0.36 | 2.7 | 26.3 | 3.5 | 31.2 | 610 | 515 | 3,844 | 0.8 | | |
| | `torchtrt-fp16-strong` | 10.12.0.36 | 4.3 | 26.2 | 5.8 | 31.1 | 609 | 516 | 3,922 | 67.76 | | |
| | `trt-int8-a` | 10.12.0.36 | 3.0 | 20.0 | 4.6 | 25.4 | 794 | 629 | 2,165 | 0.35 | | |
| | `trt-int8-conv` | 10.12.0.36 | 4.2 | 25.3 | 5.8 | 30.0 | 633 | 534 | 2,265 | 0.46 | | |
| | `trt-int8` | 10.12.0.36 | 3.0 | 20.1 | 4.0 | 23.7 | 794 | 677 | 2,024 | 0.35 | | |
| | `trt-fp16` | 10.12.0.36 | 4.4 | 26.8 | 6.1 | 31.6 | 598 | 508 | 3,464 | 0.22 | | |
| | `trt-fp32` | 10.12.0.36 | 6.0 | 54.4 | 7.9 | 64.8 | 294 | 247 | 4,200 | 0.2 | | |
| TensorRT 10.16.1.11, same machine: | |
| | 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) | | |
| |---|---|---|---|---|---|---|---|---|---| | |
| | `trt-fp16` | 10.16.1.11 | 4.3 | 26.5 | 5.8 | 31.5 | 600 | 510 | 3,613 | 0.31 | | |
| | `trt-fp16-strong` | 10.16.1.11 | 4.2 | 26.7 | 5.8 | 31.7 | 600 | 507 | 2,230 | 0.35 | | |
| 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. | |
| ## Usage | |
| ```python | |
| import numpy as np | |
| from huggingface_hub import snapshot_download | |
| from marimba_trt import Encoder | |
| path = snapshot_download( | |
| "charcot-ai/marimba-quant-tensorrt", | |
| allow_patterns=["marimba_trt.py", "engines/l4-trt10.12.0.36/trt-fp16-strong/*"], | |
| ) | |
| encoder = Encoder(f"{path}/engines/l4-trt10.12.0.36/trt-fp16-strong") | |
| windows = np.zeros((4, 128_000), dtype=np.float32) # four windows of 8 s at 16 kHz | |
| states = encoder(windows, last_layer=18) # {9: ..., 12: ..., 18: ...}, float32 [4, 104, 896] | |
| hop = encoder(windows, last_layer=12) # layers 9 and 12 only; part B does not run | |
| on_gpu = encoder.states(windows) # the same states as CUDA tensors | |
| ``` | |
| On another GPU model or TensorRT version, build the engines first: | |
| ```bash | |
| python marimba_trt.py build onnx/fp16 my-engines # one profile, batches 1-32 | |
| python marimba_trt.py build onnx/fp16 my-engines --two-profiles # faster batch 1, larger file | |
| ``` | |
| 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. | |
| ## How the artifacts were made | |
| - **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. | |
| - **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). | |
| - **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. | |
| - **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`). | |
| ## Limitations | |
| - Engines are tied to the GPU model and TensorRT version in their path. Loading one elsewhere fails or is unsupported. | |
| - The engines accept batches of 1 to 32 windows of exactly eight seconds. | |
| - The log-mel front end is not inside the engines; `marimba_trt.py` computes it on the GPU with PyTorch. | |
| - The INT8 variants were calibrated, not trained, and the Marimba heads were not refitted on quantized states. | |
| - Latency was measured on one GPU model. Other GPUs give other ratios between fp16 and INT8. | |
| ## Attribution | |
| - Backbone: [Qwen/Qwen3-ASR-0.6B](https://huggingface.co/Qwen/Qwen3-ASR-0.6B), Apache-2.0. | |
| - Heads and package: [charcot-ai/marimba](https://huggingface.co/charcot-ai/marimba), Apache-2.0. | |
| - Tools: NVIDIA TensorRT 10.12.0.36 and 10.16.1.11, Torch-TensorRT 2.8.0, NVIDIA Model Optimizer 0.48.0. | |