File size: 3,296 Bytes
15bde77 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | # 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`.
|