█

AI/TLDR

Buy me a coffee
Buy me a coffee

Whisper Diarization

A ready-made pipeline that labels who said what, built on Whisper and NeMo

Audio, Music & VoiceOpen source
Language
Python
License
BSD-2-Clause
$pip install cython
IN SHORT

What is Whisper Diarization?

Whisper Diarization is a ready-made pipeline that labels who said what, built on Whisper and NeMo. It sits in the Audio, Music & Voice category of the Multimodal Generation tools and is open-source, written in Python and licensed BSD-2-Clause. To get started: install the prerequisites.

Overview

Whisper transcribes words but not speakers: run a two-person interview through it and you get one undifferentiated block of text. Whisper Diarization is the pipeline that fills that gap — it stitches Whisper together with voice activity detection, forced alignment and speaker embedding models so every sentence, and in fact every word, comes back tagged with who said it.

The chain is deliberate. Vocals are first separated out of the audio, which makes the speaker embeddings more accurate. Whisper generates the transcription. `ctc-forced-aligner` then corrects and aligns the timestamps so diarization errors caused by time shift are minimised. MarbleNet handles VAD and segmentation to exclude silence, TitaNet extracts a speaker embedding per segment, and the per-word timestamps are matched against those segments — then realigned using punctuation models to absorb small remaining shifts.

It is a script-first project rather than a library: you clone it, install the pinned requirements, and run `diarize.py` against an audio file. A `diarize_parallel.py` variant runs NeMo alongside Whisper instead of after it, which can help on machines with 10 GB or more of VRAM — the result is identical because the two models do not depend on each other. The README is candid about what it does not yet handle: overlapping speakers remain an open problem, and Whisper/NeMo parameters are still coded into `diarize.py` and `helpers.py` rather than exposed as flags.

What it does

  • Word-level speaker attribution, not just sentence-level, by matching forced-aligned word timestamps against diarized segments
  • Source separation before embedding extraction, so speaker identity is judged on isolated vocals rather than mixed audio
  • NeMo MarbleNet for voice activity detection and segmentation, and TitaNet for speaker embeddings
  • Punctuation-model realignment as a final pass to compensate for minor timestamp drift
  • A parallel variant (diarize_parallel.py) that runs NeMo concurrently with Whisper when you have ≥10 GB of VRAM
  • CLI flags for the Whisper model size, language, device, batch size, source separation and numeral suppression

Getting started

Python 3.10 or newer is recommended. FFMPEG and Cython are prerequisites — install both before the Python requirements.

Install the prerequisites

Cython and FFMPEG are needed to install the requirements.

bashbash
pip install cython
# then FFMPEG, e.g.
sudo apt update && sudo apt install ffmpeg   # Ubuntu / Debian
brew install ffmpeg                          # macOS
choco install ffmpeg                         # Windows (Chocolatey)

Clone the repo and install the pinned requirements

The constraints file matters — it pins the versions the pipeline is tested against.

bashbash
git clone https://github.com/MahmoudAshraf97/whisper-diarization.git
cd whisper-diarization
pip install -c constraints.txt -r requirements.txt

Run the pipeline on an audio file

This is the whole interface: point -a at the file and let the chain run.

bashbash
python diarize.py -a AUDIO_FILE_NAME

Tune it with the CLI options

The default ASR model is medium.en and the device defaults to cuda when available. --suppress_numerals transcribes numbers as pronounced words, which improves alignment accuracy; reduce --batch-size if you run out of memory (0 disables batching).

bashbash
python diarize.py -a interview.wav --whisper-model large-v3 --language en --suppress_numerals --device cuda

Use the parallel variant on a big GPU

With ≥10 GB of VRAM this runs NeMo in parallel with Whisper. Still experimental, per the README, but the output is the same.

bashbash
python diarize_parallel.py -a AUDIO_FILE_NAME

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Turn interview, podcast or meeting recordings into transcripts where each line is attributed to a named speaker channel
  • Produce word-level speaker labels for subtitle or caption workflows that need to switch colour or position per speaker
  • Prepare diarized transcripts as input for downstream summarisation or analysis, where 'who proposed what' changes the answer
  • Evaluate the accuracy cost of source separation and forced alignment on your own audio by toggling --no-stem and comparing

How Whisper Diarization compares

Whisper Diarization alongside other open-source audio, music & voice tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
VoiceStudio★ 121kA local-first desktop voice studio that clones and designs voices, dubs video, and handles dictation, running 16 text-to-speech and 11 speech-recognition engines on your own hardware.
Whisper★ 114kOpenAI's speech recognition model that transcribes and translates audio across many languages.
GPT-SoVITS★ 64.3kAn open-source WebUI that clones a voice from a short audio sample and turns text into speech, with zero-shot and few-shot fine-tuning.
Voicebox★ 61.6kLocal-first voice studio that clones a voice from a short sample, generates speech across seven TTS engines and 23 languages, handles system-wide dictation, and speaks for agents over MCP.
VibeVoice★ 57.6kMicrosoft's text-to-speech model for generating long, expressive multi-speaker audio like podcasts.
whisper.cpp★ 55.7kA dependency-free C/C++ port of Whisper built on ggml, running speech recognition on CPU, Metal, CUDA, Vulkan and NPUs from phones to servers.
Coqui TTS★ 46.3kA library of text-to-speech models including the multilingual XTTS voice-cloning model.
Whisper Diarization★ 5.7kA ready-made pipeline that labels who said what, built on Whisper and NeMo