Files
pyannote-speaker-diarizatio…/tests/unit/test_diar_window.py
transcrilive 2b1a3c1312 feat: initial public release v0.1.0 — MLX port of pyannote-speaker-diarization-3.1
Byte-parity with pyannote-PyTorch reference (cosine 0.763718 identical
at 6 decimals on 200 cross-window slot pairs). 2.5x faster than
pyannote-MPS on Apple Silicon native.

Extracted from gitea.tavportal.com/olivier/MLX_CONVERTOR commit 5f9eafa.
2026-05-09 16:05:39 +02:00

17 lines
554 B
Python

from pyannote_diarization_3_1_mlx._window import sliding_windows
import numpy as np
def test_sliding_windows_full_coverage():
sr = 16000
audio = np.zeros(int(25 * sr), dtype=np.float32)
windows = list(sliding_windows(audio, sr=sr, duration_s=10.0, hop_s=1.0))
# Expect (25-10)/1 + 1 = 16 windows, all 10 s long
assert len(windows) == 16
for start, end, slice_ in windows:
assert end - start == 10.0
assert len(slice_) == 10 * sr
# boundaries
assert windows[0][0] == 0.0
assert windows[-1][1] == 25.0