Run this model with HF Jobs
Run litert-community/voice-isolator on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/litert-community/voice-isolator. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/litert-community/voice-isolator on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use litert-community/voice-isolator with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT
How to use litert-community/voice-isolator with LiteRT:
# 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
Voice Isolator for LiteRT
This repository holds the offline model (voice-isolator-v1) of Inworld's inworld/voice-isolator as three LiteRT .tflite files. Two are for the CPU, tested on three Android phones and a Mac: voice_isolator_8s_fp32.tflite (float32 weights) and voice_isolator_8s_fp16w.tflite (float16 weights). One is for the GPU, tested on two of the phones: voice_isolator_8s_rank_aligned_fp32.tflite (float32 weights). The model keeps the foreground voice of a 48 kHz recording and removes noise, music and quieter voices; two voices at similar levels are usually both kept. Each file holds the model's network as one graph, which takes the STFT of one window of up to 8 s; the publisher's Python package does the steps around it (How it works). On the GPU of a Snapdragon Galaxy S26, voice_isolator_8s_rank_aligned_fp32.tflite takes 3.66 s for one 8 s window, less than half as long as the audio. On the GPU of a Pixel 11 Pro it takes 9.49 s, 1.2 times as long as the audio. On the CPU with 8 threads, voice_isolator_8s_fp32.tflite takes 19.0 s on the Galaxy S26, 2.4 times as long as the audio, and about 67 s on a Pixel 11 Pro and a Pixel 8a. The publisher made this model for recorded audio, not live calls: each output frame uses its whole 8 s window. Speed still being tuned (updates follow).
On the CPU the output is close to the publisher's: on 17 clips its SI-SDR against the publisher's own output (higher is closer; our bar was 20 dB) is at least 111 dB with voice_isolator_8s_fp32.tflite and at least 78.9 dB with voice_isolator_8s_fp16w.tflite, on all three phones and on a Mac (Accuracy). On the GPU at its default precision, the SI-SDR of voice_isolator_8s_rank_aligned_fp32.tflite is at least 37.3 dB on the Galaxy S26 and at least 31.8 dB on the Pixel 11 Pro.
With Python, python isolate.py voice_isolator_8s_fp32.tflite recording.wav voice.wav writes the voice of recording.wav to voice.wav (we ran it on a Mac); Use it has the script and its setup. This release has no Android code: an app passes each window to the graph and does the other steps of How it works itself.
The two CPU files gave NaN or wrong output on every GPU we tried: Metal on a Mac, Adreno on the Snapdragon Galaxy S26 and PowerVR on the Pixel 11 Pro (Notes). voice_isolator_8s_rank_aligned_fp32.tflite has not been tested on a Mac's GPU or on the Pixel 8a's GPU. In the CPU runs of Speed, the process that ran the graph peaked at 3.6β3.8 GB of memory, and in the Galaxy S26's run of voice_isolator_8s_fp32.tflite with 8 threads, Android's low-memory killer closed 10 background app processes. On the Pixel 8a, available memory (MemAvailable) fell to 0.76 GB in the runs of Speed and to 0.64 GB in one of the runs behind Accuracy. In the GPU runs at default precision, available memory fell by 3.3β4.2 GB during each run.
Files
| file | bytes | what |
|---|---|---|
voice_isolator_8s_fp32.tflite |
272,390,120 | the graph with float32 weights |
voice_isolator_8s_fp16w.tflite |
144,698,560 | the same graph with most of its weights in float16 (127.2 MB; 1.9 MB of other constants stay float32) and 236 DEQUANTIZE operators that read them |
voice_isolator_8s_rank_aligned_fp32.tflite |
272,868,308 | the graph with float32 weights, rebuilt for the GPU (Notes) |
LICENSE |
11,358 | the publisher's LICENSE (Apache License 2.0), unchanged from inworld/voice-isolator at revision 9b0285b |
NOTICE |
904 | the publisher's NOTICE, unchanged from the same revision |
On the GPU of a Snapdragon Galaxy S26 or a Pixel 11 Pro, start with voice_isolator_8s_rank_aligned_fp32.tflite at the GPU's default precision: it ran 5.2 times as fast as voice_isolator_8s_fp32.tflite with 8 CPU threads on the Galaxy S26, and 7.0 times as fast on the Pixel 11 Pro (Speed). Elsewhere, start with voice_isolator_8s_fp32.tflite on the CPU: its output is the closer of the two CPU files to the publisher's, and its median time was the lower of the two on each phone. voice_isolator_8s_fp16w.tflite is about half the size.
How it works
audio β mono, 48 kHz β 8 s windows β STFT β graph β correction β inverse STFT, added to the window's audio β crossfade of the windows β voice (48 kHz)
The script in Use it runs the graph with LiteRT and takes the other steps from the publisher's package (src/inworld/voice_isolation/ in its GitHub repository), whose code is the reference for each step.
- Audio (
load_audio,VoiceIsolator.isolate). The recording is mixed to mono and resampled to 48 kHz. - Windows (
VoiceIsolatorNetwork.enhance). A recording of up to 8 s (384,000 samples) is one window. A longer one is cut into full 8 s windows, each starting 6 s after the one before, except the last, which ends where the recording ends. Each window's output is crossfaded linearly into the next over the last 2 s of the earlier window; where the last window reaches further back, its output before that crossfade is not used. - STFT (
stft): 2,048 points, hop 480 (10 ms), periodic Hann window, centered frames, reflect padding (constant padding for 1,024 samples or fewer). An 8 s window has 801 frames of 1,025 bins. - Graph (signature
serving_default, the same in all three files):- input
spectrum, float32 [1, 801, 1025, 2]: the window's STFT by frame and bin, real and imaginary parts. A window shorter than 8 s fills the first frames and leaves the rest zero. - input
valid_frames, float32 [1, 801, 1, 1]: 1 for each frame of the window, 0 for the frames after it. - output
decoder_raw, float32 [1, 1025, 801, 4]: for each bin and frame, the two components of a complex mask and the two of a complex residual.
- input
- Correction and inverse STFT (
correction,bounded_correction,istft). On the window's frames, 2Β·tanh of the output's first two components gives a complex mask, and tanh of its last two gives a complex residual, shortened to length 1 when longer and multiplied by 0.5 Γ the bin's magnitude. The correction is the spectrum times the mask plus the residual. The inverse STFT of the correction, added to the window's audio, is the window's voice.
Use it
Both steps run in one shell and one new Python 3.12 environment; step 2 also needs git and curl.
1. Download
python3.12 -m venv .venv
. .venv/bin/activate
pip install -U huggingface_hub
hf download litert-community/voice-isolator voice_isolator_8s_fp32.tflite --local-dir voice-isolator
cd voice-isolator
2. Run it (Python, CPU)
Save this as isolate.py in the voice-isolator folder:
"""Isolate the voice of a recording with a voice-isolator .tflite file on the CPU."""
import sys
import time
from ai_edge_litert.compiled_model import CompiledModel, CpuOptions, HardwareAccelerator, Options
from inworld.voice_isolation.audio import load_audio, save_audio
from inworld.voice_isolation.isolator import VoiceIsolator
from inworld.voice_isolation.model import VoiceIsolatorConfig, VoiceIsolatorNetwork
import numpy as np
import torch
FRAMES, BINS = 801, 1025 # one 8 s window at 48 kHz: STFT frames (hop 480) and bins (2,048 points)
SIGNATURE = "serving_default"
OUTPUT_SHAPE = (1, BINS, FRAMES, 4) # decoder_raw
class LiteRTWindow:
"""The graph on one window: spectrum and valid_frames in, decoder_raw out."""
def __init__(self, model):
self.model = model
self.inputs = {key: model.create_input_buffer_by_name(SIGNATURE, key) for key in ("spectrum", "valid_frames")}
self.outputs = {"decoder_raw": model.create_output_buffer_by_name(SIGNATURE, "decoder_raw")}
def __call__(self, spectrum, mask):
self.inputs["spectrum"].write(spectrum.numpy())
self.inputs["valid_frames"].write(mask.numpy())
self.model.run_by_name(SIGNATURE, self.inputs, self.outputs)
data = self.outputs["decoder_raw"].read(int(np.prod(OUTPUT_SHAPE)), np.float32)
return torch.from_numpy(data.reshape(OUTPUT_SHAPE))
class GraphHost(torch.nn.Module):
"""The publisher's window placement, STFT, correction and inverse STFT, with the graph in place of its network."""
default_window = VoiceIsolatorNetwork.default_window
enhance = VoiceIsolatorNetwork.enhance
stft = VoiceIsolatorNetwork.stft
istft = VoiceIsolatorNetwork.istft
correction = VoiceIsolatorNetwork.correction
def __init__(self, config, run_window, frames=FRAMES):
super().__init__()
self.config = config
self.frames = frames
self.run_window = run_window
self.register_buffer("window", torch.hann_window(config.n_fft), persistent=False)
def forward(self, audio):
if audio.ndim != 2 or audio.shape[0] != 1 or not audio.shape[-1] or not audio.is_floating_point():
raise ValueError("Expected nonempty floating-point mono audio [1, samples].")
spectrum = self.stft(audio)
valid = spectrum.shape[-1]
if valid > self.frames:
raise ValueError(f"The graph accepts {self.frames} frames, received {valid}.")
components = torch.zeros((1, self.frames, BINS, 2), dtype=torch.float32)
components[:, :valid] = torch.view_as_real(spectrum).transpose(1, 2)
mask = torch.zeros((1, self.frames, 1, 1), dtype=torch.float32)
mask[:, :valid] = 1
raw = self.run_window(components, mask)[:, :, :valid]
return audio + self.istft(self.correction(raw, spectrum), audio.shape[-1])
if len(sys.argv) != 4:
sys.exit("usage: python isolate.py <file.tflite> <recording> <voice.wav>")
model_file, source, destination = sys.argv[1:]
torch.set_num_threads(8)
# The offline checkpoint's config: the package's defaults with these two values.
config = VoiceIsolatorConfig.from_dict({"width": 512, "chunk_seconds": 8.0})
options = Options(hardware_accelerators=HardwareAccelerator.CPU, cpu_options=CpuOptions(num_threads=8))
with CompiledModel.from_file(model_file, options=options) as compiled:
isolator = VoiceIsolator(GraphHost(config, LiteRTWindow(compiled)), device="cpu", precision="fp32", mode="offline")
wav, rate = load_audio(source)
start = time.perf_counter()
voice = isolator.isolate(wav, rate, output_sample_rate=48000)
seconds = time.perf_counter() - start
save_audio(destination, voice, 48000, subtype="FLOAT")
print(f"{source}: {wav.numel() / rate:.1f} s of audio, isolated in {seconds:.1f} s, voice written to {destination}")
The script uses the publisher's package for the steps around the graph (it brings PyTorch) and LiteRT for the graph. The exact versions below are those used for the Mac row of Accuracy; the last two lines fetch the publisher's noisy example clip and run the script on it:
pip install ai-edge-litert==2.3.0 numpy==2.5.4 soundfile==0.14.0 torch==2.13.0 torchaudio==2.11.1 \
"inworld-voice-isolation @ git+https://github.com/inworld-ai/voice-isolator@c73b3fab81a870410cbac50d2f05f25edc4d10aa"
curl -LO https://raw.githubusercontent.com/inworld-ai/voice-isolator/c73b3fab81a870410cbac50d2f05f25edc4d10aa/demo/examples/sample_14.wav
python isolate.py voice_isolator_8s_fp32.tflite sample_14.wav sample_14_voice.wav
Run as written on 2026-11-30 on a Mac (Apple silicon, macOS 27.0), in a new Python 3.12.13 venv (step 1 installed huggingface_hub 2.5.0): it wrote sample_14_voice.wav, a 48 kHz mono float32 WAV of 516,960 samples, and its SI-SDR against the publisher's output for the clip is 126.42 dB, the value this clip has in the run behind the Mac row of Accuracy.
For a recording of yours, give its path in place of sample_14.wav: a WAV or another file that soundfile reads. The package mixes it to mono and resamples it to 48 kHz; all our test clips were 48 kHz. The voice is written as a 48 kHz float32 WAV.
On Android (GPU)
On the GPU of a Snapdragon Galaxy S26 or a Pixel 11 Pro, run voice_isolator_8s_rank_aligned_fp32.tflite as a LiteRT CompiledModel with the GPU accelerator, at the default precision. Our phone runs did this with LiteRT 2.3.0 from Google Maven (com.google.ai.edge.litert:litert and com.google.ai.edge.litert:litert-gpu), called through its C API.
Accuracy
The measure is SI-SDR (scale-invariant signal-to-distortion ratio): the energy of the part of an output that follows the publisher's output, over the energy of the rest, in dB, with no mean removed. The publisher's output is that of its package 1.0.0 (GitHub commit c73b3fa) with the offline checkpoint in float32 (PyTorch 2.13.0, 8 threads) on a Mac's CPU. The 17 clips are the 15 examples of the publisher's demo (demo/examples) and the 2 inputs of its golden test (tests/fixtures, 3 s and 11 s): 48 kHz, 3.0β24.7 s long, 27 windows in all. Before any of these numbers, we set the bar each file had to meet on each device: at least 20 dB on every clip.
Both CPU files met the bar on the CPU of all four devices. The lowest SI-SDR of the 17 clips:
| device | voice_isolator_8s_fp32.tflite |
voice_isolator_8s_fp16w.tflite |
|---|---|---|
| Mac (Apple silicon, macOS 27.0), ai-edge-litert 2.3.0, 8 threads | 111.28 dB | 78.92 dB |
| Snapdragon Galaxy S26 | 111.24 dB | 78.92 dB |
| Pixel 11 Pro | 111.24 dB | 78.92 dB |
| Pixel 8a | 111.24 dB | 78.92 dB |
Each phone ran the graph on all 27 windows (8 CPU threads, LiteRT 2.3.0 as in Speed, 2026-11-30), from inputs made on a Mac, and the Mac did the steps after the graph on the phone's outputs. The Pixel 11 Pro and the Pixel 8a gave the same output bytes on every window.
voice_isolator_8s_rank_aligned_fp32.tflite met the bar on the GPU of both phones it was tested on. The lowest SI-SDR of the 17 clips:
| phone | GPU precision | voice_isolator_8s_rank_aligned_fp32.tflite |
|---|---|---|
| Snapdragon Galaxy S26 (Adreno) | default | 37.31 dB |
| Pixel 11 Pro (PowerVR) | default | 31.84 dB |
| Pixel 11 Pro (PowerVR) | float32 | 126.69 dB |
These GPU runs were made the same way, on 2026-12-01, with LiteRT 2.3.0's GPU accelerator instead of 8 CPU threads.
Speed
One call of the graph on one full 8 s window, on the phone's CPU:
| phone | file | CPU threads | seconds per window | RTF | peak memory |
|---|---|---|---|---|---|
| Snapdragon Galaxy S26 | voice_isolator_8s_fp32.tflite |
8 | 19.0 | 2.38 | 3.79 GB |
| Snapdragon Galaxy S26 | voice_isolator_8s_fp32.tflite |
4 | 20.9 | 2.61 | 3.79 GB |
| Snapdragon Galaxy S26 | voice_isolator_8s_fp16w.tflite |
8 | 23.6 | 2.95 | 3.66 GB |
| Pixel 11 Pro | voice_isolator_8s_fp32.tflite |
8 | 66.7 | 8.34 | 3.74 GB |
| Pixel 11 Pro | voice_isolator_8s_fp32.tflite |
5 | 71.8 | 8.97 | 3.74 GB |
| Pixel 11 Pro | voice_isolator_8s_fp16w.tflite |
8 | 70.5 | 8.81 | 3.61 GB |
| Pixel 8a | voice_isolator_8s_fp32.tflite |
8 | 67.0 | 8.38 | 3.74 GB |
| Pixel 8a | voice_isolator_8s_fp16w.tflite |
8 | 95.5 | 11.94 | 3.61 GB |
The same call on the phone's GPU, with voice_isolator_8s_rank_aligned_fp32.tflite:
| phone | GPU | GPU precision | seconds per window | RTF | available memory fell by |
|---|---|---|---|---|---|
| Snapdragon Galaxy S26 | Adreno | default | 3.66 | 0.46 | 3.46 GB |
| Pixel 11 Pro | PowerVR | default | 9.49 | 1.19 | 3.33 GB |
| Pixel 11 Pro | PowerVR | float32 | 17.1 | 2.14 | 5.16 GB |
- Seconds per window: the median of 3 calls on the same window, after 3 calls that are not counted, each call from writing the input to reading the output. The steps around the graph (STFT, correction, inverse STFT, crossfade) are not in these times.
- Loading on the GPU: before its first call, each process created the compiled model for the GPU. At default precision this took 19β24 s on the Galaxy S26 and 30β59 s on the Pixel 11 Pro; it is not in the times above.
- RTF = seconds per window Γ· 8 s, computed from the times in milliseconds; above 1 is slower than real time. After its first 8 s, a recording needs one more window for each further 6 s or part of it: the windows start 6 s apart, except the last, which ends where the recording ends.
- Peak memory (CPU runs): the peak resident memory (VmHWM) of the process that ran the graph, during the run (GB = kB Γ 1024 / 10βΉ).
- Available memory fell by (GPU runs): the phone's available memory (MemAvailable) at the start of the run minus its lowest value during the run, in the same GB. The GPU runs did not record the process's own peak.
- Each run in the CPU table started with the phone at Android thermal status 0 (none) and no CPU clock ceiling lowered. In most readings taken during each of these runs, at least one CPU clock ceiling was below its maximum. Each run in the GPU table started at thermal status 0 and ended at 1 (light).
- In the GPU runs behind Accuracy at default precision (27 windows in three processes on each phone), one call took 3.65β4.69 s on the Galaxy S26 and 8.78β9.92 s on the Pixel 11 Pro. On the Galaxy S26 the last call was the slowest, and the phone's thermal status went from 0 at the start to 3 (severe) at the end.
- Phones: Galaxy S26 model SM-S942Q (Snapdragon, SM8850) with Android 16, Pixel 11 Pro with Android 17, Pixel 8a with Android 16. LiteRT 2.3.0 from Google Maven, called through its C API, with its GPU accelerator from
litert-gpu2.3.0 for the GPU runs; CPU runs on 2026-11-30, GPU runs on 2026-12-01.
Notes
- GPU. At the GPU's default precision the output was all NaN or infinite, with both CPU files, on a Mac (Metal), the Snapdragon Galaxy S26 (Adreno) and the Pixel 11 Pro (PowerVR). At float32 precision the output was finite but still wrong: on the Mac its SI-SDR against the publisher's output was β14.5 to 8.9 dB on the 17 clips, and on both phones the graph's output differed from the CPU's by as much as the output itself.
- How these files were made. The offline checkpoint (
denoiser.safetensorsof inworld/voice-isolator at revision 9b0285b) was loaded with the publisher's package at GitHub commit c73b3fa. Its network was rewritten as a graph of one 8 s window, with the frames after a short window kept out of the time attention and the Mamba scans along time, so that such a window gives the publisher's single-pass result (on the 3 s input of its golden test, the rewritten network's output differed from the publisher's by at most 6.0e-08). The graph was exported with litert-torch 0.9.4 (PyTorch 2.13.0) asvoice_isolator_8s_fp32.tflite, and ai-edge-quantizer 0.10.0 cast most of its weights to float16 forvoice_isolator_8s_fp16w.tflite.voice_isolator_8s_rank_aligned_fp32.tflitewas rebuilt fromvoice_isolator_8s_fp32.tflitefor the GPU, with float32 weights: where the value ranges seen on the 27 windows of Accuracy called for it, values inside the graph are rescaled by powers of two to stay within the range of float16; rank-3 batch matrix multiplies are lifted to rank 4; 36 encoder layer-norm inputs are padded to a multiple of 8 channels; and the two inputs of every add, multiply and subtract have the same rank. That last change made the GPU output right: an earlier rebuild without it gave finite but wrong output on the GPU of both phones. In that earlier rebuild, on the Pixel 11 Pro's GPU at float32 precision, one multiply in the decoder, whose two inputs have ranks 3 and 4, came out far from the CPU's result while its inputs were close. On a Mac's CPU (ai-edge-litert 2.3.0, 8 threads), the lowest SI-SDR ofvoice_isolator_8s_rank_aligned_fp32.tfliteon the 17 clips is 111.39 dB, against 111.28 dB forvoice_isolator_8s_fp32.tflite.
License
The files are under the Apache License 2.0, like the weights of inworld/voice-isolator they come from. The publisher's LICENSE and NOTICE are included unchanged.
- Downloads last month
- 55
Model tree for litert-community/voice-isolator
Base model
inworld/voice-isolator