korallll commited on
Commit
4d68066
·
verified ·
1 Parent(s): 4e6e2e4

Add files using upload-large-folder tool

Browse files
Files changed (50) hide show
  1. .gitattributes +1 -59
  2. .gitignore +4 -0
  3. LICENSE.txt +24 -0
  4. README.md +98 -0
  5. build_parquet.py +280 -0
  6. data/labels.parquet +3 -0
  7. data/test-00000-of-00100.parquet +3 -0
  8. data/test-00001-of-00100.parquet +3 -0
  9. data/test-00002-of-00100.parquet +3 -0
  10. data/test-00003-of-00100.parquet +3 -0
  11. data/test-00010-of-00100.parquet +3 -0
  12. data/test-00011-of-00100.parquet +3 -0
  13. data/test-00012-of-00100.parquet +3 -0
  14. data/test-00015-of-00100.parquet +3 -0
  15. data/test-00017-of-00100.parquet +3 -0
  16. data/test-00018-of-00100.parquet +3 -0
  17. data/test-00023-of-00100.parquet +3 -0
  18. data/test-00025-of-00100.parquet +3 -0
  19. data/test-00041-of-00100.parquet +3 -0
  20. data/test-00043-of-00100.parquet +3 -0
  21. data/test-00044-of-00100.parquet +3 -0
  22. data/test-00047-of-00100.parquet +3 -0
  23. data/test-00053-of-00100.parquet +3 -0
  24. data/test-00059-of-00100.parquet +3 -0
  25. data/test-00061-of-00100.parquet +3 -0
  26. data/test-00064-of-00100.parquet +3 -0
  27. data/test-00066-of-00100.parquet +3 -0
  28. data/test-00074-of-00100.parquet +3 -0
  29. data/test-00077-of-00100.parquet +3 -0
  30. data/test-00078-of-00100.parquet +3 -0
  31. data/test-00079-of-00100.parquet +3 -0
  32. data/test-00081-of-00100.parquet +3 -0
  33. data/test-00082-of-00100.parquet +3 -0
  34. data/test-00083-of-00100.parquet +3 -0
  35. data/test-00084-of-00100.parquet +3 -0
  36. data/test-00085-of-00100.parquet +3 -0
  37. data/test-00086-of-00100.parquet +3 -0
  38. data/test-00087-of-00100.parquet +3 -0
  39. data/test-00088-of-00100.parquet +3 -0
  40. data/test-00089-of-00100.parquet +3 -0
  41. data/test-00090-of-00100.parquet +3 -0
  42. data/test-00091-of-00100.parquet +3 -0
  43. data/test-00092-of-00100.parquet +3 -0
  44. data/test-00094-of-00100.parquet +3 -0
  45. data/test-00097-of-00100.parquet +3 -0
  46. data/test-00098-of-00100.parquet +3 -0
  47. data/test-00099-of-00100.parquet +3 -0
  48. eval.yaml +26 -0
  49. submissions/README.md +81 -0
  50. submissions/results_template.yaml +44 -0
.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,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
2
+ (CC BY-NC-SA 4.0)
3
+
4
+ The PyAra dataset (https://www.kaggle.com/datasets/alep079/pyara) is distributed
5
+ under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
6
+ license. This repository hosts the PyAra audio repackaged in the canonical Arena
7
+ parquet format, under the same CC BY-NC-SA 4.0 license.
8
+
9
+ You are free to:
10
+ Share — copy and redistribute the material in any medium or format
11
+ Adapt — remix, transform, and build upon the material
12
+
13
+ Under the following terms:
14
+ Attribution — You must give appropriate credit, provide a link to the
15
+ license, and indicate if changes were made.
16
+ NonCommercial — You may not use the material for commercial purposes.
17
+ ShareAlike — If you remix, transform, or build upon the material, you must
18
+ distribute your contributions under the same license as the
19
+ original.
20
+
21
+ No additional restrictions — You may not apply legal terms or technological
22
+ measures that legally restrict others from doing anything the license permits.
23
+
24
+ Full legal text: https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode
README.md ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-nc-sa-4.0
3
+ language: [ru]
4
+ pretty_name: "PyAra — Russian Audio Deepfake Detection"
5
+ task_categories: [audio-classification]
6
+ size_categories: [100K<n<1M]
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
+ - russian
18
+ arxiv: []
19
+ ---
20
+
21
+ # PyAra — Russian Audio Deepfake Detection
22
+
23
+ Benchmark-ready packaging of **PyAra**, a Russian-language audio anti-spoofing
24
+ dataset (source: https://www.kaggle.com/datasets/alep079/pyara).
25
+
26
+ ## Overview
27
+
28
+ Binary classification: **bonafide** (genuine Russian human recordings) vs.
29
+ **spoof** (synthetic / converted speech). The spoof side is produced by **five**
30
+ generation algorithms (`alg_1` … `alg_5`). Label is the top-level source
31
+ directory (`Real/` → bonafide, `Fake/` → spoof), per the `fake` column of
32
+ `final_dataset.tsv`.
33
+
34
+ ## License & redistribution
35
+
36
+ Released under the **Creative Commons Attribution-NonCommercial-ShareAlike 4.0
37
+ International (CC BY-NC-SA 4.0)** license. Redistribution and adaptation are
38
+ permitted for **non-commercial** use with attribution and ShareAlike; this
39
+ packaging is itself CC BY-NC-SA 4.0. See `LICENSE.txt`. Audio is the original
40
+ 16 kHz mono WAV, embedded bit-exactly (no re-encode — a full decode probe of all
41
+ clips passed cleanly).
42
+
43
+ ## Schema
44
+
45
+ | Column | Type | Description |
46
+ |--------|------|-------------|
47
+ | `path` | `string` | source-relative path, e.g. `Fake/alg_1_0.wav`, unique |
48
+ | `audio` | `Audio(16000)` | 16 kHz mono WAV |
49
+ | `label` | `ClassLabel` | `"bonafide"` (0) / `"spoof"` (1) |
50
+ | `notes` | `string` | JSON: `utterance_id`, `algorithm`, `gender`, `age`, `length` |
51
+
52
+ `notes` example:
53
+ ```json
54
+ {"utterance_id": "alg_1_0", "algorithm": "alg_1", "gender": "male", "age": "twenties", "length": "5.55"}
55
+ ```
56
+
57
+ `utterance_id` is the source filename stem (`real_12713`, `alg_1_0`) — unique
58
+ across the whole set.
59
+
60
+ ## Quick Start
61
+
62
+ ```python
63
+ from datasets import load_dataset
64
+
65
+ ds = load_dataset("SpeechAntiSpoofingBenchmarks/PyAra", split="test")
66
+ print(ds[0])
67
+ ```
68
+
69
+ ## Stats
70
+
71
+ | Stat | Value |
72
+ |------|-------|
73
+ | Total trials | 201,778 |
74
+ | Bonafide (real) | 73,583 |
75
+ | Spoof | 128,195 |
76
+ | Spoof algorithms | alg_1 (46,505), alg_2 (10,065), alg_3 (11,165), alg_4 (25,412), alg_5 (35,048) |
77
+ | Language | Russian |
78
+ | Sample rate | 16 kHz mono |
79
+
80
+ ## Source provenance
81
+
82
+ - Dataset: PyAra, https://www.kaggle.com/datasets/alep079/pyara
83
+ - No associated academic paper.
84
+
85
+ ## Evaluation
86
+
87
+ For evaluation instructions and submission format, see [`submissions/README.md`](submissions/README.md).
88
+
89
+ ## Citation
90
+
91
+ ```
92
+ PyAra — Russian Audio Deepfake Detection dataset.
93
+ https://www.kaggle.com/datasets/alep079/pyara
94
+ ```
95
+
96
+ ## Maintainer
97
+
98
+ Contact: k.n.borodin@mtuci.ru
build_parquet.py ADDED
@@ -0,0 +1,280 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Parquet build for the PyAra (Russian audio deepfake) HF dataset repo.
2
+
3
+ PyAra (https://www.kaggle.com/datasets/alep079/pyara) — a Russian-language
4
+ anti-spoofing set. Source layout:
5
+ Real/<stem>.wav (fake=0) -> bonafide (73,583)
6
+ Fake/<stem>.wav (fake=1) -> spoof (128,195, 5 TTS/VC algorithms alg_1..alg_5)
7
+ final_dataset.tsv : path, sentence, age, gender, fake, algorithm, length
8
+
9
+ A full decode probe of all clips runs first; 0 failures -> CLEAN raw-byte embed
10
+ (no decode/re-encode). All source audio is already 16 kHz mono PCM_16 WAV, every
11
+ clip >= 3.0 s. Records are processed sorted by utterance_id for stable sharding
12
+ and near-sequential HDD reads.
13
+
14
+ Sample mode (--limit N): first N rows into a single shard, skipping full-count
15
+ asserts -- used for the fast offline validate-dataset pass.
16
+ """
17
+
18
+ import argparse
19
+ import csv
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/final_dataset")
42
+ META_PATH = SRC_ROOT / "final_dataset.tsv"
43
+ PARQUET_DIR = REPO_ROOT / "data"
44
+ NUM_SHARDS = 100
45
+ EXPECTED_ROWS = 201778
46
+ EXPECTED_BONAFIDE = 73583
47
+ EXPECTED_SPOOF = 128195
48
+ TARGET_SR = 16000
49
+ WORKERS = int(os.environ.get("PYARA_BUILD_WORKERS", "64"))
50
+
51
+ FEATURES = Features(
52
+ {
53
+ "path": Value("string"),
54
+ "audio": Audio(sampling_rate=16000),
55
+ "label": ClassLabel(names=["bonafide", "spoof"]),
56
+ "notes": Value("string"),
57
+ }
58
+ )
59
+
60
+
61
+ def parse_metadata():
62
+ """Parse final_dataset.tsv -> records. Columns:
63
+ path, sentence, age, gender, fake, algorithm, length."""
64
+ records = []
65
+ seen = set()
66
+ with open(META_PATH, encoding="utf-8") as fh:
67
+ reader = csv.DictReader(fh, delimiter="\t")
68
+ for row in reader:
69
+ rel = row["path"].strip()
70
+ if not rel:
71
+ continue
72
+ stem = Path(rel).stem
73
+ if stem in seen:
74
+ raise ValueError(f"Duplicate utterance_id stem: {stem}")
75
+ seen.add(stem)
76
+ is_spoof = row["fake"].strip() == "1"
77
+ records.append(
78
+ {
79
+ "uid": stem,
80
+ "relpath": rel,
81
+ "abspath": str(SRC_ROOT / rel),
82
+ "label": "spoof" if is_spoof else "bonafide",
83
+ "algorithm": (row.get("algorithm") or "").strip() or ("bonafide" if not is_spoof else ""),
84
+ "gender": (row.get("gender") or "").strip(),
85
+ "age": (row.get("age") or "").strip(),
86
+ "length": (row.get("length") or "").strip(),
87
+ }
88
+ )
89
+ return records
90
+
91
+
92
+ def build_notes(rec):
93
+ return json.dumps(
94
+ {
95
+ "utterance_id": rec["uid"],
96
+ "algorithm": rec["algorithm"],
97
+ "gender": rec["gender"],
98
+ "age": rec["age"],
99
+ "length": rec["length"],
100
+ }
101
+ )
102
+
103
+
104
+ def _probe_one(abspath):
105
+ try:
106
+ data, _ = sf.read(abspath)
107
+ if data.shape[0] == 0:
108
+ return f"{abspath}: empty"
109
+ return None
110
+ except Exception as e: # noqa: BLE001
111
+ return f"{abspath}: {str(e).splitlines()[0][:100]}"
112
+
113
+
114
+ def probe_decodability(records):
115
+ paths = [r["abspath"] for r in records]
116
+ failures = []
117
+ with ProcessPoolExecutor(max_workers=WORKERS) as ex:
118
+ for err in ex.map(_probe_one, paths, chunksize=32):
119
+ if err:
120
+ failures.append(err)
121
+ print(f"Probe: {len(failures)}/{len(paths)} clips failed soundfile decode")
122
+ if failures:
123
+ for f in failures[:10]:
124
+ print(f" {f}")
125
+ raise RuntimeError(
126
+ "Source audio no longer cleanly decodable; the CLEAN raw-embed path "
127
+ "is unsafe. Re-introduce a re-encode stage (see ASVspoof2021_LA)."
128
+ )
129
+
130
+
131
+ def _clip_duration(abspath):
132
+ info = sf.info(abspath)
133
+ return info.frames / info.samplerate
134
+
135
+
136
+ def _ensure_long_first_row(records):
137
+ for i in range(len(records)):
138
+ if _clip_duration(records[i]["abspath"]) >= 1.0:
139
+ if i != 0:
140
+ records[0], records[i] = records[i], records[0]
141
+ return
142
+ raise RuntimeError("No clip with duration >= 1.0s found")
143
+
144
+
145
+ def _build_shard(task):
146
+ shard_index, rows, num_shards = task
147
+ shard_name = f"test-{shard_index:05d}-of-{num_shards:05d}.parquet"
148
+ final = PARQUET_DIR / shard_name
149
+ if final.exists() and final.stat().st_size > 0:
150
+ return (shard_index, len(rows), "skipped")
151
+
152
+ def row_gen():
153
+ for rec in rows:
154
+ yield {
155
+ "path": rec["relpath"],
156
+ "audio": {
157
+ "bytes": Path(rec["abspath"]).read_bytes(),
158
+ "path": rec["relpath"],
159
+ },
160
+ "label": rec["label"],
161
+ "notes": build_notes(rec),
162
+ }
163
+
164
+ with tempfile.TemporaryDirectory() as cache:
165
+ ds = Dataset.from_generator(row_gen, features=FEATURES, cache_dir=cache)
166
+ tmp = PARQUET_DIR / f".{shard_name}.tmp"
167
+ ds.to_parquet(str(tmp))
168
+ os.replace(tmp, final)
169
+ return (shard_index, len(rows), "built")
170
+
171
+
172
+ def _partition(records, num_shards):
173
+ n = len(records)
174
+ per = (n + num_shards - 1) // num_shards
175
+ out = []
176
+ for i in range(num_shards):
177
+ chunk = records[i * per : (i + 1) * per]
178
+ if chunk:
179
+ out.append(chunk)
180
+ return out
181
+
182
+
183
+ def build():
184
+ parser = argparse.ArgumentParser()
185
+ parser.add_argument("--limit", type=int, default=None)
186
+ args = parser.parse_args()
187
+ limit = args.limit
188
+ sample_mode = limit is not None
189
+
190
+ print(f"Reading metadata from {META_PATH}")
191
+ records = parse_metadata()
192
+ print(f"Parsed {len(records)} rows")
193
+ if not sample_mode:
194
+ assert len(records) == EXPECTED_ROWS, f"Expected {EXPECTED_ROWS}, got {len(records)}"
195
+
196
+ check = records if not sample_mode else records[: max(limit * 4, limit)]
197
+ missing = [r["uid"] for r in check if not Path(r["abspath"]).exists()]
198
+ assert not missing, f"{len(missing)} wav files missing, e.g. {missing[:5]}"
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:63a101960b7be7fd40cd43ada7ba2dd4a1b1083fa3eb03eef346ba3cca2ece37
3
+ size 1087602
data/test-00000-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:05987ef17c703de4b626b3a72368e4f636673190b902b00eb2fbba031ff7167f
3
+ size 274235377
data/test-00001-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:65bb1325410f6146b7f81c84d8e3214395b139cb0849e43f4fb2fbccf5133ff0
3
+ size 276456907
data/test-00002-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9534698be8e0aba42a02cc645d29c18f55f5428cdd3bf325f63f823ef28dbf75
3
+ size 267699113
data/test-00003-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5ae722416d859711701a6b8f62f7de92e97e4c8fa9b80f5b92a6b98db66e5f29
3
+ size 287805554
data/test-00010-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a269838036c347604b3e1b43d22f2c83bbe5c20a6fe9f1fb48fce8c60226c6ec
3
+ size 272237085
data/test-00011-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9e1e1d715625b20d2484952d9793eddeb295868852cd37ef586877c0bc6953d9
3
+ size 283019118
data/test-00012-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e87f126666d9faf97be6e65b5fda5f28624fee32704cfc1792fc716225b2497a
3
+ size 281289836
data/test-00015-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7ce4adc56d74f640f8d625ff268a6de947f16fb614d71394cab11ced50b5df3f
3
+ size 282354425
data/test-00017-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bb6bc4836814f8b3628f8be31a3805cbb51910cfbc5724654485bc48c8c98a18
3
+ size 297986997
data/test-00018-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e2a5c40b4af2f7b8dbc14a8912ce1f3bf9533c7a03ced305bacde8ebabb736d4
3
+ size 282391035
data/test-00023-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:243327682425169a81559c5a5371172ed5deb461db078d8af8c4cccd65c982a8
3
+ size 355450532
data/test-00025-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a8aafb1d2bd8fbfa08c1f3ac5dafaaffb730c2de0c3286c2824bd1bc6892a31c
3
+ size 359085896
data/test-00041-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a85c65a472ed912a931b0bbc4e09d68fd0406655880e8fc7093e9002bfdbfc97
3
+ size 311459516
data/test-00043-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:df958bb2250b2ac54b41b3ef1b7e1be94a8941c83f676790445c0f897465249d
3
+ size 304871087
data/test-00044-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5ec429676e9cf320fb6c97831eb060932800b1d3adad90c2b818566a349a9da3
3
+ size 302508395
data/test-00047-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f0955d0b4c75de4d228e0abc0161911f8183b395538669b64b9e69a082a5767a
3
+ size 424072121
data/test-00053-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0df454256d9862cfffdaa47b2bfaecb95f63ff11cb98efaa9d0ec01fb2817ee4
3
+ size 392314442
data/test-00059-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c2777c522c914aa715ccc0adceeb256f039c6a8a86d5157713f33cd7dc23dcf6
3
+ size 442294807
data/test-00061-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:881803ffadab167085b7fdc7c181c63a1e49c58321cb2961077b4fc4d25665cd
3
+ size 418779904
data/test-00064-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:afe8192eb2fb498b9ccb853b7afb56c58c6caec8df7f0a676ad11ea83580146e
3
+ size 334096434
data/test-00066-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3a692641fe700df7cde036eeac2455a40883dcb9d490b5b3970920bc38fcbd13
3
+ size 324981596
data/test-00074-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8e99accdec486126ce38ef898cc40bc555a060cdc2a22947a43f940a3b155d9c
3
+ size 352899820
data/test-00077-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ba555aa148200831b47f9cadb1342c48b6d2c889a8c9c7abde244c66887bdc5c
3
+ size 337695628
data/test-00078-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9ba885c435bf4d006b35ff575970d8228817ba01a5a39aa049aea3efa26cc44c
3
+ size 340476520
data/test-00079-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:01bb4f06776d7a8324c2ecac810dea530666d5f54310921e4535787195c8c351
3
+ size 311792995
data/test-00081-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ed6e6f012cb3daee7c49c78a19f33f87972c8ac81feea55ba65942822c737651
3
+ size 319557084
data/test-00082-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cff85cbb34e71f0dd980b438aa01772d956c8a3a1426b81e763be3fe482eb375
3
+ size 306004836
data/test-00083-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:26c181dfb89a150db859984383d217f1c74f0ce7a2b0463cb782a6fa650ef6af
3
+ size 310064567
data/test-00084-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:982ed7b9234d31d73e4e0f80bb9a71793a35f01fca2f8e4956d7983fae970dfc
3
+ size 318109950
data/test-00085-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1efe201e2d70d4aa914bcaed9ff61a1b256b5bc0ecf538793a816b0b06d022f5
3
+ size 327934063
data/test-00086-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:33d422f30372a40199890a3c0f1ce52a55383ba8f367e92ffabfa6cb637ba2b1
3
+ size 338780405
data/test-00087-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5894dc5fddec28d1ed2bddcb716389f58ad48b1e6e73a80fc11ec2048b38bcdf
3
+ size 324893391
data/test-00088-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:be4402c48c61da016365299be1efb9e3a535f72abf0307f73554617823664fc3
3
+ size 317593423
data/test-00089-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c9bb54696e4fe8d25c2edfe1e7bc8d93eef9741d6d3b27f113526de6397da699
3
+ size 292722703
data/test-00090-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:248dab9f49a76b9e70970bf411c42ff34328fe0f0e6a860f98f50d14c696915a
3
+ size 311949764
data/test-00091-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7b048a00e90387dbc613bab39e07a9ab17ed5d4e30d45f80184f7f9f225573ce
3
+ size 303776851
data/test-00092-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c1314dc0f4555d34e082b94191f17b57d0a408af007700397f9c8871ea0ae6ba
3
+ size 347237669
data/test-00094-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ac572132a686dd2110155270c75c2f6e5a44366394ecaa4c8c537ce01099b97a
3
+ size 298868212
data/test-00097-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:12d86c3d2833ced78b5297519424cc8637108c9f6143b24677f75c1995727748
3
+ size 312665031
data/test-00098-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a8ad20b21b0e5c017c98cb291b4557152c24afca906c4edd990c898aa378184a
3
+ size 337196251
data/test-00099-of-00100.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:24fa1d6147fb544b4d216dd4dad3402ed3449f86b89f754d9f4ec112eca99589
3
+ size 353230190
eval.yaml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: PyAra
2
+ description: >
3
+ PyAra — Russian-language audio anti-spoofing dataset
4
+ (https://www.kaggle.com/datasets/alep079/pyara). Binary classification:
5
+ bonafide (genuine Russian recordings) vs. spoof (synthetic/converted speech
6
+ from 5 algorithms alg_1..alg_5). EER over the full set (201,778 utterances:
7
+ 73,583 bonafide / 128,195 spoof).
8
+ evaluation_framework: inspect-ai
9
+
10
+ tasks:
11
+ - id: antispoofing_eval
12
+ config: default
13
+ split: test
14
+
15
+ field_spec:
16
+ input: audio
17
+ target: label
18
+
19
+ solvers:
20
+ - name: speech_spoof_bench_solver
21
+
22
+ scorers:
23
+ - name: speech_spoof_scorer
24
+
25
+ metrics:
26
+ - 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: ""