Datasets:
File size: 6,353 Bytes
e3f50a7 9c66c5d 37e28be 9c66c5d e3f50a7 9c66c5d e3f50a7 9c66c5d e3f50a7 | 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 | ---
license: cc-by-4.0
task_categories:
- automatic-speech-recognition
- audio-classification
- text-retrieval
language:
- en
tags:
- librispeech
- asr
- audio
- speech
- lance
- sentence-transformers
pretty_name: librispeech-clean-lance
size_categories:
- 10K<n<100K
---
# LibriSpeech `clean` (Lance Format)
Lance-formatted version of the LibriSpeech ASR `clean` configuration (sourced from [`openslr/librispeech_asr`](https://huggingface.co/datasets/openslr/librispeech_asr)). Audio is stored inline as FLAC bytes (no re-encoding); transcripts are sentence-embedded so semantic transcript search works out of the box.
## Splits
| Split | Lance file | Rows | Description |
|-------|------------|------|-------------|
| `dev_clean.lance` | dev.clean | 2,703 | Standard ASR validation set |
| `test_clean.lance` | test.clean | 2,620 | Standard ASR test set |
| `train_clean_100.lance` | train.clean.100 | 28,539 | 100-hour clean training subset |
> The 360-hour and 500-hour LibriSpeech subsets (`train.360`, `train.other.500`) are **not** bundled here. To extend the dataset, point `librispeech/dataprep.py` at additional splits.
## Schema
| Column | Type | Notes |
|---|---|---|
| `id` | `string` | Utterance id (e.g. `1272-128104-0000`) |
| `audio` | `large_binary` | Inline FLAC bytes (16 kHz mono) |
| `sampling_rate` | `int32` | Always 16,000 |
| `text` | `string` | Reference transcript |
| `speaker_id` | `int64` | LibriVox speaker id |
| `chapter_id` | `int64` | LibriVox chapter id |
| `num_chars` | `int32` | Length of `text` in characters |
| `text_emb` | `fixed_size_list<float32, 384>` | sentence-transformers `all-MiniLM-L6-v2` (cosine-normalized) |
## Pre-built indices
- `IVF_PQ` on `text_emb` — `metric=cosine`
- `INVERTED` (FTS) on `text`
- `BTREE` on `id`, `speaker_id`, `chapter_id`
## Quick start
```python
import lance
ds = lance.dataset("hf://datasets/lance-format/librispeech-clean-lance/data/test_clean.lance")
print(ds.count_rows(), ds.schema.names, ds.list_indices())
```
## Load with LanceDB
These tables can also be consumed by [LanceDB](https://lancedb.github.io/lancedb/), the multimodal lakehouse and embedded search library built on top of Lance, for simplified vector search and other queries. Each `.lance` file in `data/` is a table — open by name (e.g., `test_clean`, `train_clean_100`).
```python
import lancedb
db = lancedb.connect("hf://datasets/lance-format/librispeech-clean-lance/data")
tbl = db.open_table("test_clean")
print(f"LanceDB table opened with {len(tbl)} utterances")
```
## Read one utterance and play it
```python
from pathlib import Path
import lance
ds = lance.dataset("hf://datasets/lance-format/librispeech-clean-lance/data/test_clean.lance")
row = ds.take([0], columns=["id", "audio", "text", "speaker_id"]).to_pylist()[0]
Path(f"{row['id']}.flac").write_bytes(row["audio"])
print("speaker:", row["speaker_id"])
print("transcript:", row["text"])
```
You can decode the FLAC bytes in-memory with `soundfile` and feed them straight into a model:
```python
import io
import soundfile as sf
samples, sr = sf.read(io.BytesIO(row["audio"]))
print(samples.shape, sr)
```
## Semantic transcript retrieval
```python
import lance
import pyarrow as pa
from sentence_transformers import SentenceTransformer
encoder = SentenceTransformer("sentence-transformers/all-MiniLM-L6-v2", device="cuda")
q = encoder.encode(["a person talking about astronomy"], normalize_embeddings=True)[0]
ds = lance.dataset("hf://datasets/lance-format/librispeech-clean-lance/data/train_clean_100.lance")
emb_field = ds.schema.field("text_emb")
hits = ds.scanner(
nearest={"column": "text_emb", "q": pa.array([q.tolist()], type=emb_field.type)[0], "k": 5},
columns=["id", "speaker_id", "text"],
).to_table().to_pylist()
for h in hits:
print(h)
```
### LanceDB semantic transcript retrieval
```python
import lancedb
from sentence_transformers import SentenceTransformer
encoder = SentenceTransformer("sentence-transformers/all-MiniLM-L6-v2", device="cuda")
q = encoder.encode(["a person talking about astronomy"], normalize_embeddings=True)[0]
db = lancedb.connect("hf://datasets/lance-format/librispeech-clean-lance/data")
tbl = db.open_table("train_clean_100")
results = (
tbl.search(q.tolist(), vector_column_name="text_emb")
.metric("cosine")
.select(["id", "speaker_id", "text"])
.limit(5)
.to_list()
)
```
## Full-text and per-speaker filtering
```python
ds = lance.dataset("hf://datasets/lance-format/librispeech-clean-lance/data/train_clean_100.lance")
# Word search via the FTS index.
hits = ds.scanner(full_text_query="universe stars", columns=["id", "text"], limit=10).to_table()
# All utterances by a given speaker.
sp = ds.scanner(filter="speaker_id = 1272", columns=["id", "chapter_id", "text"], limit=10).to_table()
```
### LanceDB full-text search and per-speaker filtering
```python
import lancedb
db = lancedb.connect("hf://datasets/lance-format/librispeech-clean-lance/data")
tbl = db.open_table("train_clean_100")
# Word search via the FTS index.
hits = (
tbl.search("universe stars")
.select(["id", "text"])
.limit(10)
.to_list()
)
# All utterances by a given speaker.
sp = (
tbl.search()
.where("speaker_id = 1272")
.select(["id", "chapter_id", "text"])
.limit(10)
.to_list()
)
```
## Why Lance?
- One dataset for audio + transcripts + embeddings + indices — no parallel folder of FLAC files plus a transcript JSON.
- On-disk vector and full-text indices live next to the data, so search works on local copies and on the Hub.
- Schema evolution: add columns (alternate transcripts, speaker embeddings, model predictions) without rewriting the data.
## Source & license
Converted from [`openslr/librispeech_asr`](https://huggingface.co/datasets/openslr/librispeech_asr). LibriSpeech is released under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) and is built from the public-domain LibriVox audiobook corpus.
## Citation
```
@inproceedings{panayotov2015librispeech,
title={LibriSpeech: An ASR corpus based on public domain audiobooks},
author={Panayotov, Vassil and Chen, Guoguo and Povey, Daniel and Khudanpur, Sanjeev},
booktitle={IEEE International Conference on Acoustics, Speech, and Signal Processing (ICASSP)},
year={2015}
}
```
|