jennyxue commited on
Commit
8ce5137
·
verified ·
1 Parent(s): 27ccd81

Model card and the original license

Browse files
Files changed (1) hide show
  1. README.md +106 -0
README.md ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: ResembleAI/resemble-enhance
3
+ base_model_relation: quantized
4
+ license: mit
5
+ pipeline_tag: audio-to-audio
6
+ library_name: tensorrt
7
+ tags:
8
+ - tensorrt
9
+ - moonbox
10
+ - resemble-enhance
11
+ - speech-enhancement
12
+ - denoising
13
+ - noise-suppression
14
+ - 44khz
15
+ ---
16
+
17
+ # Resemble Enhance TensorRT
18
+
19
+ 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
20
+ engine, `trt_runner.py` (a small numpy runner: TensorRT plus Polygraphy, no PyTorch) and a script that does the rest
21
+ of the pipeline. What the engine takes and returns is under *How to run*.
22
+
23
+ **Compatibility.** The engines are built *hardware compatible* (Ampere and newer: RTX 30, 40 and 50 series) and
24
+ *version compatible* (any TensorRT 10.x from 10.13 on, through its lean runtime). That costs a little speed against an
25
+ engine built for one GPU, but no rebuild is needed. Install the runtime with
26
+ `pip install "tensorrt-cu12>=10.13,<11" "tensorrt-lean-cu12>=10.13,<11" polygraphy numpy`.
27
+
28
+ ## Files
29
+
30
+ The last column is the benchmark (details under *How to run*).
31
+
32
+ | Precision | File | Size | sha256 | Benchmark |
33
+ |---|---|---|---|---|
34
+ | 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) |
35
+ | 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) |
36
+ | 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) |
37
+ | 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) |
38
+ | 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) |
39
+
40
+ ## How to run
41
+
42
+ Resemble Enhance's **denoiser** (Resemble AI's speech enhancer: its denoise mode removes noise from speech, 44.1
43
+ kHz) as a TensorRT engine, plus the same Python pipeline as this model's ONNX build (`pipeline.py`). Only the denoise
44
+ mode: the enhance mode's IRMAE decoder and UnivNet vocoder, a 900 MB fp32 graph, need about 12 GB of memory to build
45
+ in TensorRT, more than this 16 GB laptop allows. For enhance mode, use the ONNX build.
46
+
47
+ ```python
48
+ import sys
49
+ import soundfile as sf
50
+ sys.path.insert(0, "fp16")
51
+ from pipeline import run
52
+ from pipeline_trt import TrtParts
53
+ parts = TrtParts("fp16")
54
+ wav, sr = sf.read("noisy.wav", dtype="float32")
55
+ y, osr = run(parts, parts.cfg, wav, sr, mode="denoise")
56
+ sf.write("denoised.wav", y, osr)
57
+ ```
58
+
59
+ It needs numpy, torch / torchaudio (on the CPU: the STFT and resampling), TensorRT and Polygraphy.
60
+
61
+ **The engine.** `denoiser.engine`: the UNet denoiser on the 1680-point STFT.
62
+ - **Inputs:** `mag`, `cos`, `sin` [1, 841, T], the magnitude and phase of the spectrum. T is 1 to 3,000 frames (28 s
63
+ at 44.1 kHz) and a multiple of 16; the pipeline pads.
64
+ - **Outputs:** the denoised `sep_mag`, `sep_cos`, `sep_sin`.
65
+ - **Precision:** built from the ONNX `fp16/` build, whose weights are stored in fp16 and read as fp32. The casts are
66
+ folded into fp32 weights, so the math is fp32 like the ONNX build's.
67
+
68
+ **Benchmark.**
69
+ - **Data:** the VoiceBank-DEMAND test set (824 files), denoise mode, on an RTX 3080 Laptop GPU.
70
+ - **Scores:** PESQ wide-band, STOI, SI-SDR against the clean speech.
71
+ - **Agreement:** the SI-SDR of each output against the ONNX `fp16/` build's output.
72
+ - **Pass mark:** no file more than 0.5 dB SI-SDR below the ONNX build.
73
+
74
+ | | PESQ | STOI | SI-SDR (dB) | vs the ONNX build: mean / worst file (dB) | worst-file SI-SDR change | real-time factor |
75
+ |---|---|---|---|---|---|---|
76
+ | ONNX `fp16/` (CUDA) | 2.823 | 0.9472 | 12.42 | - | - | 0.052 |
77
+ | TensorRT `fp16/` | 2.823 | 0.9472 | 12.42 | 80.3 / 59.5 | -0.022 | 0.030 |
78
+
79
+ 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
80
+ real-time factor is for the whole pipeline (STFT and resampling on the CPU).
81
+
82
+ ## How these were made
83
+
84
+ From [Resemble Enhance](https://huggingface.co/ResembleAI/resemble-enhance) at revision `4e3510ce4a`: each engine was built with TensorRT's builder from Moonbox's published
85
+ ONNX graph of the same model and precision. The network is *strongly typed*: every tensor keeps the precision the
86
+ ONNX graph gives it, so an fp16 engine computes what the fp16 ONNX build computes. Built on an RTX 3080 Laptop GPU,
87
+ it was benchmarked against the original before upload, and the `sha256` column above is what the files must hash to.
88
+
89
+ ## License
90
+
91
+ MIT. These files are a derivative of the original model and carry its license: it is copied in this
92
+ repository, and it governs your use of these files. The original model card follows unchanged.
93
+
94
+ ---
95
+
96
+ # Original model card
97
+
98
+ 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.
99
+
100
+ Below are three videos with separate examples of Resemble Enhance's denoiser module and then enhancer module improving speech quality.
101
+
102
+ Background Music - https://youtu.be/gl--IMtQ0XQ
103
+
104
+ Street Noise - https://youtu.be/zC87BjtsZVA
105
+
106
+ Archived Speech - https://youtu.be/6dALaLMJhSQ