This is an Ascend NPU-adapted deployment for pyannote/voice-activity-detection (Voice Activity Detection pipeline wrapping segmentation).
e66f3d3b9eb0873085418a7b813d3b369bf160bb (segmentation-3.0)pyannote.audio.models.segmentation.PyanNet (SincNet stride 10, BiLSTM 4x128 bidirectional, linear 2x128) with 7-channel powerset outputpyannote-vad (real audio file → frame probabilities → hysteresis binarization → speech segments)npu:0 with synchronized timing and CPU-NPU consistency validationModel and tensors are explicitly placed on npu:0 and verified:
next(model.parameters()).device == npu:0input waveform device == npu:0 (10s chunk [1,1,160000] and full 30s file chunked via Inference)prob matrix device == npu:0 shape [1,589,7] (10s) and [1,1779,1] aggregatedtorch.npu.synchronize() before/after timingSynchronization uses torch.npu.synchronize() around each timed forward.
pyannote-audio/sample/sample.wav, 16000 Hz, mono, 30s, speech 6.7-30s):
0.00245, mean 0.00063, cosine 0.9999990.0169s (<0.5s), coverage delta 0.00056 (<0.02), region IoU 0.999 (>0.95) => PASS0.00195 (seconds of compute per second of audio), frames/s ~30387torch.npu.synchronize() around each timed Inference callValidated on Ascend 910 (2x NPU, 61 GiB free, torch 2.9.0, torch_npu 2.9.0.post1, CANN 8.5.1).
from pyannote.audio import Model
from pyannote.audio.core.inference import Inference
from pyannote.audio.utils.signal import Binarize
import soundfile as sf, torch, torch_npu, numpy as np
model = Model.from_pretrained("pyannote/segmentation-3.0")
model.to("npu:0")
inference = Inference(model, pre_aggregation_hook=lambda s: np.max(s, axis=-1, keepdims=True))
wave, sr = sf.read("audio.wav") # 16kHz mono
file = {"waveform": torch.from_numpy(wave).float().unsqueeze(0), "sample_rate": sr}
scores = inference(file) # (frames,1)
binarize = Binarize(onset=0.81, offset=0.48, min_duration_on=0.055, min_duration_off=0.097)
annotation = binarize(scores)
for seg, track in annotation.itertracks():
print(seg.start, seg.end)See inference.py for full synchronized example with device proof and 30s file.

inference.py - NPU inference with device proof, consistency and perfrequirements.txt - dependenciesassets/*.png - xterm.js evidence screenshots