jsjs1258/pyannote-segmentation-3.0-NPU
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

pyannote-segmentation-3.0 — Ascend NPU Adaptation

Frame-level speaker segmentation model (PyanNet: SincNet frontend + 4-layer BiLSTM + linear classifier, powerset output) adapted to run on Huawei Ascend NPU with torch_npu. The model consumes 10 s / 16 kHz mono waveform chunks and emits a frame probability matrix [B, 589, 7]: channel 0 is non-speech, channels 1–3 are single speakers speaker#1..3, channels 4–6 are the three pairwise-overlap classes. It outputs time-framed speaker activity probabilities — it is not an ASR/transcription model and does not produce text.

Provenance

  • Architecture and weights: pyannote/segmentation-3.0 (MIT license), obtained from the public mirror ivrit-ai/pyannote-segmentation-3.0 at revision main (config.yaml + pytorch_model.bin, sha256-verified structure).
  • Test audio: jfk.flac from the OpenAI Whisper test assets — 11 s of real speech containing both speech regions and pauses.

NPU adaptation results

All numbers below come from real end-to-end runs on this device:

ItemValue
DeviceAscend910 (Ascend910_9362), npu:0
Stacktorch 2.9.0 + torch_npu 2.9.0.post1, CANN 8.5.1
Model parameters1,473,265
Model/input/output tensorsall verified on npu:0
Probability matrix shape[2, 589, 7] (11 s audio → two 10 s chunks)
CPU–NPU max abs diff0.0242 (mean 2.02e-4)
Flattened cosine similarity0.999995
Speech-frame agreement (0.5 threshold)100% (ratio 37.69% both devices)
First-run latency (graph compile)3700.8 ms
Stable latency (mean of 7 runs)179.2 ms per 11 s file (p50 197.9 ms)
RTF (real-time factor)0.0163
Throughput≈ 7013 frames/s
Peak host memory≈ 2.33 GB
NPU HBM allocated32.7 MB

Consistency was measured with identical weights, identical resampled input, float32 dtype and identical chunking on both backends; thresholds were fixed in advance (max abs diff ≤ 0.05, cosine ≥ 0.999, speech-frame agreement ≥ 99.9%).

Evidence

Workflow log (model inspection, offline load, CPU baseline, NPU inference):

agent workflow

NPU device verification (npu-smi, torch.npu.is_available(), tensor devices):

npu device call

CPU–NPU consistency validation and synchronized benchmark:

model result

Usage

pip install -r requirements.txt

# download a real speech file (any wav/flac/mp3 readable by soundfile),
# then run CPU baseline + real npu:0 inference:
python3 inference.py \
    --model-dir <local pyannote-segmentation-3.0 dir> \
    --audio <speech.wav> \
    --out-dir output \
    --stable-runs 6

The script is fully offline: it loads config.yaml + pytorch_model.bin from the local --model-dir (no hub access), restores minimal torchaudio 2.9 compatibility shims before importing pyannote.audio, resamples input to 16 kHz mono, splits into zero-padded 10 s windows, runs the CPU baseline and the NPU pass with torch.npu.synchronize() around every timed region, and writes cpu_probs.npy, npu_probs.npy, npu_timing.jsonl and summary.json. Weights are not included in this repository.