OpenVINO acceleration for the pyannote.audio speaker diarization 3.1 pipeline. This project keeps the familiar pyannote API while running the heavy segmentation and embedding models via Intel-compatible OpenVINO IR, so the pipeline runs on CPU and Intel GPUs without relying on PyTorch FFT patches.
- Create or activate the provided virtual environment (
.venv). - Install the runtime dependencies:
The
python -m pip install -e .[stt]
[stt]extra pulls theopenai-whispermodel that thedocs/transcribe_v4.pyhelper uses to turn diarization segments into per-speaker text. If you only need the OV pipeline, install the base requirements listed inrequirements.txt. - Ensure you have an FFmpeg binary on
PATH(the repo contains shared libraries underffmpeg/binfor convenience).
Export scripts live under scripts/phase2/:
export_segmentation.pyexports the SincNet+transformer segmentation model with dynamic frame lengths.export_embedding.pywraps the ResNet embedding head so it consumes pre-computed mel filter banks instead of running FFT/RFFT inside the ONNX graph.
Run both scripts before converting to IR:
python scripts/phase2/export_segmentation.py --duration 2.0 --output models/onnx/segmentation.onnx
python scripts/phase2/export_embedding.py --duration 2.0 --frames 128 --output models/onnx/embedding.onnxYou can also use the optimum-cli shortcuts shown in this repo:
optimum-cli export openvino --model models/onnx/segmentation.onnx models/ov/segmentation
optimum-cli export openvino --model models/onnx/embedding.onnx models/ov/embeddingconvert_to_ov.py wraps the OpenVINO Model Optimizer (MO) to turn ONNX files
into .xml/.bin IR blobs stored under models/ov/. By default it keeps FP32
weights but accepts --weight-format fp16 for iGPU workloads.
Validation is available via scripts/phase3/validate_ov.py, which loads the IR
models with openvino.runtime.Core, runs dummy inputs, and prints the output
shapes.
Use pyannote_openvino.OVSpeakerDiarization as a drop-in replacement for
pyannote.audio.Pipeline.from_pretrained("pyannote/speaker-diarization-3.1").
The helper accepts segmentation_xml, embedding_xml, and a device string such as
CPU, GPU, or GPU.0:
from pyannote_openvino import OVSpeakerDiarization
pipeline = OVSpeakerDiarization.from_pretrained("models/ov", device="GPU")
diart = pipeline("samples/Stirling Lennon Clips_mixdown.wav")
print(diart)By default the segmentation/embedding classes mirror the pyannote interface
(num_frames, receptive_field_size, etc.), so the existing clustering code and
pipeline utilities continue to work.
The repo ships a single CLI under docs/transcribe_v4.py that accelerates both diarization and transcription on Intel iGPU:
- Run the OpenVINO diarization pipeline.
- Load the same WAV file into memory and crop each speaker turn.
- Feed each crop to
openai-whisper(defaulttiny) to produce text for the speaker/segs.
Example usage:
python docs/transcribe_v4.py \
--audio samples/Stirling\ Lennon\ Clips_mixdown.wav \
--device GPU \
--whisper-ov whisper-large-v3-ov \
--output-txt artifacts/transcribe_v4.txtThe CLI prints timestamps, speaker labels, and the recognized text, and also
writes a TSV-style summary to the --output path for later reference.
python scripts/phase1/audit_models.pyrecords environment versions and shapes.python scripts/phase2/validate_onnx.pycompares the ONNX exports against the original torch models.scripts/phase3/validate_ov.pyloads the IR models and runs dummy inference.docs/transcribe_v4.pyserves as the end-to-end Intel GPU smoke test (diarization + STT) on any WAV file.
models/onnx/– ONNX exports produced by Phase 2.models/ov/– OpenVINO IR files generated by Phase 3.scripts/phase{1..3}/– export, conversion, and validation helpers.pyannote_openvino/– the runtime library that wiresOVSegmentationModel,OVEmbeddingModel, andOVSpeakerDiarizationinto pyannote’s APIs.docs/transcribe_v4.py– per-speaker transcription CLI.
- If
torchaudiofails to read your audio, install FFmpeg and pointPATHatffmpeg/bin(a copy lives in this repo for reference). - Whisper downloads models the first time it runs; choose a small or tiny model
for fast iteration and pin
--stt-devicetocpuif your GPU is busy.
- Install the
testextra (and the transcription tooling) before running the suite:python -m pip install -e .[stt,test]
- Run the pytest suite to make sure the OV pipeline returns a valid annotation:
python -m pytest
- The same command runs in CI (GitHub Actions, GitLab CI) and is fast enough to execute on every push/PR.
- GitHub Actions:
ci.ymlruns on push/PR, installs the[stt,test]extras, and executespython -m pytest.release.ymlruns onrefs/tags/v*, reuses the same extras plus thebuildtool, reruns the tests, builds a wheel/tarball viapython -m build, and publishes the artifacts to a GitHub release usingsoftprops/action-gh-release.
- GitLab CI:
.gitlab-ci.ymldefinestestandreleasestages. Both install the[stt,test,build]extras, thetestjob runspython -m pytest, and thereleasejob (tag-only) runspython -m buildand exposesdist/as an artifact for later download.- Commit tags matching
v*(for examplev0.1.0) will trigger the release stage and produce the distributables.