pyannote-audio

pyannoteMIT活跃维护

基于 PyTorch 的说话人日志神经网络组件库,提供语音活动检测、说话人变化检测、重叠语音检测和说话人嵌入等预训练模块,方便搭建说话人分离与识别流程。

Neural building blocks for speaker diarization: speech activity detection, speaker change detection, overlapped speech detection, speaker embedding

4.0.7发布于 2026-06-30 14:29 UTC10,775star +13 / 7 天1,135fork同步于 2026-11-10 17:29 UTC

怎么上手

由 README 提炼,执行前请确认
pip install pyannote.audio
硬件要求按 README 说明

README 未明确列出最低显存要求;示例中可将流水线移至 CUDA GPU,速度基准在 NVIDIA H100 80GB HBM3 上测得,CPU 运行方式未说明。

多卡 / 张量并行
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

基于 PyTorch 的开源说话人日志工具包,提供预训练模型和流水线,直接做说话人分离

基于 PyTorch 的说话人日志神经网络组件库,提供语音活动检测、说话人变化检测、重叠语音检测和说话人嵌入等预训练模块,方便搭建说话人分离与识别流程。

核心能力

  • 提供语音活动检测、说话人变化检测、重叠语音检测、说话人嵌入等神经模块
  • 内置 Hugging Face 预训练流水线,可直接推理或微调
  • 支持 pyannoteAI 云端高精度说话人日志服务
  • Python 原生 API,基于 PyTorch 与 pytorch-lightning 多 GPU 训练

容易踩的坑

需先安装 ffmpeg,torchcodec 音频解码依赖它;使用预训练流水线前要在 Hugging Face 接受用户协议并配置访问 token;precision-2 为付费云端服务,需单独申请 pyannoteAI API key。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本4.0.7
  1. 4.0.7最新正式版2026-06-30 · 2026-06-30 14:29 UTC

    这个版本没有写更新说明。

  2. 4.0.62026-06-29 · 2026-06-29 13:25 UTC

    这个版本没有写更新说明。

  3. 4.0.52026-06-22 · 2026-06-22 09:29 UTC

    这个版本没有写更新说明。

  4. 4.0.42026-02-07 · 2026-02-07 09:57 UTC

    这个版本没有写更新说明。

  5. 4.0.3Version 4.0.32025-12-07 · 2025-12-07 06:44 UTC
    查看更新说明
    • feat(cli): add --revision option to most CLI commands
    • feat(util): add Calibration.safe_transform method (supports NaNs as well as any shape)
    • fix(model): fix Model.from_pretrained to support lightning 2.6+
    • setup: update pyannote-database dependency to 6.1+

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    pyannote.audio social preview

    pyannote.audio is an open-source toolkit written in Python for speaker diarization. Based on PyTorch machine learning framework, it comes with state-of-the-art pretrained models and pipelines, that can be further finetuned to your own data for even better performance.

    Highlights

    community-1 open-source speaker diarization

    1. Make sure ffmpeg is installed on your machine (needed by torchcodec audio decoding library)
    2. Install with uvadd pyannote.audio (recommended) or pip install pyannote.audio
    3. Accept pyannote/speaker-diarization-community-1 user conditions
    4. Create Huggingface access token at hf.co/settings/tokens
    import torch
    from pyannote.audio import Pipeline
    from pyannote.audio.pipelines.utils.hook import ProgressHook
    
    # Community-1 open-source speaker diarization pipeline
    pipeline = Pipeline.from_pretrained(
        "pyannote/speaker-diarization-community-1", token="HUGGINGFACE_ACCESS_TOKEN"
    )
    
    # send pipeline to GPU (when available)
    pipeline.to(torch.device("cuda"))
    
    # apply pretrained pipeline (with optional progress hook)
    with ProgressHook() as hook:
        output = pipeline("audio.wav", hook=hook)  # runs locally
    
    # print the result
    for turn, speaker in output.speaker_diarization:
        print(f"start={turn.start:.1f}s stop={turn.end:.1f}s speaker_{speaker}")
    # start=0.2s stop=1.5s speaker_0
    # start=1.8s stop=3.9s speaker_1
    # start=4.2s stop=5.7s speaker_0
    # ...
    

    precision-2 premium speaker diarization

    1. Create pyannoteAI API key at dashboard.pyannote.ai
    2. Enjoy free credits!
    from pyannote.audio import Pipeline
    
    # Precision-2 premium speaker diarization service
    pipeline = Pipeline.from_pretrained(
        "pyannote/speaker-diarization-precision-2", token="PYANNOTEAI_API_KEY"
    )
    
    output = pipeline("audio.wav")  # runs on pyannoteAI servers
    
    # print the result
    for turn, speaker in output.speaker_diarization:
        print(f"start={turn.start:.1f}s stop={turn.end:.1f}s {speaker}")
    # start=0.2s stop=1.6s SPEAKER_00
    # start=1.8s stop=4.0s SPEAKER_01
    # start=4.2s stop=5.6s SPEAKER_00
    # ...
    

    Visit docs.pyannote.ai to learn about other pyannoteAI features (voiceprinting, confidence scores, ...)

    Benchmark

    Benchmark (last updated in 2025-09)legacy (3.1)community-1precision-2
    AISHELL-412.211.711.4
    AliMeeting (channel 1)24.520.315.2
    AMI (IHM)18.817.012.9
    AMI (SDM)22.719.915.6
    AVA-AVD49.744.637.1
    CALLHOME (part 2)28.526.716.6
    DIHARD 3 (full)21.420.214.7
    Ego4D (dev.)51.246.839.0
    MSDWild25.422.817.3
    RAMC22.220.810.5
    REPERE (phase2)7.98.97.4
    VoxConverse (v0.3)11.211.28.5

    Diarization error rate (in %, the lower, the better)

    Compared to the 3.1 legacy pipeline, community-1 brings significant improvement in terms of speaker counting and assignment. precision-2 premium pipeline further improves accuracy as well as processing speed (in its self-hosted version).

    Benchmark (last updated in 2025-09)community-1precision-2Speed up
    AMI (IHM), ~1h files31s per hour of audio14s per hour of audio2.2x faster
    DIHARD 3 (full), ~5min files37s per hour of audio14s per hour of audio2.6x faster

    Self-hosted speed on a NVIDIA H100 80GB HBM3

    Telemetry

    With the optional telemetry feature in pyannote.audio, you can choose to send anonymous usage metrics to help the pyannote team improve the library.

    What we track

    For each call to Pipeline.from_pretrained({origin}) (or Model.from_pretrained({origin})), we track information about {origin} in the following privacy-preserving way:

    • If {origin} is an official pyannote or pyannoteAI pipeline (or model) hosted on Huggingface, we track it as {origin}.
    • If {origin} is a pipeline (or model) hosted on Huggingface from any other organization, we track it as huggingface.
    • If {origin} is a path to a local file or directory, we track it as local.

    We also track the pipeline Python class (e.g. pyannote.audio.pipelines.SpeakerDiarization).

    For each file processed with a pipeline, we track

    • the file duration in seconds
    • the value of num_speakers, min_speakers, and max_speakers for speaker diarization pipelines

    We do not track any information that could identify who the user is.

    Configuring telemetry

    Telemetry can be configured in three ways:

    1. Using an environment variable
    2. Within the current Python session only
    3. Globally across sessions

    All of these options will modify the value of the environment variable for consistency. If the environment variable is not set, pyannote.audio will read the default value in the telemetry config. The default config can also be changed from Python.

    Using environment variable

    You can control telemetry by setting the PYANNOTE_METRICS_ENABLED environment variable:

    # enable metrics
    export PYANNOTE_METRICS_ENABLED=1
    
    # disable metrics
    export PYANNOTE_METRICS_ENABLED=0
    
    For current session

    To control telemetry for your current Python kernel session:

    from pyannote.audio.telemetry import set_telemetry_metrics
    
    # enable metrics for current session
    set_telemetry_metrics(True)
    
    # disable metrics for current session
    set_telemetry_metrics(False)
    
    Global configuration

    To set telemetry preferences that persist across sessions:

    from pyannote.audio.telemetry import set_telemetry_metrics
    
    # enable metrics globally
    set_telemetry_metrics(True, save_choice_as_default=True)
    
    # disable metrics globally
    set_telemetry_metrics(False, save_choice_as_default=True)
    

    Documentation

    Citations

    If you use pyannote.audio please use the following citations:

    @inproceedings{Plaquet23,
      author={Alexis Plaquet and Hervé Bredin},
      title={{Powerset multi-class cross entropy loss for neural speaker diarization}},
      year=2023,
      booktitle={Proc. INTERSPEECH 2023},
    }
    
    @inproceedings{Bredin23,
      author={Hervé Bredin},
      title={{pyannote.audio 2.1 speaker diarization pipeline: principle, benchmark, and recipe}},
      year=2023,
      booktitle={Proc. INTERSPEECH 2023},
    }
    

    Development

    The commands below will setup pre-commit hooks and packages needed for developing the pyannote.audio library.

    uv sync --extra dev --extra test --extra cli
    uvx pre-commit install
    

    Test

    uv run --extra test --extra cli pytest -m "not network and not notebook"
    

    Tests marked network download a public model from Hugging Face:

    uv run --extra test --extra cli pytest -m network
    

    Historical notebooks are opt-in (pytest -m notebook) and may require additional models, datasets, credentials, and updates for the current API.

    Run lint and formatting checks with uvx ruff check . and uvx ruff format --check ..