lhoestq HF Staff commited on
Commit
7a15a72
·
verified ·
1 Parent(s): 3a5cd61

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +43 -0
README.md ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Wiki-DPR (first 10k samples of the "multiset" version)
2
+
3
+ ## Overview
4
+
5
+ This is the wikipedia split used to evaluate the Dense Passage Retrieval (DPR) model.
6
+ The original dataset contains 21M passages from wikipedia along with their DPR embeddings.
7
+ The wikipedia articles were split into multiple, disjoint text blocks of 100 words as passages.
8
+
9
+ ## Embeddings
10
+ Passages are embedded using this model:
11
+ https://huggingface.co/sentence-transformers/facebook-dpr-ctx_encoder-multiset-base
12
+
13
+ Questions should embedded using this model:
14
+ https://huggingface.co/sentence-transformers/facebook-dpr-question_encoder-multiset-base
15
+
16
+ ## Dataset format
17
+
18
+ The dataset is in Lance format and contains an index over the `embeddings` column, created using
19
+
20
+ ```python
21
+ >>> table.create_index(metric="dot", vector_column_name="embeddings")
22
+ ```
23
+
24
+ ## Usage example
25
+
26
+ ```python
27
+ >>> import lance
28
+ >>> from sentence_transformers import SentenceTransformer
29
+ >>> ds = lance.dataset("hf://datasets/lhoestq/wiki-dpr-lance-example/dummy-multiset.lance")
30
+ >>> ds.has_index
31
+ True
32
+ >>> q = embeddings = model.encode(["In what year did ABBA start ?"])[0]
33
+ >>> df = ds.to_table(nearest={"column": "embeddings", "q": embeddings, "k": 5}).to_pandas()
34
+ >>> df
35
+ embeddings id text title _distance
36
+ 0 [-0.18065824, 0.25305566, 0.1199052, -0.571353... 9929 numbers from respective albums, but the lukewa... ABBA -71.944893
37
+ 1 [-0.40663224, 0.22715698, 0.06069667, -0.33584... 9934 small label like Playboy Records did not have ... ABBA -71.606918
38
+ 2 [-0.11441193, -0.08622038, 0.1414486, -0.53792... 9931 into the mainstream international market with ... ABBA -71.264702
39
+ 3 [-0.10480262, 0.24277505, 0.0049878294, -0.406... 9930 on her own. Frequent recording sessions brough... ABBA -71.059311
40
+ 4 [-0.013585132, 0.010848946, 0.29921767, -0.283... 9933 credited to Björn & Benny, Agnetha & Anni-Fri... ABBA -71.030861
41
+ >>> df.iloc[0].text[435:544]
42
+ "It was during 1971 that the four artists began working together more, adding vocals to the others' recordings"
43
+ ```