Datasets:
|
Download README.md from lance-format/wikitext-lance: direct link, hf CLI and curl.
- Browser
- Download file 8.43 kB
-
https://huggingface.co/datasets/lance-format/wikitext-lance/resolve/main/README.md
- Command line
-
hf download hf://datasets/lance-format/wikitext-lance/README.md
-
curl -L -o README.md https://huggingface.co/datasets/lance-format/wikitext-lance/resolve/main/README.md
8.43 kB
| pretty_name: WikiText in Lance | |
| license: cc-by-sa-4.0 | |
| language: | |
| - en | |
| task_categories: | |
| - text-generation | |
| - text-retrieval | |
| tags: | |
| - lance | |
| - wikipedia | |
| - language-modeling | |
| - information-retrieval | |
| size_categories: | |
| - 1M<n<10M | |
| arxiv: 1609.07843 | |
| configs: | |
| - config_name: wikitext-103-raw-v1 | |
| default: true | |
| data_files: | |
| - split: train | |
| path: viewer/wikitext-103-raw-v1/train.parquet | |
| - split: validation | |
| path: viewer/wikitext-103-raw-v1/validation.parquet | |
| - split: test | |
| path: viewer/wikitext-103-raw-v1/test.parquet | |
| - config_name: wikitext-103-v1 | |
| data_files: | |
| - split: train | |
| path: viewer/wikitext-103-v1/train.parquet | |
| - split: validation | |
| path: viewer/wikitext-103-v1/validation.parquet | |
| - split: test | |
| path: viewer/wikitext-103-v1/test.parquet | |
| - config_name: wikitext-2-raw-v1 | |
| data_files: | |
| - split: train | |
| path: viewer/wikitext-2-raw-v1/train.parquet | |
| - split: validation | |
| path: viewer/wikitext-2-raw-v1/validation.parquet | |
| - split: test | |
| path: viewer/wikitext-2-raw-v1/test.parquet | |
| - config_name: wikitext-2-v1 | |
| data_files: | |
| - split: train | |
| path: viewer/wikitext-2-v1/train.parquet | |
| - split: validation | |
| path: viewer/wikitext-2-v1/validation.parquet | |
| - split: test | |
| path: viewer/wikitext-2-v1/test.parquet | |
| # WikiText in Lance | |
| Search English Wikipedia article introductions with a natural-language question and locate the matching article in the original WikiText split. This release preserves every text row in all four configurations of WikiText-2 and WikiText-103, with the original split and order. [Original Salesforce dataset at the converted revision](https://huggingface.co/datasets/Salesforce/wikitext/tree/b08601e04326c79dfdd32d625aee71d232d685c3) | |
| ## Browse on Hugging Face | |
| The viewer previews the first 1,000 rows of every configuration and split using the Parquet tables in `viewer/`. Use `data/<configuration>/<split>.lance` for the complete text and `search/<raw-configuration>/<split>.lance` for semantic retrieval. [Open the Dataset Viewer](https://huggingface.co/datasets/lance-format/wikitext-lance/viewer/wikitext-103-raw-v1/train) | |
| ## Splits | |
| | Source configuration | Train text rows | Validation text rows | Test text rows | | |
| |---|---:|---:|---:| | |
| | `wikitext-103-raw-v1` | 1,801,350 | 3,760 | 4,358 | | |
| | `wikitext-103-v1` | 1,801,350 | 3,760 | 4,358 | | |
| | `wikitext-2-raw-v1` | 36,718 | 3,760 | 4,358 | | |
| | `wikitext-2-v1` | 36,718 | 3,760 | 4,358 | | |
| The 12 Lance tables contain 3,708,608 text rows including all blank lines and vocabulary markers. The conversion verified a SHA-256 digest over the ordered `text` values for every split against the source Parquet shards. [Row counts, model revision, and checksums](meta/info.json) | |
| ## Schema | |
| | Table path | Columns | Contents | | |
| |---|---|---| | |
| | `data/<configuration>/<split>.lance` | `text`, `row_id`, `article_id`, `article_title`, `wikipedia_url` | Exact source line, zero-based row number within its split, and Wikipedia attribution from the corresponding raw article. Initial blank lines have null article fields. | | |
| | `search/<raw-configuration>/<split>.lance` | `article_id`, `article_title`, `wikipedia_url`, `wikipedia_history_url`, `source_row_start`, `source_row_stop`, `embedding` | One vector per recognizable article, its attribution links, and its half-open range of source line numbers. `article_id` equals the heading row within the split. | | |
| An article boundary is a first-level title line enclosed by blank lines in the raw source. The derived tables contain 600 WikiText-2 train articles and 28,472 WikiText-103 train articles, plus 60 articles in each validation and test split. The published WikiText-103 summary reports 28,475 train articles. All publisher text rows are present in the line-level Lance tables. [Original WikiText summary](https://state.smerity.com/direct/smerity/state/01HRTB51QZMG59MDAX2ME1TCHR) | |
| ## Embeddings | |
| This release generates one vector per raw article from its normalized title and up to 300 whitespace-delimited words before the first section heading. The conversion joins common WikiText punctuation tokens and removes surrounding whitespace for encoding. The source `text` column preserves the original data. The word-level configurations share the article mapping and row ranges for their raw counterparts. | |
| The model is `sentence-transformers/static-retrieval-mrl-en-v1`, an English text retrieval encoder. This release uses the 256-dimensional Matryoshka representation as normalized `float32` vectors. Queries use the same model with no prefix. Lance ranks by exact cosine distance. The example prints cosine similarity as `1 - distance`, with higher scores first. [Pinned model revision](https://huggingface.co/sentence-transformers/static-retrieval-mrl-en-v1/tree/f60985c706f192d45d218078e49e5a8b6f15283a) | |
| ## Open the complete text | |
| ```python | |
| import lance | |
| wiki = lance.dataset( | |
| "hf://datasets/lance-format/wikitext-lance/data/wikitext-103-raw-v1/train.lance" | |
| ) | |
| print(wiki.count_rows()) | |
| print(wiki.to_table(columns=["row_id", "text"], limit=5).to_pylist()) | |
| ``` | |
| ## Search the article introductions | |
| ```bash | |
| pip install pylance==14.0.3 sentence-transformers==6.3.0 | |
| ``` | |
| ```python | |
| import lance | |
| from sentence_transformers import SentenceTransformer | |
| encoder = SentenceTransformer( | |
| "sentence-transformers/static-retrieval-mrl-en-v1", | |
| revision="f60985c706f192d45d218078e49e5a8b6f15283a", | |
| device="cpu", | |
| truncate_dim=256, | |
| ) | |
| query = encoder.encode( | |
| "How did John Lennon die outside his New York apartment?", | |
| normalize_embeddings=True, | |
| ) | |
| articles = lance.dataset( | |
| "hf://datasets/lance-format/wikitext-lance/search/wikitext-103-raw-v1/train.lance" | |
| ) | |
| hits = articles.to_table( | |
| columns=["article_id", "article_title", "wikipedia_url", "source_row_start", "source_row_stop", "_distance"], | |
| nearest={"column": "embedding", "q": query, "k": 5, "metric": "cosine"}, | |
| ) | |
| for hit in hits.to_pylist(): | |
| score = 1.0 - hit["_distance"] | |
| row_range = f"[{hit['source_row_start']}, {hit['source_row_stop']})" | |
| print(f"{score:.4f}\t{hit['article_id']}\t{row_range}\t{hit['article_title']}\t{hit['wikipedia_url']}") | |
| ``` | |
| Use `source_row_start` and `source_row_stop` with the same split's text table to retrieve the article lines. For a word-level article, open the corresponding configuration without `-raw` and use the same row range. | |
| ## License and attribution | |
| WikiText was collected by Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher at Salesforce from articles written by English Wikipedia contributors. This release repackages the publisher's split text in Lance and adds article attribution, search vectors, and a Parquet preview. [Source dataset and licensing notices](https://huggingface.co/datasets/Salesforce/wikitext/blob/b08601e04326c79dfdd32d625aee71d232d685c3/README.md) · [Original release by Stephen Merity](https://state.smerity.com/direct/smerity/state/01HRTBE0WN2QV8PRC6JDH22DGW) | |
| The publisher's card describes the dataset as CC BY-SA 4.0 and lists CC BY-SA 3.0 and GFDL in its metadata. The underlying Wikipedia text retains its upstream terms, including the CC BY-SA 3.0 grant where applicable. This release uses the Creative Commons share-alike permission and distributes the repackaging and additions under CC BY-SA 4.0. [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/) · [CC BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/) · [Wikimedia attribution and licensing guidance](https://meta.wikimedia.org/wiki/Licensing_update/Implementation#Information_for_re-users) | |
| The Wikipedia article and edit history links credit the contributors. The Lance tables derive these links from raw WikiText titles. An attribution lookup keyed by `article_title` also supplies current Wikipedia page IDs and history links for 28,189 of the 28,350 distinct titles checked. It records 161 unresolved titles, which retain their title-based links in the Lance tables. The lookup resolves current pages and redirects. The preserved text comes from the 2016 WikiText corpus. [Wikipedia attribution lookup](meta/wikipedia_attribution.parquet) · [WikiText collection paper](https://arxiv.org/abs/1609.07843) | |
| ```bibtex | |
| @misc{merity2016pointer, | |
| title = {Pointer Sentinel Mixture Models}, | |
| author = {Stephen Merity and Caiming Xiong and James Bradbury and Richard Socher}, | |
| year = {2016}, | |
| eprint = {1609.07843}, | |
| archivePrefix = {arXiv}, | |
| primaryClass = {cs.CL} | |
| } | |
| ``` | |