--- base_model: inworld/voice-isolator base_model_relation: quantized license: apache-2.0 pipeline_tag: audio-to-audio library_name: tensorrt tags: - tensorrt - moonbox - inworld - voice-isolation - speech-enhancement - denoising - noise-suppression - 48khz - full-band --- # Inworld Voice Isolator TensorRT TensorRT engines of [Inworld Voice Isolator](https://huggingface.co/inworld/voice-isolator), 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/model.engine`](https://huggingface.co/moonbox-dev/voice-isolator-TensorRT/blob/main/fp16/model.engine) | 375.3 MB | `3ad3e431070d` | fp32 math (as the ONNX fp16-storage build): PESQ 3.259, STOI 0.9553, SI-SDR 19.91 dB (the ONNX build 3.261 / 0.9553 / 19.91); no file below the ONNX build by more than 0.003 dB; RTF 0.087 (ONNX 0.26), 7.7 GB peak | | fp16 | [`fp16/pipeline.py`](https://huggingface.co/moonbox-dev/voice-isolator-TensorRT/blob/main/fp16/pipeline.py) | 4.3 kB | `108a5130bf62` | fp32 math (as the ONNX fp16-storage build): PESQ 3.259, STOI 0.9553, SI-SDR 19.91 dB (the ONNX build 3.261 / 0.9553 / 19.91); no file below the ONNX build by more than 0.003 dB; RTF 0.087 (ONNX 0.26), 7.7 GB peak | | fp16 | [`fp16/pipeline_trt.py`](https://huggingface.co/moonbox-dev/voice-isolator-TensorRT/blob/main/fp16/pipeline_trt.py) | 1.6 kB | `f2117455aba5` | fp32 math (as the ONNX fp16-storage build): PESQ 3.259, STOI 0.9553, SI-SDR 19.91 dB (the ONNX build 3.261 / 0.9553 / 19.91); no file below the ONNX build by more than 0.003 dB; RTF 0.087 (ONNX 0.26), 7.7 GB peak | | fp16 | [`fp16/trt_runner.py`](https://huggingface.co/moonbox-dev/voice-isolator-TensorRT/blob/main/fp16/trt_runner.py) | 4.4 kB | `cbc9abb1f59c` | fp32 math (as the ONNX fp16-storage build): PESQ 3.259, STOI 0.9553, SI-SDR 19.91 dB (the ONNX build 3.261 / 0.9553 / 19.91); no file below the ONNX build by more than 0.003 dB; RTF 0.087 (ONNX 0.26), 7.7 GB peak | ## How to run Inworld Voice Isolator v1 as one TensorRT engine and `pipeline_trt.py`. This is the offline model: 64M parameters, a band-split dual-path network with transformers and bidirectional Mamba along time and across bands. It keeps the voice and removes noise, music and reverb from 48 kHz mono audio. The pipeline is this model's ONNX `pipeline.py` with its graph run as the engine. The STFT, the iSTFT, and the original's 8 s windows overlapping by 2 s with linear crossfades stay in numpy. ```python import sys; sys.path.insert(0, "fp16") import soundfile as sf from pipeline_trt import VoiceIsolatorTrt iso = VoiceIsolatorTrt("fp16") audio, sr = sf.read("noisy.wav", dtype="float32") # mono, 48 kHz (resample other rates first) sf.write("voice.wav", iso.isolate(audio), 48000) ``` Or `python fp16/pipeline_trt.py noisy.wav voice.wav`. It needs numpy, TensorRT 10.13 (`tensorrt-cu12` or `tensorrt-lean-cu12`) and Polygraphy, and soundfile to read files. The engine is version-compatible and built for Ampere or newer GPUs (RTX 30-series and up). **The engine.** `model.engine` takes `spec` [1, 1025, T, 2] and returns `change` [1, 1025, T, 2]. - `spec` holds the real and imaginary parts of the STFT: n_fft 2048, hop 480, periodic Hann, centred. - `change` is the complex correction to that spectrum. The output audio is the input plus the iSTFT of the change. - T runs from 100 to 801 frames, so each call takes 1 to 8 s. Longer audio goes through the 8 s windows; audio shorter than 1 s isn't accepted. Inworld's realtime model is a separate graph, in [moonbox-dev/voice-isolator-realtime-ONNX](https://huggingface.co/moonbox-dev/voice-isolator-realtime-ONNX). **Precisions.** `fp16/` is built from the ONNX `fp16/` build, whose weights are stored in fp16 and read as fp32 (fp16 activations overflow in this network). The casts are folded into fp32 weights, so the engine's arithmetic is fp32 like the ONNX build's, and the engine is 375 MB. The Mamba layers' selective scan, an ONNX Scan in the graph, runs as a TensorRT loop. There is no int8: TensorRT's int8 needs calibrated activations. **Benchmark.** - **Data:** VoiceBank-DEMAND test, 824 files at 48 kHz, on an RTX 3080 Laptop GPU. - **Score:** PESQ-WB, STOI and SI-SDR against the clean speech, and the per-file SI-SDR difference from the ONNX `fp16/` build. - **Pass mark** (set before the first run): no file more than 0.5 dB SI-SDR below the ONNX build's. The ONNX build is itself 81.8 dB from the original (inworld-voice-isolation's `VoiceIsolator.isolate`, offline, fp32). | | PESQ | STOI | SI-SDR | worst file vs the ONNX build | real-time factor | |---|---|---|---|---|---| | original (PyTorch fp32, CUDA) | 3.259 | 0.9553 | 19.91 dB | - | 0.22 | | ONNX `fp16/` (CUDA) | 3.261 | 0.9553 | 19.91 dB | - | 0.26 | | TensorRT `fp16/` | 3.259 | 0.9553 | 19.91 dB | -0.003 dB | 0.087 | The process peaked at 7.7 GB of system memory on Windows, GPU memory included. ## How these were made From [Inworld Voice Isolator](https://huggingface.co/inworld/voice-isolator) at revision `9b0285b3fe`: 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 Apache-2.0. 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
Open-license (Apache-2.0) 48 kHz voice isolation for noisy speech recordings and live audio.
--- ## TL;DR Inworld Voice Isolator v1 ships as two models that share one architecture: | | `voice-isolator-v1` | `voice-isolator-v1-realtime` | |---|---|---| | made for | recorded audio and anything not latency-sensitive, at the best quality | live audio, as a stream in your pipeline or production | | how it runs | offline: every frame sees its whole 8 s chunk | a causal stream with 20 ms of look-ahead | | parameters | 64M | 58M | **Use them for** cleaning recordings before playback or publication, curating speech datasets and voice pipelines where the speaker's identity must survive. With the realtime model, use them for live calls and streams. Subtract the isolated voice from the input to extract background noise or a backing-track residual for vocals/music separation. **They are not** a speaker selector or a restoration model. Restoration is planned for version 2 (see [Plans](https://github.com/inworld-ai/voice-isolator#plans)). ## Quick start Using a coding agent? Point it at the [setup section of AGENTS.md](https://github.com/inworld-ai/voice-isolator/blob/main/AGENTS.md#setting-up-the-voice-isolator-for-a-user): it installs the package, checks the machine with `voice-isolate-doctor` and cleans a first file. ```bash pip install inworld-voice-isolation # or from a clone: git clone https://github.com/inworld-ai/voice-isolator && cd voice-isolator && pip install -e . # a noisy example; a clone also has it at demo/examples/sample_14.wav curl -LO https://raw.githubusercontent.com/inworld-ai/voice-isolator/main/demo/examples/sample_14.wav # offline isolation (downloads the offline model on first use): # the voice goes to sample_14_clean.wav and the removed background # to sample_14_clean_background.wav, beside it voice-isolate sample_14.wav sample_14_clean.wav ``` Both are float32 WAVs at 48 kHz, with their original levels preserved; together they reconstruct the aligned mono input. Use `--output-sr 0` to keep the input rate, `--background noise.wav` to choose the background path for one file, or `--no-background` to save only the voice. ```python from inworld import voice_isolation # isolate a recording offline offline = voice_isolation.VoiceIsolator("inworld/voice-isolator") wav, sample_rate = voice_isolation.load_audio("sample_14.wav") voice = offline.isolate(wav, sample_rate) voice_isolation.save_audio("sample_14_clean.wav", voice, sample_rate, subtype="FLOAT") voice_isolation.save_audio("sample_14_clean_background.wav", wav - voice, sample_rate, subtype="FLOAT") # what was removed ``` ### Streaming The realtime model isolates the voice as the audio arrives, with 20 ms of look-ahead: ```python import torch from inworld import voice_isolation live = voice_isolation.VoiceIsolator("inworld/voice-isolator", mode="streaming", lookahead_frames=2) session = live.stream() # takes 48 kHz mono, in pieces of any size wav, sample_rate = voice_isolation.load_audio("sample_14.wav") # 48 kHz mono, standing in for a live source voice = [] for start in range(0, len(wav), 960): # 20 ms at a time, as a microphone delivers it voice.append(session.push(wav[start:start + 960])) # the samples that are final: play or send them voice.append(session.flush()) # the rest, once the source ends voice_isolation.save_audio("sample_14_streamed.wav", torch.cat(voice), sample_rate) ``` The streaming CLI writes only the isolated voice, after the whole file has gone through: ```bash voice-isolate sample_14.wav sample_14_streamed.wav --mode streaming --lookahead 2 ``` The weights download on first use, and their checksums are verified. The mode picks the checkpoint: `voice-isolator-v1` offline, `voice-isolator-v1-realtime` for streaming. CUDA is used when available, Apple's Metal backend (`mps`) on an Apple-silicon Mac with PyTorch 2.6 or later, and the CPU otherwise; `--device` picks one. The code, the [interactive demo](https://github.com/inworld-ai/voice-isolator/blob/main/demo/README.md) and the [benchmark](https://github.com/inworld-ai/voice-isolator/blob/main/bench/README.md) are on GitHub: [inworld-ai/voice-isolator](https://github.com/inworld-ai/voice-isolator). The demo loads both models at startup: **Offline** processes files and samples into voice and background audio; **Online** streams the microphone for up to 60 seconds with updating waveforms and spectrograms, pausing capture before playback. ## Hardware Tested on NVIDIA Ampere, Hopper and Blackwell GPUs (A100, H100, B200 and B300) and on CPU. Smaller GPUs are not tested yet (see [Plans](https://github.com/inworld-ai/voice-isolator#plans)). ## The VIBE benchmark
Built for people with ❤️ by Inworld.