Audio Classification
ONNX
Safetensors
English
model_hub_mixin
pytorch_model_hub_mixin
AASIST3 / implementation-notes.md
korallll's picture
Make repo self-contained: inference wrapper code and arena_entry.yaml
15bde77 verified
|
Raw History Blame Contribute Delete
3.3 kB

AASIST3 — implementation notes

Wrapper for the Speech Anti-Spoofing Arena. Source: https://github.com/mtuciru/AASIST3, weights: https://huggingface.co/lab260/AASIST3.

Key decisions / gotchas

  • Score direction = output[:, 1] (class 1 = bona fide). The HF model-card "Quick Start" snippet claims prediction 0 = bonafide, but that is generic boilerplate that contradicts the actual source pipeline: datasets/generic.py maps bonafide → 1, spoof → 0, and utils/validation.py::compute_scores takes outputs[:, 1] as the score (with compute_antispoofing_metrics treating label == 1 as genuine). Verified empirically — ASVspoof2019_LA gives EER 9.44 %, not ~90 % (which an inverted sign would give).

  • Self-contained checkpoint. model.safetensors (~1.29 GB) bundles the XLS-R-53 SSL encoder weights. from_pretrained("lab260/AASIST3") reads config.json (load_pretrained: false), builds the wav2vec2 architecture from the facebook/wav2vec2-large-xlsr-53 config, then overwrites every weight from the safetensors. No separate base checkpoint download (unlike W2V2-AASIST's xlsr2_300m.pt).

  • transformers 5.3.0 loads the 4.52.4-era checkpoint cleanly — no key remap needed. (Source pinned transformers==4.52.4.)

  • Preemphasis (0.97). The source eval pipeline applies torchaudio.functional.preemphasis to the full waveform before windowing; the wrapper replicates it (preemphasis() in aasist3.py) so scores match the training/eval preprocessing.

  • Fixed 64,600-sample window. The model's pos_S (42) / pos_T (67) positional embeddings are sized for exactly 64,600 input samples, so the window is not optional. Deterministic first-64,600 (tile-repeat if shorter); no random crop.

  • Device-agnostic. KAN/GAT/HS-GAL use device=x.device / torch.zeros_like, so a plain .to(device) in load() is enough — no internal device hard-coding.

  • batch_size = 16. Throughput plateaus ~38–39 utt/s for bs ≥ 8 on one RTX 4070 Ti SUPER; 16 chosen (within ~1.3 % of peak, lower memory).

Submission specifics (non-standard for this run)

  • Scores hosted in lab260/AASIST3, not a new SpeechAntiSpoofingBenchmarks/<Model> repo (per user instruction). The default org-scoped fine-grained token cannot write or even open a PR cross-org, so a separate lab260-scoped token was used to commit scores directly to lab260/AASIST3 main; dataset-repo submission PRs use the original org-scoped token. See memory reference_external_modelrepo_submit.

  • ASVspoof2021_DF verify-pr was CI-flaky. The first two verify-hf-pr runs failed at ~200 s on the 611 k-trial label stream (infra, no verdict posted) — the documented un-retried-stream residual; only DF (3.4× the next-largest dataset) was affected. A third re-dispatch (plus the sweep-pending-verifications backstop) passed green. The artifact was always correct (sha exact; reproduce --scoring --no-local Δ0.0).

  • Backlinks + cumulative README/model-card badges were batched at the end (one model-repo commit; the tier/rank badge reflects final 5/5 coverage) rather than per-dataset. genbacklink.py output verified byte-identical to the post-merge-badge comment's result.yaml.