Add SpeakerKit with Pyannote speaker diarization support (#440)
On-device speaker diarization using the [Pyannote v4 (community-1)](https://huggingface.co/argmaxinc/speakerkit-coreml) pipeline.
```
swift run whisperkit-cli diarize --audio-path audio.wav [--verbose] \
[--num-speakers N] [--cluster-distance-threshold F] \
[--model-path /path] [--model-repo org/repo] [--download-model-path /path] \
[--rttm-path output.rttm]
```
Output is standard RTTM. Use --model-path for existing models; otherwise models are resolved/downloaded as needed (e.g. via --download-model-path).
```
swift run whisperkit-cli transcribe --audio-path audio.wav --diarization [--verbose] \
[--diarization-model-path /path] [--diarization-model-repo org/repo] \
[--diarization-num-speakers N]
```
Runs transcription and diarization in one pass. Word timestamps are enabled when --diarization is set so speaker labels align at the subsegment level. RTTM lines are printed to stdout.
WhisperAX shows full SpeakerKit integration:
- Pipeline version picker (Pyannote 4 or None)
- Speakers tab with per-segment speaker labels
```
SpeakerKit
├── SpeakerKit.swift — public API (diarize, generateRTTM)
├── SpeakerKitModelManager.swift — download + load Pyannote models
├── PyannoteConfig.swift — config + DiarizationOptionsProtocol
├── DiarizationResult.swift — result type + transcription alignment
├── SpeakerSegment.swift
├── SpeakerInfo.swift
├── RTTMLine.swift
└── Pyannote/
├── PyannoteDiarizer.swift
├── SpeakerSegmenterModel.swift
├── SpeakerEmbedderModel.swift
├── SpeakerPreEmbedderModel.swift
├── SpeakerClustering.swift — clustering protocol + config
├── VBxClustering.swift — variational Bayes HMM
├── ClusteringAlgorithms.swift — fast linkage
└── MathOps.swift — matrix ops (Accelerate)
ArgmaxCore
├── ModelDownloader.swift — downloads + ModelInfo struct
├── ModelState.swift
└── (other shared utilities: Logging, ModelUtilities, etc.)
```
---------
Co-authored-by: ZachNagengast <znagengast@gmail.com> A
Andrey Leonov committed
26577ce3017aae8c9edfd9a0dd17851bd248c731
Parent: d447d30
Committed by GitHub <noreply@github.com>
on 3/13/2026, 3:24:57 PM