Datasets:
Add files using upload-large-folder tool
Browse files- .gitattributes +7 -0
- README.md +146 -0
- data/test.lance/_indices/8e7fef6b-00b1-48d1-89fd-2fd6c83a1359/page_data.lance +0 -0
- data/test.lance/_indices/8e7fef6b-00b1-48d1-89fd-2fd6c83a1359/page_lookup.lance +0 -0
- data/test.lance/_indices/ad195cef-bc67-404b-90a4-40fdcd85ede6/auxiliary.idx +3 -0
- data/test.lance/_indices/ad195cef-bc67-404b-90a4-40fdcd85ede6/index.idx +3 -0
- data/test.lance/_indices/c4e84a5a-0282-4519-871a-60782ae0afd1/bitmap_page_lookup.lance +0 -0
- data/test.lance/_transactions/0-a515810e-59a6-410d-9778-3c50256895c4.txn +0 -0
- data/test.lance/_transactions/1-6a9fcea7-1ba3-49a8-9996-16e5f8835236.txn +0 -0
- data/test.lance/_transactions/2-e7a677dd-ed6d-4757-a6a0-e62fbf3be18c.txn +0 -0
- data/test.lance/_transactions/3-379d27b1-a569-46be-8da6-ab34b95bc5dc.txn +0 -0
- data/test.lance/_versions/18446744073709551611.manifest +0 -0
- data/test.lance/_versions/18446744073709551612.manifest +0 -0
- data/test.lance/_versions/18446744073709551613.manifest +0 -0
- data/test.lance/_versions/18446744073709551614.manifest +0 -0
- data/test.lance/data/110010001100011101010111b0b1364b67a82b51d912b59a03.lance +3 -0
- data/train.lance/_indices/615e0141-1824-4b4b-bea2-be42c183b22a/page_data.lance +3 -0
- data/train.lance/_indices/615e0141-1824-4b4b-bea2-be42c183b22a/page_lookup.lance +0 -0
- data/train.lance/_indices/62e977a9-57d3-4976-a629-13e74618d1c8/auxiliary.idx +3 -0
- data/train.lance/_indices/62e977a9-57d3-4976-a629-13e74618d1c8/index.idx +3 -0
- data/train.lance/_indices/f929ddea-3bd6-4f9e-a670-f263ef1565ae/bitmap_page_lookup.lance +0 -0
- data/train.lance/_transactions/0-89b4addb-d8a3-4698-831b-9fcb2cb77432.txn +0 -0
- data/train.lance/_transactions/1-13b1e84f-8f12-4381-95ee-4a5f59640e69.txn +0 -0
- data/train.lance/_transactions/2-12b62001-019b-491c-b4bc-8f067a75ffc6.txn +0 -0
- data/train.lance/_transactions/3-2fe3cea3-6e22-4e49-8d33-c1b0fde5a2a2.txn +0 -0
- data/train.lance/_versions/18446744073709551611.manifest +0 -0
- data/train.lance/_versions/18446744073709551612.manifest +0 -0
- data/train.lance/_versions/18446744073709551613.manifest +0 -0
- data/train.lance/_versions/18446744073709551614.manifest +0 -0
- data/train.lance/data/10111100100100010101100070ab1d4f7e8d2c5f6f67a7b535.lance +3 -0
.gitattributes
CHANGED
|
@@ -58,3 +58,10 @@ saved_model/**/* 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
# Video files - compressed
|
| 59 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 61 |
+
data/train.lance/_indices/615e0141-1824-4b4b-bea2-be42c183b22a/page_data.lance filter=lfs diff=lfs merge=lfs -text
|
| 62 |
+
data/train.lance/_indices/62e977a9-57d3-4976-a629-13e74618d1c8/index.idx filter=lfs diff=lfs merge=lfs -text
|
| 63 |
+
data/test.lance/_indices/ad195cef-bc67-404b-90a4-40fdcd85ede6/index.idx filter=lfs diff=lfs merge=lfs -text
|
| 64 |
+
data/test.lance/_indices/ad195cef-bc67-404b-90a4-40fdcd85ede6/auxiliary.idx filter=lfs diff=lfs merge=lfs -text
|
| 65 |
+
data/train.lance/_indices/62e977a9-57d3-4976-a629-13e74618d1c8/auxiliary.idx filter=lfs diff=lfs merge=lfs -text
|
| 66 |
+
data/test.lance/data/110010001100011101010111b0b1364b67a82b51d912b59a03.lance filter=lfs diff=lfs merge=lfs -text
|
| 67 |
+
data/train.lance/data/10111100100100010101100070ab1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-retrieval
|
| 6 |
+
language:
|
| 7 |
+
- en
|
| 8 |
+
tags:
|
| 9 |
+
- mnist
|
| 10 |
+
- digits
|
| 11 |
+
- lance
|
| 12 |
+
- clip-embeddings
|
| 13 |
+
pretty_name: mnist-lance
|
| 14 |
+
size_categories:
|
| 15 |
+
- 10K<n<100K
|
| 16 |
+
---
|
| 17 |
+
# MNIST (Lance Format)
|
| 18 |
+
|
| 19 |
+
A Lance-formatted version of the classic [MNIST handwritten-digit dataset](https://huggingface.co/datasets/ylecun/mnist) with **70,000 28×28 grayscale digits** stored inline alongside CLIP image embeddings and a pre-built ANN index.
|
| 20 |
+
|
| 21 |
+
## Key features
|
| 22 |
+
|
| 23 |
+
- All multimodal data (image bytes + embeddings) stored **inline** in the same Lance dataset — no sidecar files, no external image folders.
|
| 24 |
+
- **Pre-computed CLIP embeddings** (OpenCLIP `ViT-B-32` / `laion2b_s34b_b79k`, 512-dim, L2-normalized) shipped with an `IVF_PQ` index for instant similarity search.
|
| 25 |
+
- **BTREE index on `label`** and **BITMAP index on `label_name`** for sub-millisecond filtering.
|
| 26 |
+
- Standard train/test splits, ready to use with `lance.dataset(...)` or `datasets.load_dataset(...)`.
|
| 27 |
+
|
| 28 |
+
## Splits
|
| 29 |
+
|
| 30 |
+
| Split | Rows |
|
| 31 |
+
|-------|------|
|
| 32 |
+
| `train` | 60,000 |
|
| 33 |
+
| `test` | 10,000 |
|
| 34 |
+
|
| 35 |
+
## Schema
|
| 36 |
+
|
| 37 |
+
| Column | Type | Notes |
|
| 38 |
+
|---|---|---|
|
| 39 |
+
| `id` | `int64` | Row index within the split |
|
| 40 |
+
| `image` | `large_binary` | Inline PNG bytes (28×28 grayscale) |
|
| 41 |
+
| `label` | `int32` | Digit class id (0-9) |
|
| 42 |
+
| `label_name` | `string` | Human-readable class (`"0".."9"`) |
|
| 43 |
+
| `image_emb` | `fixed_size_list<float32, 512>` | CLIP image embedding (cosine-normalized) |
|
| 44 |
+
|
| 45 |
+
## Pre-built indices
|
| 46 |
+
|
| 47 |
+
- `IVF_PQ` on `image_emb` — vector similarity search (`metric=cosine`)
|
| 48 |
+
- `BTREE` on `label` — fast equality / range filters
|
| 49 |
+
- `BITMAP` on `label_name` — fast filters on the 10 class names
|
| 50 |
+
|
| 51 |
+
## Load with `datasets.load_dataset`
|
| 52 |
+
|
| 53 |
+
```python
|
| 54 |
+
import datasets
|
| 55 |
+
|
| 56 |
+
hf_ds = datasets.load_dataset("lance-format/mnist-lance", split="train", streaming=True)
|
| 57 |
+
for row in hf_ds.take(3):
|
| 58 |
+
print(row["label"], row["label_name"])
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
## Load directly with Lance (recommended)
|
| 62 |
+
|
| 63 |
+
```python
|
| 64 |
+
import lance
|
| 65 |
+
|
| 66 |
+
ds = lance.dataset("hf://datasets/lance-format/mnist-lance/data/train.lance")
|
| 67 |
+
print(ds.count_rows(), ds.schema.names)
|
| 68 |
+
print(ds.list_indices())
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
## Load with LanceDB
|
| 72 |
+
|
| 73 |
+
```python
|
| 74 |
+
import lancedb
|
| 75 |
+
|
| 76 |
+
db = lancedb.connect("hf://datasets/lance-format/mnist-lance/data")
|
| 77 |
+
tbl = db.open_table("train")
|
| 78 |
+
print(len(tbl))
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
> **Tip — for production use, download locally first.** Streaming from the Hub works for exploration, but heavy random access and ANN search are far faster against a local copy:
|
| 82 |
+
> ```bash
|
| 83 |
+
> hf download lance-format/mnist-lance --repo-type dataset --local-dir ./mnist-lance
|
| 84 |
+
> ```
|
| 85 |
+
> Then `lance.dataset("./mnist-lance/data/train.lance")`.
|
| 86 |
+
|
| 87 |
+
## Vector search example
|
| 88 |
+
|
| 89 |
+
```python
|
| 90 |
+
import lance
|
| 91 |
+
import pyarrow as pa
|
| 92 |
+
|
| 93 |
+
ds = lance.dataset("hf://datasets/lance-format/mnist-lance/data/train.lance")
|
| 94 |
+
emb_field = ds.schema.field("image_emb")
|
| 95 |
+
ref = ds.take([0], columns=["image_emb"]).to_pylist()[0]["image_emb"]
|
| 96 |
+
query = pa.array([ref], type=emb_field.type)
|
| 97 |
+
|
| 98 |
+
neighbors = ds.scanner(
|
| 99 |
+
nearest={"column": "image_emb", "q": query[0], "k": 5, "nprobes": 16, "refine_factor": 30},
|
| 100 |
+
columns=["id", "label", "label_name"],
|
| 101 |
+
).to_table().to_pylist()
|
| 102 |
+
print(neighbors)
|
| 103 |
+
```
|
| 104 |
+
|
| 105 |
+
## Filter by class
|
| 106 |
+
|
| 107 |
+
```python
|
| 108 |
+
ds = lance.dataset("hf://datasets/lance-format/mnist-lance/data/train.lance")
|
| 109 |
+
sevens = ds.scanner(filter="label = 7", columns=["id"], limit=10).to_table()
|
| 110 |
+
print(sevens)
|
| 111 |
+
```
|
| 112 |
+
|
| 113 |
+
## Working with images
|
| 114 |
+
|
| 115 |
+
```python
|
| 116 |
+
from pathlib import Path
|
| 117 |
+
import lance
|
| 118 |
+
|
| 119 |
+
ds = lance.dataset("hf://datasets/lance-format/mnist-lance/data/train.lance")
|
| 120 |
+
row = ds.take([0], columns=["image", "label"]).to_pylist()[0]
|
| 121 |
+
Path("digit_0.png").write_bytes(row["image"])
|
| 122 |
+
print("label =", row["label"])
|
| 123 |
+
```
|
| 124 |
+
|
| 125 |
+
Images are stored inline as PNG bytes; scanning columns like `label` does not pay the I/O cost of loading image bytes.
|
| 126 |
+
|
| 127 |
+
## Why Lance?
|
| 128 |
+
|
| 129 |
+
- One dataset for images + embeddings + indices + metadata — no sidecar files to manage.
|
| 130 |
+
- On-disk vector and full-text indices live next to the data, so search works on both local copies and the Hub.
|
| 131 |
+
- Schema evolution lets you add new columns (fresh embeddings, augmentations, model predictions) without rewriting the data ([docs](https://lance.org/guide/data_evolution/)).
|
| 132 |
+
|
| 133 |
+
## Source & license
|
| 134 |
+
|
| 135 |
+
Converted from [`ylecun/mnist`](https://huggingface.co/datasets/ylecun/mnist). MNIST is released under the MIT license. The original dataset is by Yann LeCun, Corinna Cortes, and Christopher J.C. Burges.
|
| 136 |
+
|
| 137 |
+
## Citation
|
| 138 |
+
|
| 139 |
+
```
|
| 140 |
+
@article{lecun1998mnist,
|
| 141 |
+
title={The MNIST database of handwritten digits},
|
| 142 |
+
author={LeCun, Yann and Cortes, Corinna and Burges, CJ},
|
| 143 |
+
url={http://yann.lecun.com/exdb/mnist/},
|
| 144 |
+
year={1998}
|
| 145 |
+
}
|
| 146 |
+
```
|
data/test.lance/_indices/8e7fef6b-00b1-48d1-89fd-2fd6c83a1359/page_data.lance
ADDED
|
Binary file (19 kB). View file
|
|
|
data/test.lance/_indices/8e7fef6b-00b1-48d1-89fd-2fd6c83a1359/page_lookup.lance
ADDED
|
Binary file (1.26 kB). View file
|
|
|
data/test.lance/_indices/ad195cef-bc67-404b-90a4-40fdcd85ede6/auxiliary.idx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c852fcff7a2acf85f04243e79b435793573056c16f54ffdc43740db8a570d0b3
|
| 3 |
+
size 1185029
|
data/test.lance/_indices/ad195cef-bc67-404b-90a4-40fdcd85ede6/index.idx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0833489ccd4e40717d2ee07a3114d4250929b613186dd0205921005d1357fa31
|
| 3 |
+
size 131722
|
data/test.lance/_indices/c4e84a5a-0282-4519-871a-60782ae0afd1/bitmap_page_lookup.lance
ADDED
|
Binary file (21 kB). View file
|
|
|
data/test.lance/_transactions/0-a515810e-59a6-410d-9778-3c50256895c4.txn
ADDED
|
Binary file (317 Bytes). View file
|
|
|
data/test.lance/_transactions/1-6a9fcea7-1ba3-49a8-9996-16e5f8835236.txn
ADDED
|
Binary file (189 Bytes). View file
|
|
|
data/test.lance/_transactions/2-e7a677dd-ed6d-4757-a6a0-e62fbf3be18c.txn
ADDED
|
Binary file (193 Bytes). View file
|
|
|
data/test.lance/_transactions/3-379d27b1-a569-46be-8da6-ab34b95bc5dc.txn
ADDED
|
Binary file (184 Bytes). View file
|
|
|
data/test.lance/_versions/18446744073709551611.manifest
ADDED
|
Binary file (1.1 kB). View file
|
|
|
data/test.lance/_versions/18446744073709551612.manifest
ADDED
|
Binary file (969 Bytes). View file
|
|
|
data/test.lance/_versions/18446744073709551613.manifest
ADDED
|
Binary file (816 Bytes). View file
|
|
|
data/test.lance/_versions/18446744073709551614.manifest
ADDED
|
Binary file (793 Bytes). View file
|
|
|
data/test.lance/data/110010001100011101010111b0b1364b67a82b51d912b59a03.lance
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:28ca589d08a8ffa4a1bea2dda684d3dd6d64116a3ef795ba48c338a42eb92ab9
|
| 3 |
+
size 23428453
|
data/train.lance/_indices/615e0141-1824-4b4b-bea2-be42c183b22a/page_data.lance
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1ef24cad3c9d0ae26f09dc01d4f6ebfcd1645c2365f0a2cb0bef781335535303
|
| 3 |
+
size 120845
|
data/train.lance/_indices/615e0141-1824-4b4b-bea2-be42c183b22a/page_lookup.lance
ADDED
|
Binary file (1.34 kB). View file
|
|
|
data/train.lance/_indices/62e977a9-57d3-4976-a629-13e74618d1c8/auxiliary.idx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0118238d1b50274e1fb869d435ff86c22b136418c5fc76e4121260d21543c4b6
|
| 3 |
+
size 4496715
|
data/train.lance/_indices/62e977a9-57d3-4976-a629-13e74618d1c8/index.idx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9def8dbda43cefc680d20ac9e84662387e880a40a6742a9577cc2937c9e7619d
|
| 3 |
+
size 131722
|
data/train.lance/_indices/f929ddea-3bd6-4f9e-a670-f263ef1565ae/bitmap_page_lookup.lance
ADDED
|
Binary file (82.9 kB). View file
|
|
|
data/train.lance/_transactions/0-89b4addb-d8a3-4698-831b-9fcb2cb77432.txn
ADDED
|
Binary file (318 Bytes). View file
|
|
|
data/train.lance/_transactions/1-13b1e84f-8f12-4381-95ee-4a5f59640e69.txn
ADDED
|
Binary file (190 Bytes). View file
|
|
|
data/train.lance/_transactions/2-12b62001-019b-491c-b4bc-8f067a75ffc6.txn
ADDED
|
Binary file (193 Bytes). View file
|
|
|
data/train.lance/_transactions/3-2fe3cea3-6e22-4e49-8d33-c1b0fde5a2a2.txn
ADDED
|
Binary file (184 Bytes). View file
|
|
|
data/train.lance/_versions/18446744073709551611.manifest
ADDED
|
Binary file (1.1 kB). View file
|
|
|
data/train.lance/_versions/18446744073709551612.manifest
ADDED
|
Binary file (971 Bytes). View file
|
|
|
data/train.lance/_versions/18446744073709551613.manifest
ADDED
|
Binary file (819 Bytes). View file
|
|
|
data/train.lance/_versions/18446744073709551614.manifest
ADDED
|
Binary file (795 Bytes). View file
|
|
|
data/train.lance/data/10111100100100010101100070ab1d4f7e8d2c5f6f67a7b535.lance
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ff05e34ec48f81ef7ed577d7bab0213883e9bfda5fc3aad04dd5f6f54295e159
|
| 3 |
+
size 140553134
|