|
|
--- |
|
|
license: apache-2.0 |
|
|
language: |
|
|
- en |
|
|
pretty_name: Wiki DPR - Lance example |
|
|
--- |
|
|
# Wiki-DPR (first 10k samples of the "multiset" version) |
|
|
|
|
|
## Overview |
|
|
|
|
|
This is the wikipedia split used to evaluate the Dense Passage Retrieval (DPR) model. |
|
|
The original dataset contains 21M passages from wikipedia along with their DPR embeddings. |
|
|
The wikipedia articles were split into multiple, disjoint text blocks of 100 words as passages. |
|
|
|
|
|
## Embeddings |
|
|
Passages are embedded using this model: |
|
|
https://huggingface.co/sentence-transformers/facebook-dpr-ctx_encoder-multiset-base |
|
|
|
|
|
Questions should embedded using this model: |
|
|
https://huggingface.co/sentence-transformers/facebook-dpr-question_encoder-multiset-base |
|
|
|
|
|
## Dataset format |
|
|
|
|
|
The dataset is in Lance format and contains an index over the `embeddings` column, created using |
|
|
|
|
|
```python |
|
|
>>> table.create_index(metric="dot", vector_column_name="embeddings") |
|
|
``` |
|
|
|
|
|
## Usage example |
|
|
|
|
|
```python |
|
|
>>> import lance |
|
|
>>> from sentence_transformers import SentenceTransformer |
|
|
>>> ds = lance.dataset("hf://datasets/lhoestq/wiki-dpr-lance-example/dummy-multiset.lance") |
|
|
>>> ds.has_index |
|
|
True |
|
|
>>> q = embeddings = model.encode(["In what year did ABBA start ?"])[0] |
|
|
>>> df = ds.to_table(nearest={"column": "embeddings", "q": embeddings, "k": 5}).to_pandas() |
|
|
>>> df |
|
|
embeddings id text title _distance |
|
|
0 [-0.18065824, 0.25305566, 0.1199052, -0.571353... 9929 numbers from respective albums, but the lukewa... ABBA -71.944893 |
|
|
1 [-0.40663224, 0.22715698, 0.06069667, -0.33584... 9934 small label like Playboy Records did not have ... ABBA -71.606918 |
|
|
2 [-0.11441193, -0.08622038, 0.1414486, -0.53792... 9931 into the mainstream international market with ... ABBA -71.264702 |
|
|
3 [-0.10480262, 0.24277505, 0.0049878294, -0.406... 9930 on her own. Frequent recording sessions brough... ABBA -71.059311 |
|
|
4 [-0.013585132, 0.010848946, 0.29921767, -0.283... 9933 credited to Björn & Benny, Agnetha & Anni-Fri... ABBA -71.030861 |
|
|
>>> df.iloc[0].text[435:544] |
|
|
"It was during 1971 that the four artists began working together more, adding vocals to the others' recordings" |
|
|
``` |