alexwengg's picture
v3: BNNS-fixed Sortformer models β€” README
07d2d01 verified
|
Raw
History Blame Contribute Delete
2.5 kB

Sortformer CoreML β€” v3 (BNNS-fixed rebuild)

Rebuilt streaming Sortformer diarization models (NVIDIA diar_streaming_sortformer_4spk-v2.1 / -v2), converted to CoreML. v3 fixes the BNNS graph-compile crash that affected the earlier root-level models.

Why v3

The earlier models had chunk_pre_encoder_embs_out as both an input and an output of the head sub-model, which the macOS 26 / newer BNNS graph compiler rejects:

BNNS Graph Compile: Function main has tensor chunk_pre_encoder_embs_out as both an input and output.

That bug was a toolchain artifact (torch 2.9.x tracing folded the identity op that kept input/output distinct). v3 is rebuilt on torch 2.7 + coremltools 9.0, producing a clean head (no alias), verified to load and predict on computeUnits=.all (ANE/GPU) and numerically matched to the PyTorch reference (speaker-argmax agreement 100%).

Contents

v3/
  fp16/         full-precision (229–243 MB/variant) β€” default quality
  palettized/   6-bit kmeans-LUT weight palettization (93–99 MB/variant)

7 variants in each (Swift ModelNames.Sortformer.Variant):

File Config chunk_len latency use
Sortformer_v2.1 / _v2 fast / default 6 ~0.48 s low-latency streaming
SortformerEfficient_v2.1 efficient 25 ~2 s higher-throughput streaming (~4Γ— RTFx of default)
SortformerNvidiaLow_v2.1 / _v2 balanced 6 ~0.48 s larger FIFO for stability
SortformerNvidiaHigh_v2.1 / _v2 high-context 340 ~27 s offline / best throughput

fp16 vs palettized

6-bit palettization (matches Argmax's speakerkit recipe; GPU-safe LUT, not int8 which crashes MPSGraph):

  • Size: ~2.5Γ— smaller (e.g. highContext 243 β†’ 99 MB) β€” fixes RAM-driven crashes on older devices.
  • Speed: unchanged (same per-call latency on GPU).
  • Accuracy: +0.9 pp DER avg on full AMI-SDM (16 mtg, forced-alignment GT, collar 0.25) β€” most meetings +0.0–1.0 pp, a few +2–4 pp. Use fp16 if you need the last ~1 pp; palettized to fix RAM / shrink download.

Reference DER (AMI-SDM, forced-alignment GT, collar 0.25, M5 Pro)

Variant DER RTFx
highContext offline (tuned) ~26.5% ~860Γ—
default streaming (0.48 s) ~29.0% ~49Γ—

Absolute DER is high because AMI-SDM (single distant mic, 4 speakers) is a hard condition; same NeMo weights as other Sortformer ports, so accuracy is model-equivalent.