MahmoudAshraf97/whisper-diarization
Local Whisper and NeMo CLI for speaker-attributed transcripts
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
This is a local, file-oriented Python pipeline, with diarize.py as the main entrypoint and a companion notebook. It first extracts vocals with Demucs unless separation is disabled, transcribes with faster-whisper, and refines word timestamps with ctc-forced-aligner. The NeMo branch uses MarbleNet for voice activity detection and segmentation, then TitaNet for speaker embeddings.
The branches meet on the audio timeline: aligned words are mapped to speaker segments, and punctuation is used to refine sentence grouping around small timing shifts. The stack includes nemo_toolkit[asr] >=2.5.0, <3, faster-whisper>=1.1.0, nltk, and Git-sourced Demucs, deepmultilingualpunctuation, and ctc-forced-aligner. Some Whisper and NeMo settings are fixed in diarize.py and helpers.py, so deeper tuning requires editing Python rather than passing CLI flags.
Key Capabilities & Differentiators
The pipeline produces speaker-attributed transcription from an audio file. It uses word-level timing internally to decide who spoke and then organizes the transcript into sentences. --whisper-model defaults to the English-only medium.en; for non-English audio, choose a multilingual model rather than relying on --language alone. The language flag is useful when automatic detection fails.
Use --no-stem to bypass vocal separation and --suppress_numerals to write numbers as words, which can improve alignment. --device selects the runtime device, defaulting to CUDA when available. Lower --batch-size to reduce memory pressure or set it to 0 for non-batched inference. A maximum sentence length for SRT subtitles is planned, not an available control.
Trade-offs & Limitations
Compared with plain Whisper, this pipeline adds speaker attribution and timestamp reconciliation at the cost of additional model stages and a more involved installation. Compared with wiring Whisper to a separate diarization stack such as pyannote.audio, it provides a ready-made mapping from word timings to speaker segments, but exposes only part of that pipeline through CLI settings. Compared with a managed speech API, local execution keeps audio processing on your hardware while making you responsible for runtime maintenance and capacity.
Overlapping speech remains unresolved: extracting vocals does not separate one speaker from another. The experimental parallel entrypoint is intended to change scheduling, not transcript quality; whether it saves time depends on the workload and hardware. The repository is BSD-2-Clause, but dependencies and model weights should be reviewed separately before redistribution.
Hardware & Deployment Guide
Target Python 3.10 or newer, with FFmpeg and Cython installed before running pip install -c constraints.txt -r requirements.txt. Python 3.9 is possible with manual dependency installation but is not the straightforward setup path. Start with python diarize.py -a AUDIO_FILE_NAME. Installation pulls several packages from Git, so plan to stage dependencies and model assets separately for an air-gapped deployment rather than assuming an offline installer.
Inference runs locally; no hosted speech API is required. Once the sequential path works on representative files, try diarize_parallel.py if the machine meets the stated 10 GB VRAM recommendation and throughput matters. No tagged release is listed, so record the tested repository commit and Python environment for repeatable deployment.
--no-stem when the extra processing is not worthwhile.diarize.py is the sequential entrypoint; experimental diarize_parallel.py runs Whisper and NeMo concurrently, with at least 10 GB of VRAM recommended.medium.en and exposes model, language, device, numeral handling, and batching controls.constraints.txt; Demucs, deepmultilingualpunctuation, and ctc-forced-aligner are fetched from Git repositories.Local batch processing of interviews, podcasts, and meetings where speakers usually take turns and transcripts need speaker labels.
You need reliable attribution during crosstalk, a managed or real-time API, or configurable SRT sentence-length limits.
Quick Start & Installation
pip install cythonComparison vs. Top Voice, Vision & Video Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| whisper-diarization ★ | 5.7k | +3 | Jupyter Notebook | BSD-2-Clause | Local Whisper and NeMo CLI for speaker-attributed transcripts |
| WhisperLiveKit | 11.3k | +27 | Python | Apache-2.0 | Self-hosted streaming speech-to-text with pluggable ASR and speaker diarization |
| speech-to-speech | 13.9k | +137 | Python | Apache-2.0 | A modular speech cascade for self-hosted voice agents over OpenAI Realtime |
| voice-pro | 13.5k | +34 | Python | GPL-3.0 | Self-hosted Gradio studio for transcription, translation, and dubbing |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/MahmoudAshraf97/whisper-diarization.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about whisper-diarization
What is the integration point, and how are words assigned to speakers?
diarize.py -a AUDIO_FILE_NAME as a file-processing step. Whisper supplies the text, CTC forced alignment supplies word timing, and NeMo supplies speaker segments. The pipeline assigns speaker labels by matching timestamps, then uses punctuation to refine sentence boundaries. The documented interface is a CLI, not a network API.Is 10 GB of VRAM required, and what should I do if inference runs out of memory?
diarize.py. Start with the sequential path, reduce --batch-size under memory pressure, and set it to 0 to disable batched inference. Measure peak usage with the actual model and input files.Can we self-host this commercially or include it in a distributed product?
When is this a better choice than plain Whisper, a custom diarization pipeline, or a managed API?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy