CoolFace
Datasetpublic

lance-format/librispeech-clean-lance

LibriSpeech clean (Lance Format) A Lance-formatted version of the LibriSpeech ASR clean configuration, sourced from openslr/librispeech_asr. Each row is one utterance with inline FLAC audio bytes, the reference transcript, a sentence-transformers embedding of that transcript, and speaker/chapter metadata — all available directly from the Hub at hf://datasets/lance-format/librispeech-clean-lance/data. Key features Inline FLAC bytes in the audio column at 16 kHz… See the full description on the dataset page: https://huggingface.co/datasets/lance-format/librispeech-clean-lance.

sourceHugging Facecc-by-4.0updated 4mo agoView on Hugging Face
0likes348downloads
README.md321 linesDownload Raw Back to root
1---2license: cc-by-4.03task_categories:4- automatic-speech-recognition5- audio-classification6- text-retrieval7language:8- en9tags:10- librispeech11- asr12- audio13- speech14- lance15- sentence-transformers16pretty_name: librispeech-clean-lance17size_categories:18- 10K<n<100K19---20# LibriSpeech `clean` (Lance Format)21 22A Lance-formatted version of the LibriSpeech ASR `clean` configuration, sourced from [`openslr/librispeech_asr`](https://huggingface.co/datasets/openslr/librispeech_asr). Each row is one utterance with inline FLAC audio bytes, the reference transcript, a sentence-transformers embedding of that transcript, and speaker/chapter metadata — all available directly from the Hub at `hf://datasets/lance-format/librispeech-clean-lance/data`.23 24## Key features25 26- **Inline FLAC bytes** in the `audio` column at 16 kHz mono, with no re-encoding from the upstream parquet.27- **Sentence-transformers embedding of the transcript** in `text_emb` (`all-MiniLM-L6-v2`, 384-dim, cosine-normalized) with a bundled `IVF_PQ` index for semantic transcript search.28- **Pre-built `INVERTED` FTS index on `text`** and `BTREE` indices on `id`, `speaker_id`, and `chapter_id` for keyword search and stable lookup by identifier.29- **Per-utterance metadata** — `speaker_id`, `chapter_id`, `num_chars`, `sampling_rate` — that downstream filters can stack on.30 31## Splits32 33| Split | Source config | Rows | Description |34|-------|---------------|------|-------------|35| `dev_clean.lance`       | `dev.clean`       | 2,703  | Standard ASR validation set |36| `test_clean.lance`      | `test.clean`      | 2,620  | Standard ASR test set |37| `train_clean_100.lance` | `train.clean.100` | 28,539 | 100-hour clean training subset |38 39> The 360-hour and 500-hour LibriSpeech subsets (`train.360`, `train.other.500`) are not bundled here. To extend, point `librispeech/dataprep.py` at additional splits.40 41## Schema42 43| Column | Type | Notes |44|---|---|---|45| `id` | `string` | Utterance id (e.g. `1272-128104-0000`) |46| `audio` | `large_binary` | Inline FLAC bytes (16 kHz mono) |47| `sampling_rate` | `int32` | Always 16,000 |48| `text` | `string` | Reference transcript |49| `speaker_id` | `int64` | LibriVox speaker id |50| `chapter_id` | `int64` | LibriVox chapter id |51| `num_chars` | `int32` | Length of `text` in characters |52| `text_emb` | `fixed_size_list<float32, 384>` | sentence-transformers `all-MiniLM-L6-v2` (cosine-normalized) |53 54## Pre-built indices55 56- `IVF_PQ` on `text_emb` — semantic transcript search (cosine)57- `INVERTED` (FTS) on `text` — keyword and hybrid search58- `BTREE` on `id`, `speaker_id`, `chapter_id` — fast lookup by identifier59 60## Why Lance?61 621. **Blazing Fast Random Access**: Optimized for fetching scattered rows, making it ideal for random sampling, real-time ML serving, and interactive applications without performance degradation.632. **Native Multimodal Support**: Store text, embeddings, and other data types together in a single file. Large binary objects are loaded lazily, and vectors are optimized for fast similarity search.643. **Native Index Support**: Lance comes with fast, on-disk, scalable vector and FTS indexes that sit right alongside the dataset on the Hub, so you can share not only your data but also your embeddings and indexes without your users needing to recompute them.654. **Efficient Data Evolution**: Add new columns and backfill data without rewriting the entire dataset. This is perfect for evolving ML features, adding new embeddings, or introducing moderation tags over time.665. **Versatile Querying**: Supports combining vector similarity search, full-text search, and SQL-style filtering in a single query, accelerated by on-disk indexes.676. **Data Versioning**: Every mutation commits a new version; previous versions remain intact on disk. Tags pin a snapshot by name, so retrieval systems and training runs can reproduce against an exact slice of history.68 69## Load with `datasets.load_dataset`70 71You can load Lance datasets via the standard HuggingFace `datasets` interface, suitable when your pipeline already speaks `Dataset` / `IterableDataset` or you want a quick streaming sample.72 73```python74import datasets75 76hf_ds = datasets.load_dataset("lance-format/librispeech-clean-lance", split="test_clean", streaming=True)77for row in hf_ds.take(3):78    print(row["id"], row["text"][:80])79```80 81## Load with LanceDB82 83LanceDB is the embedded retrieval library built on top of the Lance format ([docs](https://lancedb.com/docs)), and is the interface most users interact with. Each `.lance` file in `data/` is a table — open by name (`dev_clean`, `test_clean`, `train_clean_100`). The same handle is used by the Search, Curate, Evolve, Versioning, and Materialize-a-subset sections below.84 85```python86import lancedb87 88db = lancedb.connect("hf://datasets/lance-format/librispeech-clean-lance/data")89tbl = db.open_table("train_clean_100")90print(len(tbl))91```92 93## Load with Lance94 95`pylance` is the Python binding for the Lance format and works directly with the format's lower-level APIs. Reach for it when you want to inspect dataset internals — schema, scanner, fragments, the list of pre-built indices.96 97```python98import lance99 100ds = lance.dataset("hf://datasets/lance-format/librispeech-clean-lance/data/train_clean_100.lance")101print(ds.count_rows(), ds.schema.names)102print(ds.list_indices())103```104 105> **Tip — for production use, download locally first.** Streaming from the Hub works for exploration, but heavy random access, ANN search, and audio decoding are far faster against a local copy:106> ```bash107> hf download lance-format/librispeech-clean-lance --repo-type dataset --local-dir ./librispeech-clean108> ```109> Then point Lance or LanceDB at `./librispeech-clean/data`.110 111## Search112 113The bundled `IVF_PQ` index on `text_emb` makes semantic transcript retrieval a single call. In production you would encode a query string through the same sentence-transformers model used at ingest (`all-MiniLM-L6-v2`, cosine-normalized), then pass the resulting 384-d vector to `tbl.search(...)`. The example below uses the embedding from row 42 as a runnable stand-in.114 115```python116import lancedb117 118db = lancedb.connect("hf://datasets/lance-format/librispeech-clean-lance/data")119tbl = db.open_table("train_clean_100")120 121seed = (122    tbl.search()123    .select(["text_emb", "text"])124    .limit(1)125    .offset(42)126    .to_list()[0]127)128 129hits = (130    tbl.search(seed["text_emb"], vector_column_name="text_emb")131    .metric("cosine")132    .select(["id", "speaker_id", "text"])133    .limit(10)134    .to_list()135)136print("query transcript:", seed["text"][:80])137for r in hits:138    print(f"  {r['id']}  spk={r['speaker_id']}  {r['text'][:80]}")139```140 141The `audio` blob is never touched. A top-10 semantic search moves a few kilobytes of transcript text rather than the FLAC bytes for every candidate.142 143Because the dataset also ships an `INVERTED` index on `text`, the same query can be issued as a hybrid search that combines the dense vector with a keyword query — useful when a name or domain term must literally appear in the transcript but you still want the semantic side to rank the rest.144 145```python146hybrid_hits = (147    tbl.search(query_type="hybrid", vector_column_name="text_emb")148    .vector(seed["text_emb"])149    .text("astronomy")150    .select(["id", "speaker_id", "text"])151    .limit(10)152    .to_list()153)154for r in hybrid_hits:155    print(f"  {r['id']}  spk={r['speaker_id']}  {r['text'][:80]}")156```157 158Tune `metric`, `nprobes`, and `refine_factor` on the vector side to trade recall against latency.159 160## Curate161 162Building a focused subset of utterances usually means combining content with structure — pick utterances by a single speaker, or above a minimum transcript length, or matching a topic. Stacking predicates inside a single filtered scan keeps the result small and explicit, and the bounded `.limit(500)` makes it cheap to inspect.163 164```python165import lancedb166 167db = lancedb.connect("hf://datasets/lance-format/librispeech-clean-lance/data")168tbl = db.open_table("train_clean_100")169 170candidates = (171    tbl.search()172    .where("speaker_id = 1272 AND num_chars >= 60", prefilter=True)173    .select(["id", "chapter_id", "num_chars", "text"])174    .limit(500)175    .with_row_id(True)176    .to_list()177)178print(f"{len(candidates)} utterances; first: {candidates[0]['text'][:80]}")179```180 181The scan never reads the `audio` column. Lance stores binary columns independently, so a metadata-only curation pass moves only the transcript text and scalar fields across the wire — even though the underlying table includes hours of inline FLAC audio.182 183## Evolve184 185Lance stores each column independently, so a new column can be appended without rewriting the existing data. The lightest form is a SQL expression: derive the new column from columns that already exist, and Lance computes it once and persists it. The example below adds a `is_long_utterance` flag and a coarse `length_bucket`, either of which can then be used directly in `where` clauses without re-evaluating the predicate on every query.186 187> **Note:** Mutations require a local copy of the dataset, since the Hub mount is read-only. See the Materialize-a-subset section at the end of this card for a streaming pattern that downloads only the rows and columns you need.188 189```python190import lancedb191 192db = lancedb.connect("./librispeech-clean/data")  # local copy required for writes193tbl = db.open_table("train_clean_100")194 195tbl.add_columns({196    "is_long_utterance": "num_chars >= 200",197    "length_bucket": (198        "CASE WHEN num_chars < 80 THEN 'short' "199        "WHEN num_chars < 200 THEN 'medium' ELSE 'long' END"200    ),201})202```203 204If the values you want to attach already live in another table (alternate transcripts, speaker embeddings, model predictions), merge them in by joining on `id`:205 206```python207import pyarrow as pa208 209predictions = pa.table({210    "id": pa.array(["1272-128104-0000", "1272-128104-0001"]),211    "wer": pa.array([0.04, 0.12]),212})213tbl.merge(predictions, on="id")214```215 216The original columns and indices are untouched, so existing code that does not reference the new columns continues to work unchanged. For column values that require a Python computation (e.g., running a speaker embedding model over the FLAC bytes), Lance provides a batch-UDF API — see the [Lance data evolution docs](https://lance.org/guide/data_evolution/).217 218## Train219 220A common pattern for audio training is to pre-extract decoded features once into a derived LanceDB table — one row per training-ready window of log-mel frames or raw PCM samples — and train against that table with the regular projection-based dataloader. `take_blobs` is the mechanism that makes the extraction step tractable: each utterance's FLAC bytes are randomly addressable, so the pass can subset audio on demand and write decoded windows into a fresh table without an external file store. Other workflows project `audio` directly through `select_columns(...)` and decode at the batch boundary, or skip audio entirely and train on the cached transcript embeddings — the right shape is workload-specific. The actual training loop is the same `Permutation.identity(tbl).select_columns(...)` snippet in every case; only the source table and the column list change.221 222Against a pre-extracted features table:223 224```python225import lancedb226from lancedb.permutation import Permutation227from torch.utils.data import DataLoader228 229db = lancedb.connect("./librispeech-features")   # local table produced by the one-time extraction230tbl = db.open_table("train")231 232train_ds = Permutation.identity(tbl).select_columns(["log_mel", "text", "speaker_id"])233loader = DataLoader(train_ds, batch_size=32, shuffle=True, num_workers=4)234```235 236Against the cached transcript embeddings on the source table (no audio decode):237 238```python239import lancedb240from lancedb.permutation import Permutation241from torch.utils.data import DataLoader242 243src_db = lancedb.connect("hf://datasets/lance-format/librispeech-clean-lance/data")244src_tbl = src_db.open_table("train_clean_100")245 246train_ds = Permutation.identity(src_tbl).select_columns(["text_emb", "speaker_id"])247loader = DataLoader(train_ds, batch_size=256, shuffle=True, num_workers=4)248```249 250The inline `audio` storage and `take_blobs` still earn their place around the training process — listening back to an utterance in a notebook, sampling for human review, one-off evaluation against a held-out set, and the pre-extraction pass itself. Each of those reads a small, explicit set of blobs once. What the Train section above keeps off the per-batch hot path is exactly that raw-audio decode: paying it every step is what the pre-extracted features are designed to avoid.251 252## Versioning253 254Every mutation to a Lance dataset, whether it adds a column, merges labels, or builds an index, commits a new version. Previous versions remain intact on disk. You can list versions and inspect the history directly from the Hub copy; creating new tags requires a local copy since tags are writes.255 256```python257import lancedb258 259db = lancedb.connect("hf://datasets/lance-format/librispeech-clean-lance/data")260tbl = db.open_table("train_clean_100")261 262print("Current version:", tbl.version)263print("History:", tbl.list_versions())264print("Tags:", tbl.tags.list())265```266 267Once you have a local copy, tag a version for reproducibility:268 269```python270local_db = lancedb.connect("./librispeech-clean/data")271local_tbl = local_db.open_table("train_clean_100")272local_tbl.tags.create("minilm-v1", local_tbl.version)273```274 275A tagged version can be opened by name, or any version reopened by its number, against either the Hub copy or a local one:276 277```python278tbl_v1 = db.open_table("train_clean_100", version="minilm-v1")279tbl_v5 = db.open_table("train_clean_100", version=5)280```281 282Pinning supports two workflows. A retrieval system locked to `minilm-v1` keeps returning stable results while the dataset evolves in parallel. A training experiment pinned to the same tag can be rerun later against the exact same utterances, so changes in metrics reflect model changes rather than data drift.283 284## Materialize a subset285 286Reads from the Hub are lazy, so exploratory queries only transfer the columns and row groups they touch. Mutating operations (Evolve, tag creation) need a writable backing store, and a training pipeline benefits from a local copy with fast random access to the FLAC bytes. Both can be served by a subset of the dataset rather than the full split. The pattern is to stream a filtered query through `.to_batches()` into a new local table; only the projected columns and matching row groups cross the wire, and the bytes never fully materialize in Python memory — including the `audio` column, which streams through Arrow record batches rather than being assembled in a single buffer.287 288```python289import lancedb290 291remote_db = lancedb.connect("hf://datasets/lance-format/librispeech-clean-lance/data")292remote_tbl = remote_db.open_table("train_clean_100")293 294batches = (295    remote_tbl.search()296    .where("speaker_id = 1272")297    .select(["id", "audio", "sampling_rate", "text", "speaker_id", "chapter_id", "text_emb"])298    .to_batches()299)300 301local_db = lancedb.connect("./librispeech-speaker-1272")302local_db.create_table("train", batches)303```304 305The resulting `./librispeech-speaker-1272` is a first-class LanceDB database. Every snippet in the Evolve, Train, and Versioning sections above works against it by swapping `hf://datasets/lance-format/librispeech-clean-lance/data` for `./librispeech-speaker-1272`.306 307## Source & license308 309Converted 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.310 311## Citation312 313```314@inproceedings{panayotov2015librispeech,315  title={LibriSpeech: An ASR corpus based on public domain audiobooks},316  author={Panayotov, Vassil and Chen, Guoguo and Povey, Daniel and Khudanpur, Sanjeev},317  booktitle={IEEE International Conference on Acoustics, Speech, and Signal Processing (ICASSP)},318  year={2015}319}320```321