Datasets:
Use LanceDB for all dataset card examples
#3
by tsmithv11 - opened
README.md
CHANGED
|
@@ -81,26 +81,9 @@ Preprocessing adds `passage: ` to each input and uses the model tokenizer with a
|
|
| 81 |
- Indexed filters can select parts by family or QA level.
|
| 82 |
- Version tags keep the same examples accessible across evaluations.
|
| 83 |
|
| 84 |
-
## Load with `datasets.load_dataset`
|
| 85 |
-
|
| 86 |
-
The Lance reader in `datasets` 5.2.0 expects a saved Hugging Face token. Run `hf auth login` before using this loader. The Lance and LanceDB examples below support anonymous access.
|
| 87 |
-
|
| 88 |
-
```python
|
| 89 |
-
from datasets import load_dataset
|
| 90 |
-
|
| 91 |
-
rows = load_dataset(
|
| 92 |
-
"lance-format/benchcad-lance",
|
| 93 |
-
"QA",
|
| 94 |
-
split="QA",
|
| 95 |
-
streaming=True,
|
| 96 |
-
columns=["stem", "family"],
|
| 97 |
-
)
|
| 98 |
-
print(next(iter(rows)))
|
| 99 |
-
```
|
| 100 |
-
|
| 101 |
## Load with LanceDB
|
| 102 |
|
| 103 |
-
|
| 104 |
|
| 105 |
```python
|
| 106 |
import lancedb
|
|
@@ -108,15 +91,7 @@ import lancedb
|
|
| 108 |
db = lancedb.connect("hf://datasets/lance-format/benchcad-lance/data")
|
| 109 |
tbl = db.open_table("qa")
|
| 110 |
print(tbl.count_rows())
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
## Load with Lance
|
| 114 |
-
|
| 115 |
-
```python
|
| 116 |
-
import lance
|
| 117 |
-
|
| 118 |
-
ds = lance.dataset("hf://datasets/lance-format/benchcad-lance/data/qa.lance")
|
| 119 |
-
print(ds.count_rows(), ds.list_indices())
|
| 120 |
```
|
| 121 |
|
| 122 |
For repeated training or heavy random access, download the dataset once and open `./benchcad-lance/data` locally.
|
|
|
|
| 81 |
- Indexed filters can select parts by family or QA level.
|
| 82 |
- Version tags keep the same examples accessible across evaluations.
|
| 83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
## Load with LanceDB
|
| 85 |
|
| 86 |
+
Open the public QA table directly on Hugging Face to inspect its row count and indices. [LanceDB documentation](https://lancedb.com/docs)
|
| 87 |
|
| 88 |
```python
|
| 89 |
import lancedb
|
|
|
|
| 91 |
db = lancedb.connect("hf://datasets/lance-format/benchcad-lance/data")
|
| 92 |
tbl = db.open_table("qa")
|
| 93 |
print(tbl.count_rows())
|
| 94 |
+
print(tbl.list_indices())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
```
|
| 96 |
|
| 97 |
For repeated training or heavy random access, download the dataset once and open `./benchcad-lance/data` locally.
|