Xueguang Ma commited on
Commit
7b4d995
1 Parent(s): 72b710a
.gitattributes CHANGED
@@ -25,3 +25,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
25
  *.zip filter=lfs diff=lfs merge=lfs -text
26
  *.zstandard filter=lfs diff=lfs merge=lfs -text
27
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
25
  *.zip filter=lfs diff=lfs merge=lfs -text
26
  *.zstandard filter=lfs diff=lfs merge=lfs -text
27
  *tfevents* filter=lfs diff=lfs merge=lfs -text
28
+ curated-dev.jsonl.gz filter=lfs diff=lfs merge=lfs -text
29
+ curated-test.jsonl.gz filter=lfs diff=lfs merge=lfs -text
30
+ curated-train.jsonl.gz filter=lfs diff=lfs merge=lfs -text
curated-dev.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:72b22304c1e06b9d3ca21e61b86ab6028393ac5e37ec90ad0e097129b9c16818
3
+ size 2573187
curated-test.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ca0874f2c6899f5b38e560d9d08af76fca4c99c6f3f78eebe9c8246c4b5e9084
3
+ size 30286
curated-train.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d57c2fd45ea20a0256aeebb785b0add5145b078e5145212e9a7499e8a896b618
3
+ size 24551211
wikipedia-curated.py ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ # Lint as: python3
16
+ """Wikipedia CuratedTREC dataset."""
17
+ import json
18
+ import datasets
19
+ _CITATION = """
20
+ @inproceedings{karpukhin-etal-2020-dense,
21
+ title = "Dense Passage Retrieval for Open-Domain Question Answering",
22
+ author = "Karpukhin, Vladimir and Oguz, Barlas and Min, Sewon and Lewis, Patrick and Wu, Ledell and Edunov,
23
+ Sergey and Chen, Danqi and Yih, Wen-tau",
24
+ booktitle = "Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP)",
25
+ month = nov,
26
+ year = "2020",
27
+ address = "Online",
28
+ publisher = "Association for Computational Linguistics",
29
+ url = "https://www.aclweb.org/anthology/2020.emnlp-main.550",
30
+ doi = "10.18653/v1/2020.emnlp-main.550",
31
+ pages = "6769--6781",
32
+ }
33
+ """
34
+ _DESCRIPTION = "dataset load script for Wikipedia CuratedTREC"
35
+ _DATASET_URLS = {
36
+ 'train': "https://huggingface.co/datasets/Tevatron/wikipedia-curated/resolve/main/curated-train.jsonl.gz",
37
+ 'dev': "https://huggingface.co/datasets/Tevatron/wikipedia-curated/resolve/main/curated-dev.jsonl.gz",
38
+ 'test': "https://huggingface.co/datasets/Tevatron/wikipedia-curated/resolve/main/curated-test.jsonl.gz",
39
+ }
40
+
41
+
42
+ class WikipediaCurated(datasets.GeneratorBasedBuilder):
43
+ VERSION = datasets.Version("0.0.1")
44
+ BUILDER_CONFIGS = [
45
+ datasets.BuilderConfig(version=VERSION,
46
+ description="Wikipedia CuratedTREC train/dev/test datasets"),
47
+ ]
48
+
49
+ def _info(self):
50
+ features = datasets.Features({
51
+ 'query_id': datasets.Value('string'),
52
+ 'query': datasets.Value('string'),
53
+ 'answers': [datasets.Value('string')],
54
+ 'positive_passages': [
55
+ {'docid': datasets.Value('string'), 'text': datasets.Value('string'),
56
+ 'title': datasets.Value('string')}
57
+ ],
58
+ 'negative_passages': [
59
+ {'docid': datasets.Value('string'), 'text': datasets.Value('string'),
60
+ 'title': datasets.Value('string')}
61
+ ],
62
+ })
63
+ return datasets.DatasetInfo(
64
+ # This is the description that will appear on the datasets page.
65
+ description=_DESCRIPTION,
66
+ # This defines the different columns of the dataset and their types
67
+ features=features, # Here we define them above because they are different between the two configurations
68
+ supervised_keys=None,
69
+ # Homepage of the dataset for documentation
70
+ homepage="",
71
+ # License for the dataset if available
72
+ license="",
73
+ # Citation for the dataset
74
+ citation=_CITATION,
75
+ )
76
+
77
+ def _split_generators(self, dl_manager):
78
+ downloaded_files = dl_manager.download_and_extract(_DATASET_URLS)
79
+ splits = [
80
+ datasets.SplitGenerator(
81
+ name="train",
82
+ gen_kwargs={
83
+ "filepath": downloaded_files["train"],
84
+ },
85
+ ),
86
+ datasets.SplitGenerator(
87
+ name='dev',
88
+ gen_kwargs={
89
+ "filepath": downloaded_files["dev"],
90
+ },
91
+ ),
92
+ datasets.SplitGenerator(
93
+ name='test',
94
+ gen_kwargs={
95
+ "filepath": downloaded_files["test"],
96
+ },
97
+ ),
98
+ ]
99
+ return splits
100
+
101
+ def _generate_examples(self, filepath):
102
+ """Yields examples."""
103
+ with open(filepath, encoding="utf-8") as f:
104
+ for line in f:
105
+ data = json.loads(line)
106
+ if data.get('negative_passages') is None:
107
+ data['negative_passages'] = []
108
+ if data.get('positive_passages') is None:
109
+ data['positive_passages'] = []
110
+ if data.get('answers') is None:
111
+ data['answers'] = []
112
+ yield data['query_id'], data