Credentials. Diarization needs your Hugging Face token; pass it from the environment and never commit it.
Who it is forA journalist or analyst with a two-person interview.
The problemRaw transcripts do not say who is speaking.
The outcomeA transcript where each segment carries a speaker ID.
What you need first
- Python with pip, ffmpeg may also be needed
- A GPU with CUDA toolkit 12.8 for speed, CPU also works
- A Hugging Face read token for speaker diarization
Steps
- Generate a Hugging Face read token and accept the user agreement for the speaker-diarization-community-1 model
- Run
whisperx path/to/audio.wav --model large-v2 --diarize --highlight_words Trueadding your token with the--hf_tokenargument - Set
--min_speakers 2and--max_speakers 2if you know the speaker count - Review the labeled output and fix any mislabeled turns
Prompt for your agent
With m-bain/whisperX, run `whisperx <my audio file> --model large-v2 --diarize --highlight_words True --min_speakers 2 --max_speakers 2` using my Hugging Face token from the environment, and show the first 20 labeled lines.
Caveat. Overlapping speech is not handled well and diarization is far from perfect.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for m-bain/whisperX and "Label who said what with diarization"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer