Audio-to-Audio
TensorRT
moonbox
resemble-enhance
speech-enhancement
denoising
noise-suppression
44khz
Instructions to use moonbox-dev/resemble-enhance-TensorRT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- TensorRT
How to use moonbox-dev/resemble-enhance-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 moonbox-dev/resemble-enhance-TensorRT: direct link, hf CLI and curl.
- Browser
- Download file 6.29 kB
-
https://huggingface.co/moonbox-dev/resemble-enhance-TensorRT/resolve/main/README.md
- Command line
-
hf download hf://moonbox-dev/resemble-enhance-TensorRT/README.md
-
curl -L -o README.md https://huggingface.co/moonbox-dev/resemble-enhance-TensorRT/resolve/main/README.md
6.29 kB
| base_model: ResembleAI/resemble-enhance | |
| base_model_relation: quantized | |
| license: mit | |
| pipeline_tag: audio-to-audio | |
| library_name: tensorrt | |
| tags: | |
| - tensorrt | |
| - moonbox | |
| - resemble-enhance | |
| - speech-enhancement | |
| - denoising | |
| - noise-suppression | |
| - 44khz | |
| # Resemble Enhance TensorRT | |
| TensorRT engines of [Resemble Enhance](https://huggingface.co/ResembleAI/resemble-enhance), made by Moonbox for NVIDIA RTX GPUs. Each precision is one folder holding the | |
| engine, `trt_runner.py` (a small numpy runner: TensorRT plus Polygraphy, no PyTorch) and a script that does the rest | |
| of the pipeline. What the engine takes and returns is under *How to run*. | |
| **Compatibility.** The engines are built *hardware compatible* (Ampere and newer: RTX 30, 40 and 50 series) and | |
| *version compatible* (any TensorRT 10.x from 10.13 on, through its lean runtime). That costs a little speed against an | |
| engine built for one GPU, but no rebuild is needed. Install the runtime with | |
| `pip install "tensorrt-cu12>=10.13,<11" "tensorrt-lean-cu12>=10.13,<11" polygraphy numpy`. | |
| ## Files | |
| The last column is the benchmark (details under *How to run*). | |
| | Precision | File | Size | sha256 | Benchmark | | |
| |---|---|---|---|---| | |
| | fp16 | [`fp16/config.json`](https://huggingface.co/moonbox-dev/resemble-enhance-TensorRT/blob/main/fp16/config.json) | 0.1 kB | `8ad7fb74a0ea` | denoise mode only: PESQ 2.823, SI-SDR 12.42 dB; vs the ONNX build 80.3 dB mean, worst file -0.022 dB; RTF 0.030 (ONNX 0.052) | | |
| | fp16 | [`fp16/denoiser.engine`](https://huggingface.co/moonbox-dev/resemble-enhance-TensorRT/blob/main/fp16/denoiser.engine) | 134.5 MB | `80425726caa7` | denoise mode only: PESQ 2.823, SI-SDR 12.42 dB; vs the ONNX build 80.3 dB mean, worst file -0.022 dB; RTF 0.030 (ONNX 0.052) | | |
| | fp16 | [`fp16/pipeline.py`](https://huggingface.co/moonbox-dev/resemble-enhance-TensorRT/blob/main/fp16/pipeline.py) | 7.9 kB | `311e89e6bd3a` | denoise mode only: PESQ 2.823, SI-SDR 12.42 dB; vs the ONNX build 80.3 dB mean, worst file -0.022 dB; RTF 0.030 (ONNX 0.052) | | |
| | fp16 | [`fp16/pipeline_trt.py`](https://huggingface.co/moonbox-dev/resemble-enhance-TensorRT/blob/main/fp16/pipeline_trt.py) | 1.5 kB | `991527fc5d58` | denoise mode only: PESQ 2.823, SI-SDR 12.42 dB; vs the ONNX build 80.3 dB mean, worst file -0.022 dB; RTF 0.030 (ONNX 0.052) | | |
| | fp16 | [`fp16/trt_runner.py`](https://huggingface.co/moonbox-dev/resemble-enhance-TensorRT/blob/main/fp16/trt_runner.py) | 3.3 kB | `0da2222f799a` | denoise mode only: PESQ 2.823, SI-SDR 12.42 dB; vs the ONNX build 80.3 dB mean, worst file -0.022 dB; RTF 0.030 (ONNX 0.052) | | |
| ## How to run | |
| Resemble Enhance's **denoiser** (Resemble AI's speech enhancer: its denoise mode removes noise from speech, 44.1 | |
| kHz) as a TensorRT engine, plus the same Python pipeline as this model's ONNX build (`pipeline.py`). Only the denoise | |
| mode: the enhance mode's IRMAE decoder and UnivNet vocoder, a 900 MB fp32 graph, need about 12 GB of memory to build | |
| in TensorRT, more than this 16 GB laptop allows. For enhance mode, use the ONNX build. | |
| ```python | |
| import sys | |
| import soundfile as sf | |
| sys.path.insert(0, "fp16") | |
| from pipeline import run | |
| from pipeline_trt import TrtParts | |
| parts = TrtParts("fp16") | |
| wav, sr = sf.read("noisy.wav", dtype="float32") | |
| y, osr = run(parts, parts.cfg, wav, sr, mode="denoise") | |
| sf.write("denoised.wav", y, osr) | |
| ``` | |
| It needs numpy, torch / torchaudio (on the CPU: the STFT and resampling), TensorRT and Polygraphy. | |
| **The engine.** `denoiser.engine`: the UNet denoiser on the 1680-point STFT. | |
| - **Inputs:** `mag`, `cos`, `sin` [1, 841, T], the magnitude and phase of the spectrum. T is 1 to 3,000 frames (28 s | |
| at 44.1 kHz) and a multiple of 16; the pipeline pads. | |
| - **Outputs:** the denoised `sep_mag`, `sep_cos`, `sep_sin`. | |
| - **Precision:** built from the ONNX `fp16/` build, whose weights are stored in fp16 and read as fp32. The casts are | |
| folded into fp32 weights, so the math is fp32 like the ONNX build's. | |
| **Benchmark.** | |
| - **Data:** the VoiceBank-DEMAND test set (824 files), denoise mode, on an RTX 3080 Laptop GPU. | |
| - **Scores:** PESQ wide-band, STOI, SI-SDR against the clean speech. | |
| - **Agreement:** the SI-SDR of each output against the ONNX `fp16/` build's output. | |
| - **Pass mark:** no file more than 0.5 dB SI-SDR below the ONNX build. | |
| | | PESQ | STOI | SI-SDR (dB) | vs the ONNX build: mean / worst file (dB) | worst-file SI-SDR change | real-time factor | | |
| |---|---|---|---|---|---|---| | |
| | ONNX `fp16/` (CUDA) | 2.823 | 0.9472 | 12.42 | - | - | 0.052 | | |
| | TensorRT `fp16/` | 2.823 | 0.9472 | 12.42 | 80.3 / 59.5 | -0.022 | 0.030 | | |
| The original (resemble-enhance 0.0.1, PyTorch, CUDA) scores PESQ 2.823, STOI 0.9472, SI-SDR 12.42 dB in this mode. The | |
| real-time factor is for the whole pipeline (STFT and resampling on the CPU). | |
| ## How these were made | |
| From [Resemble Enhance](https://huggingface.co/ResembleAI/resemble-enhance) at revision `4e3510ce4a`: each engine was built with TensorRT's builder from Moonbox's published | |
| ONNX graph of the same model and precision. The network is *strongly typed*: every tensor keeps the precision the | |
| ONNX graph gives it, so an fp16 engine computes what the fp16 ONNX build computes. Built on an RTX 3080 Laptop GPU, | |
| it was benchmarked against the original before upload, and the `sha256` column above is what the files must hash to. | |
| ## License | |
| MIT. These files are a derivative of the original model and carry its license: it is copied in this | |
| repository, and it governs your use of these files. The original model card follows unchanged. | |
| --- | |
| # Original model card | |
| Resemble Enhance is an AI-powered tool that aims to improve the overall quality of speech by performing denoising and enhancement. It consists of two modules: a denoiser, which separates speech from a noisy audio, and an enhancer, which further boosts the perceptual audio quality by restoring audio distortions and extending the audio bandwidth. The two models are trained on high-quality 44.1kHz speech data that guarantees the enhancement of your speech with high quality. | |
| Below are three videos with separate examples of Resemble Enhance's denoiser module and then enhancer module improving speech quality. | |
| Background Music - https://youtu.be/gl--IMtQ0XQ | |
| Street Noise - https://youtu.be/zC87BjtsZVA | |
| Archived Speech - https://youtu.be/6dALaLMJhSQ | |