korallll commited on
Commit
c578c83
·
verified ·
1 Parent(s): 9c5d4dd

Add DFADD test split (canonical parquet)

Browse files
.gitattributes CHANGED
@@ -1,60 +1,2 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.avro filter=lfs diff=lfs merge=lfs -text
4
- *.bin filter=lfs diff=lfs merge=lfs -text
5
- *.bz2 filter=lfs diff=lfs merge=lfs -text
6
- *.ckpt filter=lfs diff=lfs merge=lfs -text
7
- *.ftz filter=lfs diff=lfs merge=lfs -text
8
- *.gz filter=lfs diff=lfs merge=lfs -text
9
- *.h5 filter=lfs diff=lfs merge=lfs -text
10
- *.joblib filter=lfs diff=lfs merge=lfs -text
11
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
12
- *.lz4 filter=lfs diff=lfs merge=lfs -text
13
- *.mds filter=lfs diff=lfs merge=lfs -text
14
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
15
- *.model filter=lfs diff=lfs merge=lfs -text
16
- *.msgpack filter=lfs diff=lfs merge=lfs -text
17
- *.npy filter=lfs diff=lfs merge=lfs -text
18
- *.npz filter=lfs diff=lfs merge=lfs -text
19
- *.onnx filter=lfs diff=lfs merge=lfs -text
20
- *.ot filter=lfs diff=lfs merge=lfs -text
21
  *.parquet filter=lfs diff=lfs merge=lfs -text
22
- *.pb filter=lfs diff=lfs merge=lfs -text
23
- *.pickle filter=lfs diff=lfs merge=lfs -text
24
- *.pkl filter=lfs diff=lfs merge=lfs -text
25
- *.pt filter=lfs diff=lfs merge=lfs -text
26
- *.pth filter=lfs diff=lfs merge=lfs -text
27
- *.rar filter=lfs diff=lfs merge=lfs -text
28
- *.safetensors filter=lfs diff=lfs merge=lfs -text
29
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
30
- *.tar.* filter=lfs diff=lfs merge=lfs -text
31
- *.tar filter=lfs diff=lfs merge=lfs -text
32
- *.tflite filter=lfs diff=lfs merge=lfs -text
33
- *.tgz filter=lfs diff=lfs merge=lfs -text
34
- *.wasm filter=lfs diff=lfs merge=lfs -text
35
- *.xz filter=lfs diff=lfs merge=lfs -text
36
- *.zip filter=lfs diff=lfs merge=lfs -text
37
- *.zst filter=lfs diff=lfs merge=lfs -text
38
- *tfevents* filter=lfs diff=lfs merge=lfs -text
39
- # Audio files - uncompressed
40
- *.pcm filter=lfs diff=lfs merge=lfs -text
41
- *.sam filter=lfs diff=lfs merge=lfs -text
42
- *.raw filter=lfs diff=lfs merge=lfs -text
43
- # Audio files - compressed
44
- *.aac filter=lfs diff=lfs merge=lfs -text
45
- *.flac filter=lfs diff=lfs merge=lfs -text
46
- *.mp3 filter=lfs diff=lfs merge=lfs -text
47
- *.ogg filter=lfs diff=lfs merge=lfs -text
48
- *.wav filter=lfs diff=lfs merge=lfs -text
49
- # Image files - uncompressed
50
- *.bmp filter=lfs diff=lfs merge=lfs -text
51
- *.gif filter=lfs diff=lfs merge=lfs -text
52
- *.png filter=lfs diff=lfs merge=lfs -text
53
- *.tiff filter=lfs diff=lfs merge=lfs -text
54
- # Image files - compressed
55
- *.jpg filter=lfs diff=lfs merge=lfs -text
56
- *.jpeg filter=lfs diff=lfs merge=lfs -text
57
- *.webp filter=lfs diff=lfs merge=lfs -text
58
- # Video files - compressed
59
- *.mp4 filter=lfs diff=lfs merge=lfs -text
60
- *.webm filter=lfs diff=lfs merge=lfs -text
 
1
+ *.tar.gz filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  *.parquet filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.gitignore ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ __pycache__/
2
+ .pytest_cache/
3
+ *.pyc
4
+ _clean_flac/
LICENSE.txt ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ DFADD (The Diffusion and Flow-Matching Based Audio Deepfake Dataset) is released
4
+ under the MIT License by its authors (arXiv:2409.08731). This repository hosts the
5
+ DFADD test (eval) split repackaged in the canonical Arena parquet format.
6
+
7
+ Copyright (c) 2024 The DFADD authors
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
26
+
27
+ ---
28
+
29
+ Underlying speech: the CSTR VCTK Corpus, distributed under the Creative Commons
30
+ Attribution 4.0 International (CC BY 4.0) license. Attribute both the DFADD
31
+ authors and the VCTK Corpus when using this dataset.
README.md ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language: [en]
4
+ pretty_name: "DFADD — Diffusion and Flow-Matching Based Audio Deepfake Dataset"
5
+ task_categories: [audio-classification]
6
+ size_categories: [1K<n<10K]
7
+ configs:
8
+ - config_name: default
9
+ data_files:
10
+ - {split: test, path: "data/test-*.parquet"}
11
+ tags:
12
+ - anti-spoofing
13
+ - audio-deepfake-detection
14
+ - speech
15
+ - benchmark
16
+ - arena-ready
17
+ - diffusion
18
+ - flow-matching
19
+ arxiv: ["2409.08731"]
20
+ ---
21
+
22
+ # DFADD — Diffusion and Flow-Matching Based Audio Deepfake Dataset
23
+
24
+ Benchmark-ready packaging of the **DFADD** **test (eval) split** (*DFADD: The
25
+ Diffusion and Flow-Matching Based Audio Deepfake Dataset*, arXiv 2409.08731), a
26
+ VCTK-derived dataset targeting the newest generation of high-quality TTS
27
+ spoofing built on **diffusion** and **flow-matching** synthesizers.
28
+
29
+ ## Overview
30
+
31
+ Binary classification: **bonafide** (genuine VCTK recordings) vs. **spoof**
32
+ (text-to-speech generated from VCTK speakers). Label is the top-level source
33
+ directory. The spoof side spans **five** modern TTS systems:
34
+
35
+ | Generator | Family | Spoof clips (test) |
36
+ |-----------|--------|--------------------|
37
+ | Grad-TTS | diffusion | 600 |
38
+ | Matcha-TTS | flow-matching | 600 |
39
+ | NaturalSpeech 2 | latent diffusion | 600 |
40
+ | PFlow-TTS | flow-matching | 600 |
41
+ | StyleTTS 2 | diffusion (style) | 600 |
42
+
43
+ The bonafide side is the genuine VCTK audio held out for the test split (755 clips).
44
+
45
+ ## License & redistribution
46
+
47
+ Released under the **MIT License** (per the upstream DFADD release). Redistribution
48
+ is permitted with attribution; see `LICENSE.txt`. The underlying speech derives from
49
+ the **VCTK Corpus** (CC BY 4.0) — attribute both DFADD and VCTK. Audio is the
50
+ original 16 kHz mono FLAC/WAV, embedded bit-exactly (no re-encode — a full decode
51
+ probe of all test clips passed cleanly).
52
+
53
+ ## Schema
54
+
55
+ | Column | Type | Description |
56
+ |--------|------|-------------|
57
+ | `path` | `string` | source-relative path, e.g. `DATASET_GradTTS/test/p227_001_GradTTS.flac`, unique |
58
+ | `audio` | `Audio(16000)` | 16 kHz mono |
59
+ | `label` | `ClassLabel` | `"bonafide"` (0) / `"spoof"` (1) |
60
+ | `notes` | `string` | JSON: `utterance_id`, `generator`, `speaker`, `attack` |
61
+
62
+ `notes` example:
63
+ ```json
64
+ {"utterance_id": "gradtts__p227_001_GradTTS", "generator": "gradtts", "speaker": "p227", "attack": "gradtts"}
65
+ ```
66
+
67
+ `utterance_id` is `<generator>__<filename-stem>` — the bare stem repeats across
68
+ generators (the same VCTK texts are synthesized), so the generator prefix is what
69
+ makes ids unique. Bonafide ids use the `vctk__` prefix.
70
+
71
+ ## Quick Start
72
+
73
+ ```python
74
+ from datasets import load_dataset
75
+
76
+ ds = load_dataset("SpeechAntiSpoofingBenchmarks/DFADD", split="test")
77
+ print(ds[0])
78
+ ```
79
+
80
+ ## Stats
81
+
82
+ | Stat | Value |
83
+ |------|-------|
84
+ | Total trials | 3,755 |
85
+ | Bonafide (VCTK) | 755 |
86
+ | Spoof (TTS) | 3,000 |
87
+ | Generators | Grad-TTS, Matcha-TTS, NaturalSpeech 2, PFlow-TTS, StyleTTS 2 (600 each) |
88
+ | Sample rate | 16 kHz mono |
89
+
90
+ ## Source provenance
91
+
92
+ - Paper: *DFADD: The Diffusion and Flow-Matching Based Audio Deepfake Dataset*,
93
+ arXiv 2409.08731 (https://arxiv.org/abs/2409.08731).
94
+ - Underlying speech: the **VCTK Corpus** (CC BY 4.0).
95
+
96
+ ## Evaluation
97
+
98
+ For evaluation instructions and submission format, see [`submissions/README.md`](submissions/README.md).
99
+
100
+ ## Citation
101
+
102
+ ```bibtex
103
+ @article{du2024dfadd,
104
+ title = {{DFADD: The Diffusion and Flow-Matching Based Audio Deepfake Dataset}},
105
+ author = {Du, Jiawei and others},
106
+ journal = {arXiv preprint arXiv:2409.08731},
107
+ year = {2024},
108
+ }
109
+ ```
110
+
111
+ ## Maintainer
112
+
113
+ Contact: k.n.borodin@mtuci.ru
build_parquet.py ADDED
@@ -0,0 +1,280 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Parquet build for the DFADD (eval / test split) HF dataset repo.
2
+
3
+ DFADD ("The Diffusion and Flow-Matching Based Audio Deepfake Dataset", arXiv
4
+ 2409.08731) packaged for the Arena. Only the **test** split is used (eval-only).
5
+
6
+ Label is the top-level source directory:
7
+ DATASET_VCTK_BONAFIDE/test/*.wav -> bonafide (755, VCTK)
8
+ DATASET_<GEN>/test/*.{flac,wav} -> spoof (600 each, 5 generators)
9
+ GradTTS, MatchaTTS, NaturalSpeech2, PflowTTS, StyleTTS2
10
+
11
+ A full decode probe of all clips runs first; 0 failures -> CLEAN raw-byte embed
12
+ (no decode/re-encode). All source audio is already 16 kHz mono. Records are
13
+ processed sorted by utterance_id for stable sharding.
14
+
15
+ Sample mode (--limit N): first N rows into a single shard, skipping full-count
16
+ asserts -- used for the fast offline validate-dataset pass.
17
+ """
18
+
19
+ import argparse
20
+ import io
21
+ import json
22
+ import os
23
+ import tempfile
24
+ from concurrent.futures import ProcessPoolExecutor
25
+ from pathlib import Path
26
+
27
+ import datasets # noqa: E402
28
+ import pyarrow.parquet as pq # noqa: E402
29
+ import soundfile as sf # noqa: E402
30
+ from datasets import Audio, ClassLabel, Dataset, Features, Value # noqa: E402
31
+ from tqdm.auto import tqdm # noqa: E402
32
+
33
+ try:
34
+ datasets.disable_progress_bars()
35
+ except AttributeError:
36
+ from datasets.utils.logging import disable_progress_bar
37
+
38
+ disable_progress_bar()
39
+
40
+ REPO_ROOT = Path(__file__).resolve().parent
41
+ SRC_ROOT = Path("/home/kirill/mnt/users_4tb/datasets/dfadd")
42
+ PARQUET_DIR = REPO_ROOT / "data"
43
+ NUM_SHARDS = 2
44
+ EXPECTED_ROWS = 3755
45
+ EXPECTED_BONAFIDE = 755
46
+ EXPECTED_SPOOF = 3000
47
+ TARGET_SR = 16000
48
+ WORKERS = int(os.environ.get("DFADD_BUILD_WORKERS", "32"))
49
+
50
+ # source dir -> (label, generator)
51
+ GENERATORS = {
52
+ "DATASET_VCTK_BONAFIDE": ("bonafide", "vctk"),
53
+ "DATASET_GradTTS": ("spoof", "gradtts"),
54
+ "DATASET_MatchaTTS": ("spoof", "matchatts"),
55
+ "DATASET_NaturalSpeech2": ("spoof", "naturalspeech2"),
56
+ "DATASET_PflowTTS": ("spoof", "pflowtts"),
57
+ "DATASET_StyleTTS2": ("spoof", "styletts2"),
58
+ }
59
+
60
+ FEATURES = Features(
61
+ {
62
+ "path": Value("string"),
63
+ "audio": Audio(sampling_rate=16000),
64
+ "label": ClassLabel(names=["bonafide", "spoof"]),
65
+ "notes": Value("string"),
66
+ }
67
+ )
68
+
69
+
70
+ def build_catalogue():
71
+ """Enumerate test-split audio across all generator dirs -> records."""
72
+ records = []
73
+ for src_dir, (label, gen) in GENERATORS.items():
74
+ test_dir = SRC_ROOT / src_dir / "test"
75
+ if not test_dir.is_dir():
76
+ raise FileNotFoundError(test_dir)
77
+ for f in test_dir.iterdir():
78
+ if not f.is_file() or f.suffix.lower() not in (".wav", ".flac"):
79
+ continue
80
+ stem = f.stem
81
+ uid = f"{gen}__{stem}"
82
+ speaker = stem.split("_")[0]
83
+ records.append(
84
+ {
85
+ "uid": uid,
86
+ "abspath": str(f),
87
+ "relpath": f"{src_dir}/test/{f.name}",
88
+ "label": label,
89
+ "generator": gen,
90
+ "speaker": speaker,
91
+ "attack": "bonafide" if label == "bonafide" else gen,
92
+ }
93
+ )
94
+ return records
95
+
96
+
97
+ def build_notes(rec):
98
+ return json.dumps(
99
+ {
100
+ "utterance_id": rec["uid"],
101
+ "generator": rec["generator"],
102
+ "speaker": rec["speaker"],
103
+ "attack": rec["attack"],
104
+ }
105
+ )
106
+
107
+
108
+ def _probe_one(abspath):
109
+ try:
110
+ data, _ = sf.read(abspath)
111
+ if data.shape[0] == 0:
112
+ return f"{abspath}: empty"
113
+ return None
114
+ except Exception as e: # noqa: BLE001
115
+ return f"{abspath}: {str(e).splitlines()[0][:100]}"
116
+
117
+
118
+ def probe_decodability(records):
119
+ paths = [r["abspath"] for r in records]
120
+ failures = []
121
+ with ProcessPoolExecutor(max_workers=WORKERS) as ex:
122
+ for err in ex.map(_probe_one, paths, chunksize=16):
123
+ if err:
124
+ failures.append(err)
125
+ print(f"Probe: {len(failures)}/{len(paths)} clips failed soundfile decode")
126
+ if failures:
127
+ for f in failures[:10]:
128
+ print(f" {f}")
129
+ raise RuntimeError(
130
+ "Source audio no longer cleanly decodable; the CLEAN raw-embed path "
131
+ "is unsafe. Re-introduce a re-encode stage (see ASVspoof2021_LA)."
132
+ )
133
+
134
+
135
+ def _clip_duration(abspath):
136
+ info = sf.info(abspath)
137
+ return info.frames / info.samplerate
138
+
139
+
140
+ def _ensure_long_first_row(records):
141
+ for i in range(len(records)):
142
+ if _clip_duration(records[i]["abspath"]) >= 1.0:
143
+ if i != 0:
144
+ records[0], records[i] = records[i], records[0]
145
+ return
146
+ raise RuntimeError("No clip with duration >= 1.0s found")
147
+
148
+
149
+ def _build_shard(task):
150
+ shard_index, rows, num_shards = task
151
+ shard_name = f"test-{shard_index:05d}-of-{num_shards:05d}.parquet"
152
+ final = PARQUET_DIR / shard_name
153
+ if final.exists() and final.stat().st_size > 0:
154
+ return (shard_index, len(rows), "skipped")
155
+
156
+ def row_gen():
157
+ for rec in rows:
158
+ yield {
159
+ "path": rec["relpath"],
160
+ "audio": {
161
+ "bytes": Path(rec["abspath"]).read_bytes(),
162
+ "path": rec["relpath"],
163
+ },
164
+ "label": rec["label"],
165
+ "notes": build_notes(rec),
166
+ }
167
+
168
+ with tempfile.TemporaryDirectory() as cache:
169
+ ds = Dataset.from_generator(row_gen, features=FEATURES, cache_dir=cache)
170
+ tmp = PARQUET_DIR / f".{shard_name}.tmp"
171
+ ds.to_parquet(str(tmp))
172
+ os.replace(tmp, final)
173
+ return (shard_index, len(rows), "built")
174
+
175
+
176
+ def _partition(records, num_shards):
177
+ n = len(records)
178
+ per = (n + num_shards - 1) // num_shards
179
+ out = []
180
+ for i in range(num_shards):
181
+ chunk = records[i * per : (i + 1) * per]
182
+ if chunk:
183
+ out.append(chunk)
184
+ return out
185
+
186
+
187
+ def build():
188
+ parser = argparse.ArgumentParser()
189
+ parser.add_argument("--limit", type=int, default=None)
190
+ args = parser.parse_args()
191
+ limit = args.limit
192
+ sample_mode = limit is not None
193
+
194
+ print(f"Building catalogue from {SRC_ROOT}")
195
+ records = build_catalogue()
196
+ print(f"Catalogued {len(records)} clips")
197
+ if not sample_mode:
198
+ assert len(records) == EXPECTED_ROWS, f"Expected {EXPECTED_ROWS}, got {len(records)}"
199
+
200
+ records.sort(key=lambda r: r["uid"])
201
+ _ensure_long_first_row(records)
202
+ probe_decodability(records)
203
+
204
+ if sample_mode:
205
+ records = records[:limit]
206
+ num_shards = 1
207
+ print(f"SAMPLE MODE: {len(records)} rows -> 1 shard")
208
+ else:
209
+ num_shards = NUM_SHARDS
210
+
211
+ bona = sum(1 for r in records if r["label"] == "bonafide")
212
+ spoof = sum(1 for r in records if r["label"] == "spoof")
213
+ print(f" bonafide={bona} spoof={spoof} total={len(records)}")
214
+
215
+ PARQUET_DIR.mkdir(parents=True, exist_ok=True)
216
+ keep_suffix = f"-of-{num_shards:05d}.parquet"
217
+ for stale in PARQUET_DIR.glob("test-*.parquet"):
218
+ if not stale.name.endswith(keep_suffix):
219
+ print(f"Removing stale shard {stale.name}")
220
+ stale.unlink()
221
+ shards = _partition(records, num_shards)
222
+ tasks = [(i, rows, num_shards) for i, rows in enumerate(shards)]
223
+ stage_workers = min(WORKERS, len(tasks))
224
+ print(f"Building {len(tasks)} shard(s) with {stage_workers} workers...")
225
+ built = skipped = 0
226
+ with ProcessPoolExecutor(max_workers=stage_workers) as ex:
227
+ for idx, n, status in tqdm(
228
+ ex.map(_build_shard, tasks), total=len(tasks), desc="shards", unit="shard"
229
+ ):
230
+ if status == "built":
231
+ built += 1
232
+ elif status == "skipped":
233
+ skipped += 1
234
+ print(f"Done: {built} built, {skipped} skipped")
235
+
236
+ _verify(num_shards, sample_mode)
237
+ print("All verifications passed!")
238
+
239
+ if not sample_mode:
240
+ from speech_spoof_bench import labels
241
+
242
+ out = labels.emit_labels(REPO_ROOT)
243
+ print(f"Wrote {out}")
244
+
245
+
246
+ def _verify(num_shards, sample_mode):
247
+ shards = sorted(PARQUET_DIR.glob("test-*.parquet"))
248
+ total = sum(pq.read_metadata(str(f)).num_rows for f in shards)
249
+ uid_set, path_set, bona, spoof = set(), set(), 0, 0
250
+ for f in shards:
251
+ t = pq.read_table(str(f), columns=["path", "label", "notes"])
252
+ for p, lab, n in zip(
253
+ t.column("path").to_pylist(),
254
+ t.column("label").to_pylist(),
255
+ t.column("notes").to_pylist(),
256
+ ):
257
+ path_set.add(p)
258
+ uid_set.add(json.loads(n)["utterance_id"])
259
+ if lab == 0:
260
+ bona += 1
261
+ elif lab == 1:
262
+ spoof += 1
263
+ assert len(uid_set) == total, "Duplicate utterance_ids"
264
+ assert len(path_set) == total, "Duplicate paths"
265
+ if not sample_mode:
266
+ assert total == EXPECTED_ROWS, f"{total} != {EXPECTED_ROWS}"
267
+ assert bona == EXPECTED_BONAFIDE, f"bonafide {bona} != {EXPECTED_BONAFIDE}"
268
+ assert spoof == EXPECTED_SPOOF, f"spoof {spoof} != {EXPECTED_SPOOF}"
269
+ t0 = pq.read_table(str(shards[0]))
270
+ assert set(t0.column_names) == {"path", "audio", "label", "notes"}, t0.column_names
271
+ audio0 = t0.column("audio")[0].as_py()
272
+ data, sr = sf.read(io.BytesIO(audio0["bytes"]))
273
+ dur = len(data) / sr
274
+ assert sr == 16000, f"row0 sr {sr} != 16000"
275
+ assert dur >= 1.0, f"row0 dur {dur:.2f}s < 1.0s"
276
+ print(f" verify: {total} rows, row0 {sr}Hz {dur:.2f}s decodable OK")
277
+
278
+
279
+ if __name__ == "__main__":
280
+ build()
data/labels.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9fe0632779a9383b2af82ba38a04c5e361b02c53a115cea9e36bd0d5b059bd71
3
+ size 23172
data/test-00000-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b9111eaa554adb4247d0d792803492d7ca317d6390c02ca4ac1d26b2b039b650
3
+ size 302217931
data/test-00001-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:801892a37dbc6b0af6838676e5ead70dbe77f3c02cad7df10b087211b54a5c67
3
+ size 238579890
eval.yaml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: DFADD
2
+ description: >
3
+ DFADD (The Diffusion and Flow-Matching Based Audio Deepfake Dataset, arXiv
4
+ 2409.08731) — VCTK-derived anti-spoofing set targeting modern diffusion /
5
+ flow-matching TTS. Eval (test) split only. Binary classification: bonafide
6
+ (genuine VCTK) vs. spoof (Grad-TTS / Matcha-TTS / NaturalSpeech 2 / PFlow-TTS
7
+ / StyleTTS 2). EER over the full test set (3,755 utterances: 755 bonafide /
8
+ 3,000 spoof).
9
+ evaluation_framework: inspect-ai
10
+
11
+ tasks:
12
+ - id: antispoofing_eval
13
+ config: default
14
+ split: test
15
+
16
+ field_spec:
17
+ input: audio
18
+ target: label
19
+
20
+ solvers:
21
+ - name: speech_spoof_bench_solver
22
+
23
+ scorers:
24
+ - name: speech_spoof_scorer
25
+
26
+ metrics:
27
+ - eer_percent
submissions/README.md ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Benchmark Submissions
2
+
3
+ To submit a result, you'll upload two files (no git clone required):
4
+
5
+ 1. **`scores.txt`** to **your own HF model repo** under `.eval_results/SpeechAntiSpoofingBenchmarks/ASVspoof2019_LA/scores.txt`.
6
+ 2. **`<your-slug>.yaml`** as a pull request to **this dataset repo** under `submissions/<your-slug>.yaml`.
7
+
8
+ The YAML in this repo carries a pinned URL pointing at your `scores.txt`, plus its sha256. Scores files do not live in this repo.
9
+
10
+ ## Submitter workflow
11
+
12
+ ### 1. Generate `scores.txt` locally
13
+
14
+ ```bash
15
+ speech-spoof-bench run \
16
+ --model-module <your_package>:<YourModelClass> \
17
+ --datasets SpeechAntiSpoofingBenchmarks/ASVspoof2019_LA
18
+ ```
19
+
20
+ Output: `results/ASVspoof2019_LA/scores.txt` (one line per utterance, `<utterance_id> <score>`, higher = more bonafide).
21
+
22
+ ### 2. Upload `scores.txt` to your model repo
23
+
24
+ ```bash
25
+ huggingface-cli upload <your-owner>/<your-model-repo> \
26
+ results/ASVspoof2019_LA/scores.txt \
27
+ .eval_results/SpeechAntiSpoofingBenchmarks/ASVspoof2019_LA/scores.txt \
28
+ --repo-type=model \
29
+ --commit-message="Add ASVspoof2019_LA scores"
30
+ ```
31
+
32
+ **Note the commit sha** the CLI prints — you'll need it in the next step.
33
+
34
+ ### 3. Fill in the submission YAML
35
+
36
+ Copy `results_template.yaml` to `<your-slug>.yaml` and fill in every field. The two most important fields:
37
+
38
+ - `artifact.scores_url`: the **pinned** URL to your uploaded scores file. Use the commit sha from step 2, not `main`:
39
+ ```
40
+ https://huggingface.co/<your-owner>/<your-model-repo>/resolve/<commit-sha-from-step-2>/.eval_results/SpeechAntiSpoofingBenchmarks/ASVspoof2019_LA/scores.txt
41
+ ```
42
+ URLs with `/resolve/main/` are rejected because they're mutable.
43
+ - `artifact.scores_sha256`: `sha256sum results/ASVspoof2019_LA/scores.txt | awk '{print $1}'`.
44
+
45
+ Leave the `reproduction:` block empty — the maintainer fills it in at merge time.
46
+
47
+ ### 4. Open the PR via HF CLI
48
+
49
+ ```bash
50
+ huggingface-cli upload \
51
+ SpeechAntiSpoofingBenchmarks/ASVspoof2019_LA \
52
+ <your-slug>.yaml submissions/<your-slug>.yaml \
53
+ --repo-type=dataset \
54
+ --create-pr \
55
+ --commit-message="Add <your-slug> submission"
56
+ ```
57
+
58
+ The CLI prints a PR URL. That's it.
59
+
60
+ ### 5. Wait for maintainer reproduction
61
+
62
+ A maintainer runs `speech-spoof-bench reproduce --scoring <PR-branch>`, which:
63
+ - Fetches `scores_url`.
64
+ - Verifies the sha256 against `artifact.scores_sha256`.
65
+ - Recomputes EER from the file.
66
+ - Compares to your claimed `scores.eer_percent` (must match within 1e-6).
67
+
68
+ If it passes, the maintainer fills in `reproduction:` and merges. If it fails, you get a comment on the PR explaining why.
69
+
70
+ ## Verification levels
71
+
72
+ | Level | What the maintainer checks | Cost |
73
+ |---|---|---|
74
+ | `scoring` (default) | sha + recomputed EER from your `scores.txt`. | Seconds. |
75
+ | `inference` (optional, follow-up) | Re-runs your checkpoint end-to-end and regenerates `scores.txt`. Must match within 0.05% EER. | Expensive. |
76
+
77
+ Submissions without a `reproduction:` block never appear in the arena.
78
+
79
+ ## What about git clone + push?
80
+
81
+ You can do it that way too, but for a single 2 KB YAML it's massively heavier. The HF CLI path is the documented one.
submissions/results_template.yaml ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version: 4
2
+
3
+ system:
4
+ name: ""
5
+ slug: ""
6
+ description: ""
7
+ code: ""
8
+ checkpoint: ""
9
+ paper:
10
+ arxiv_id: ""
11
+ url: ""
12
+ bibtex: |
13
+ @article{...}
14
+
15
+ dataset:
16
+ id: SpeechAntiSpoofingBenchmarks/ASVspoof2019_LA
17
+ revision: ""
18
+ split: test
19
+
20
+ scores:
21
+ eer_percent: 0.0
22
+ n_trials: 71237
23
+ n_skipped: 0
24
+
25
+ artifact:
26
+ # Must be pinned by commit sha. Pattern:
27
+ # https://huggingface.co/<owner>/<repo>/resolve/<commit-sha>/.eval_results/SpeechAntiSpoofingBenchmarks/ASVspoof2019_LA/scores.txt
28
+ scores_url: ""
29
+ scores_sha256: ""
30
+ bench_version: ""
31
+
32
+ # Leave this block empty — the maintainer fills it in at merge.
33
+ reproduction:
34
+ reproduced_by: ""
35
+ reproduced_at: ""
36
+ reproduced_bench_version: ""
37
+ match: ""
38
+
39
+ submitter:
40
+ hf_username: ""
41
+ contact: ""
42
+
43
+ submitted_at: ""
44
+ notes: ""