WhisperX adds word-level timestamps and speaker diarization to Whisper transcription: it tells you who spoke each line. It runs batched inference for speed, and diarization needs a Hugging Face token plus acceptance of the pyannote model licences. This guide installs it, transcribes a two-person recording, and checks the speaker labels.
Before you start
- Python 3.10, and a GPU with CUDA for practical speed (CPU works but is slow).
- ffmpeg installed on your system.
- A Hugging Face account and a read token, plus acceptance of the pyannote speaker-diarization model licence, for diarization only.
Install WhisperX
Install PyTorch for your system first, following pytorch.org, then install WhisperX:
pip install whisperx
Or run it without installing with uvx whisperx.
Transcribe with diarization
Run WhisperX on a two-speaker recording, passing your token:
whisperx interview.wav --model large-v2 --diarize --min_speakers 2 --max_speakers 2 --hf_token hf_YOUR_TOKEN_HERE
Keep your token private: never paste it into a shared file or a chat.
Check the speaker labels
Open the output transcript and listen to the first minute. Each segment carries a speaker label such as SPEAKER_00. Check that the label changes when the speaker changes, and fix the labels by hand where it is wrong.
Worked example
Sample check: a two-minute interview where Ana asks the first question and Ben answers. The transcript should label Ana’s question SPEAKER_00 and Ben’s answer SPEAKER_01, with word timestamps that increase through the file. If the labels do not switch at the change of speaker, the diarization failed: check the token and the model licence acceptance.
Expected result
UNTESTED in this guide: no transcription was run while writing it. The expected result is a transcript with word timestamps and speaker labels that switch when the speaker changes, matching the first minute of audio.
Limitations
Diarization needs a Hugging Face token and acceptance of gated model licences; without them, transcription still works but there are no speaker labels. WhisperX is slow on CPU and works best on a GPU. Speaker labels are guesses: always check them by listening.
