ustc-zhangzm commited on
Commit
e2e9e56
·
verified ·
1 Parent(s): 6ccdf87

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +114 -0
README.md ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dataset for HybRank
2
+
3
+ You can download preprocessed data from [HuggingFace Repo](https://huggingface.co/datasets/ustc-zhangzm/HybRank)
4
+
5
+ Note that `train_scores.hdf5` of `MS MARCO` dataset files are split via
6
+ ```bash
7
+ split -d -b 3G train_scores.hdf5 train_scores.hdf5.
8
+ ```
9
+
10
+ Run following command to concatenate these files after all shards have been downloaded
11
+ ```bash
12
+ cat train_scores.hdf5.* > train_scores.hdf5
13
+ ```
14
+
15
+ Or you can generate data by yourself via the following steps:
16
+
17
+ ## Dependencies
18
+ ```
19
+ java 11.0.16
20
+ maven 3.8.6
21
+ anserini 0.14.3
22
+ faiss-cpu 1.7.2
23
+ pyserini 0.17.1
24
+ ```
25
+
26
+
27
+ ## Natural Questions
28
+
29
+ ### 1. Download raw data (Refer to [DPR](https://github.com/facebookresearch/DPR) for more details of the dataset)
30
+ ```shell
31
+ python download_DPR_data.py --resource data.wikipedia_split.psgs_w100
32
+ python download_DPR_data.py --resource data.retriever.nq
33
+ python download_DPR_data.py --resource data.retriever.qas.nq
34
+ mkdir -p raw && mv downloads raw/NQ
35
+ ```
36
+
37
+ ### 2. Convert collections to jsonl format for Pyserini
38
+ ```shell
39
+ python convert_NQ_collection_to_jsonl.py --collection-path raw/NQ/data/wikipedia_split/psgs_w100.tsv --output-folder pyserini/collections/NQ
40
+ ```
41
+
42
+ ### 3. Build Lucene indexes via Pyserini
43
+ ```shell
44
+ python -m pyserini.index.lucene \
45
+ --collection JsonCollection \
46
+ --input pyserini/collections/NQ \
47
+ --index pyserini/indexes/NQ \
48
+ --generator DefaultLuceneDocumentGenerator \
49
+ --threads 1 \
50
+ --storePositions --storeDocvectors --storeRaw
51
+ ```
52
+
53
+ ### 4. Generate data
54
+ ```shell
55
+ RETRIEVERS=("DPR-Multi" "DPR-Single" "ANCE" "FiD-KD" "RocketQA-retriever" "RocketQAv2-retriever" "RocketQA-reranker" "RocketQAv2-reranker")
56
+
57
+ for RETRIEVER in ${RETRIEVERS[@]}; do
58
+ python generate_NQ_data.py --retriever $RETRIEVER
59
+ done
60
+ ```
61
+ Note that before generate data for retriever `RocketQA*`, please generate the retrieval results following the instructions in `data/RocketQA_baselines/README.md`. Data for other retrievers can be generated directly.
62
+
63
+
64
+ ## MS MARCO & TREC 2019/2020
65
+
66
+ ### 1. Download raw data (Refer to [MS MARCO](https://microsoft.github.io/msmarco/) for more details of the dataset)
67
+ * Download and uncompress MSMARCO Passage Ranking Collections and Queries [collectionandqueries.tar.gz](https://msmarco.blob.core.windows.net/msmarcoranking/collectionandqueries.tar.gz) to `data/raw/MSMARCO/`
68
+ * TREC DL Test Queries and Qrels
69
+ * [TREC DL-2019](https://microsoft.github.io/msmarco/TREC-Deep-Learning-2019.html)
70
+ * Download and uncompress [msmarco-test2019-queries.tsv](https://msmarco.blob.core.windows.net/msmarcoranking/msmarco-test2019-queries.tsv.gz)
71
+ * Download [2019qrels-pass.txt](https://trec.nist.gov/data/deep/2019qrels-pass.txt)
72
+ * [TREC DL-2020](https://microsoft.github.io/msmarco/TREC-Deep-Learning-2020)
73
+ * Download and uncompress [msmarco-test2019-queries.tsv](https://msmarco.blob.core.windows.net/msmarcoranking/msmarco-test2020-queries.tsv.gz)
74
+ * Download [2019qrels-pass.txt](https://trec.nist.gov/data/deep/2020qrels-pass.txt)
75
+ * Put them into `data/raw/TRECDL/`
76
+
77
+ ### 2. Convert collections to jsonl format for Pyserini
78
+
79
+ ```shell
80
+ python convert_MSMARCO_collection_to_jsonl.py --collection-path raw/MSMARCO/collection.tsv --output-folder pyserini/collections/MSMARCO
81
+ ```
82
+
83
+ ### 3. Build Lucene indexes via Pyserini
84
+
85
+ ```shell
86
+ python -m pyserini.index.lucene \
87
+ --collection JsonCollection \
88
+ --input pyserini/collections/MSMARCO \
89
+ --index pyserini/indexes/MSMARCO \
90
+ --generator DefaultLuceneDocumentGenerator \
91
+ --threads 1 \
92
+ --storePositions --storeDocvectors --storeRaw
93
+ ```
94
+
95
+ ### 4. Generate data
96
+ ```shell
97
+ RETRIEVERS=("ANCE" "DistilBERT-KD" "TAS-B" "TCT-ColBERT-v1" "TCT-ColBERT-v2" "RocketQA-retriever" "RocketQAv2-retriever" "RocketQA-reranker" "RocketQAv2-reranker")
98
+
99
+ for RETRIEVER in ${RETRIEVERS[@]}; do
100
+ python generate_MSMARCO_data.py --retriever $RETRIEVER
101
+ done
102
+ ```
103
+
104
+ ```shell
105
+ RETRIEVERS=("ANCE" "DistilBERT-KD" "TAS-B" "TCT-ColBERT-v1" "TCT-ColBERT-v2" "RocketQA-retriever" "RocketQAv2-retriever" "RocketQA-reranker" "RocketQAv2-reranker")
106
+
107
+ SPLITS=("2019" "2020")
108
+
109
+ for RETRIEVER in ${RETRIEVERS[@]}; do
110
+ for SPLIT in ${SPLITS[@]}; do
111
+ python generate_TRECDL_data.py --split $SPLIT --retriever $RETRIEVER
112
+ done
113
+ done
114
+ ```