File size: 7,341 Bytes
edb8e82 6a432c8 67cf9cf edb8e82 6a432c8 | 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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | ---
license: afl-3.0
language:
- en
- fr
tags:
- speech
- audio
- benchmark
- evaluation
- spoken-language-model
- lexical-decision
- sWuggy
- zerospeech
pretty_name: sWuggy
configs:
- config_name: inftrain
data_dir: "inftrain"
data_files:
- split: en_testset_1
path: "en/audio/testset_1-*.tar"
- split: en_testset_2
path: "en/audio/testset_2-*.tar"
- split: en_testset_4
path: "en/audio/testset_4-*.tar"
- split: en_testset_8
path: "en/audio/testset_8-*.tar"
- split: en_testset_16
path: "en/audio/testset_16-*.tar"
- split: en_testset_32
path: "en/audio/testset_32-*.tar"
- split: en_testset_64
path: "en/audio/testset_64-*.tar"
- split: fr_testset_1
path: "fr/audio/testset_1-*.tar"
- split: fr_testset_2
path: "fr/audio/testset_2-*.tar"
- split: fr_testset_4
path: "fr/audio/testset_4-*.tar"
- split: fr_testset_8
path: "fr/audio/testset_8-*.tar"
- split: fr_testset_16
path: "fr/audio/testset_16-*.tar"
- split: fr_testset_32
path: "fr/audio/testset_32-*.tar"
- split: fr_testset_64
path: "fr/audio/testset_64-*.tar"
- config_name: zrc2021
data_dir: "zrc2021"
data_files:
- split: en_dev
path: "en/dev-*.tar"
- split: en_test
path: "en/test-*.tar"
---
# sWuggy
sWuggy is a spoken lexical-discrimination benchmark: each item is a pair consisting of a
real word and a phonotactically matched pseudo-word, synthesized as audio. A model is
scored on whether it assigns higher probability to the real word than to its matched
pseudo-word. This repository hosts the audio (as WebDataset tar shards) together with
the per-item metadata needed to run the evaluation.
> **Evaluation only.** This is a held-out benchmark for *evaluating* spoken language
> models. It must **not** be used as training data. Training on these items
> invalidates any sWuggy score and contaminates the benchmark for everyone.
> **Status:** A companion repository with the evaluation code for this benchmark is a
> work in progress and will be linked here once released. For now this repository
> provides the data and the file layout described below.
## Repository layout
Audio is packed into [WebDataset](https://huggingface.co/docs/hub/datasets-webdataset)
tar shards (many small audio files would otherwise hit the Hub's 10,000-files-per-
directory limit and make download/streaming slow). Metadata stays as plain CSV/TXT
files alongside the shards.
```
inftrain/
en/
audio/ testset_{1,2,4,8,16,32,64}-{000000..NNNNNN}.tar # audio shards
frequencies/ testset_{1,2,4,8,16,32,64}.csv # per-item metadata
gold.csv # gold labels
fr/
audio/ testset_{1,2,4,8,16,32,64}-{000000..NNNNNN}.tar
frequencies/ testset_{1,2,4,8,16,32,64}.csv
gold.csv
zrc2021/
en/
dev-{000000..NNNNNN}.tar # audio shards
test-{000000..NNNNNN}.tar
dev_filesmap.txt
dev.gold.csv
test_filesmap.txt
test.gold.csv
```
There are two top-level collections:
- **`inftrain/`** — the main sWuggy evaluation material, split by language (`en`, `fr`)
and by test set (`testset_1` … `testset_64`). Despite the directory name, this is
evaluation data and is not for training. <!-- TODO: state what the testset_N
numbering means, e.g. number of synthesized voices per item / subset size. -->
- **`zrc2021/`** — the ZeroSpeech 2021 sWuggy split (`dev` / `test`), under `en/`.
### Inside a shard
Each tar shard is a plain POSIX tar. Every audio file is stored under its basename,
so the WebDataset *key* is the filename stem. Files that share a key are grouped into
the same example; here each example is a single audio file, and its label/metadata
lives in the accompanying CSV keyed by the same filename. Audio is
`.ogg` for `inftrain/` and `.wav` for `zrc2021/`.
<!-- TODO: confirm audio format details: sample rate, channels, encoding. -->
### Metadata files
- `gold.csv` / `*.gold.csv` — gold labels per item. <!-- TODO: document columns,
e.g. filename, word, is_real_word (or word vs non-word), pair id. -->
- `frequencies/testset_N.csv` — per-item lexical frequency information.
<!-- TODO: document columns. -->
- `*_filesmap.txt` (zrc2021) — mapping between item identifiers and audio files.
<!-- TODO: document format. -->
## Accessing the data
### Stream the audio with `datasets`
The audio is in WebDataset format, so it is loaded with the `webdataset` builder.
Map a glob of shards to a split with `data_files`, and stream with `streaming=True`
to avoid downloading everything up front:
```python
from datasets import load_dataset
# One test set of the English inftrain material:
ds = load_dataset(
"webdataset",
data_files={"test": "hf://datasets/coml/sWuggy/inftrain/en/audio/testset_1-*.tar"},
split="test",
streaming=True,
)
for sample in ds:
# The audio column is named after the file suffix inside the tar
# ("ogg" for inftrain, "wav" for zrc2021); the key is in sample["__key__"].
key = sample["__key__"]
audio = sample["ogg"] # bytes; decode with soundfile/librosa as needed
break
```
Load several test sets at once by mapping each to its own split:
```python
data_files = {
f"testset_{n}": f"hf://datasets/coml/sWuggy/inftrain/en/audio/testset_{n}-*.tar"
for n in (1, 2, 4, 8, 16, 32, 64)
}
ds = load_dataset("webdataset", data_files=data_files, streaming=True)
```
The ZeroSpeech 2021 split works the same way with the `wav` suffix:
```python
ds = load_dataset(
"webdataset",
data_files={
"dev": "hf://datasets/coml/sWuggy/zrc2021/en/dev-*.tar",
"test": "hf://datasets/coml/sWuggy/zrc2021/en/test-*.tar",
},
streaming=True,
)
```
### Read the metadata
The CSV/TXT metadata can be read directly over `hf://` without downloading the audio:
```python
import polars as pl
gold = pl.read_csv("hf://datasets/coml/sWuggy/inftrain/en/gold.csv")
freqs = pl.read_csv("hf://datasets/coml/sWuggy/inftrain/en/frequencies/testset_1.csv")
```
Join metadata to audio on the WebDataset key (the filename stem) where you need both.
### Download specific files
To pull individual shards or metadata files to local disk:
```python
from huggingface_hub import hf_hub_download
path = hf_hub_download(
repo_id="coml/sWuggy",
repo_type="dataset",
filename="inftrain/en/gold.csv",
)
```
Or snapshot a subset with `huggingface_hub.snapshot_download(..., allow_patterns=...)`.
## Evaluation
The evaluation expects, for each word / pseudo-word pair, a model score (typically a
log-probability or pseudo log-likelihood) for both audio items; accuracy is the
fraction of pairs where the real word is scored above its matched pseudo-word.
Evaluation code that runs this end-to-end is being prepared in a separate repository
and will be linked here. <!-- TODO: link the eval repo when public. -->
## License
Released under the Academic Free License v3.0 (`afl-3.0`).
## Citation
<!-- TODO: add the citation(s) for sWuggy and ZeroSpeech 2021. -->
## Contact
<!-- TODO: maintainer / contact, or point to the Community tab. -->
Questions and issues: please open a discussion in the **Community** tab of this
repository. |