Xinyu Crystina ZHANG commited on
Commit
b826199
1 Parent(s): 7b7082a
.gitattributes CHANGED
@@ -25,3 +25,35 @@ 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
+ mrtydi-v1.1-bengali/test.jsonl.gz filter=lfs diff=lfs merge=lfs -text
29
+ mrtydi-v1.1-finnish/dev.jsonl.gz filter=lfs diff=lfs merge=lfs -text
30
+ mrtydi-v1.1-japanese/test.jsonl.gz filter=lfs diff=lfs merge=lfs -text
31
+ mrtydi-v1.1-korean/test.jsonl.gz filter=lfs diff=lfs merge=lfs -text
32
+ mrtydi-v1.1-russian/test.jsonl.gz filter=lfs diff=lfs merge=lfs -text
33
+ mrtydi-v1.1-thai/train.jsonl.gz filter=lfs diff=lfs merge=lfs -text
34
+ mrtydi-v1.1-arabic/dev.jsonl.gz filter=lfs diff=lfs merge=lfs -text
35
+ mrtydi-v1.1-bengali/train.jsonl.gz filter=lfs diff=lfs merge=lfs -text
36
+ mrtydi-v1.1-russian/dev.jsonl.gz filter=lfs diff=lfs merge=lfs -text
37
+ mrtydi-v1.1-thai/test.jsonl.gz filter=lfs diff=lfs merge=lfs -text
38
+ mrtydi-v1.1-indonesian/dev.jsonl.gz filter=lfs diff=lfs merge=lfs -text
39
+ mrtydi-v1.1-indonesian/test.jsonl.gz filter=lfs diff=lfs merge=lfs -text
40
+ mrtydi-v1.1-indonesian/train.jsonl.gz filter=lfs diff=lfs merge=lfs -text
41
+ mrtydi-v1.1-russian/train.jsonl.gz filter=lfs diff=lfs merge=lfs -text
42
+ mrtydi-v1.1-telugu/test.jsonl.gz filter=lfs diff=lfs merge=lfs -text
43
+ mrtydi-v1.1-telugu/train.jsonl.gz filter=lfs diff=lfs merge=lfs -text
44
+ mrtydi-v1.1-english/dev.jsonl.gz filter=lfs diff=lfs merge=lfs -text
45
+ mrtydi-v1.1-finnish/train.jsonl.gz filter=lfs diff=lfs merge=lfs -text
46
+ mrtydi-v1.1-japanese/dev.jsonl.gz filter=lfs diff=lfs merge=lfs -text
47
+ mrtydi-v1.1-korean/dev.jsonl.gz filter=lfs diff=lfs merge=lfs -text
48
+ mrtydi-v1.1-korean/train.jsonl.gz filter=lfs diff=lfs merge=lfs -text
49
+ mrtydi-v1.1-english/train.jsonl.gz filter=lfs diff=lfs merge=lfs -text
50
+ mrtydi-v1.1-japanese/train.jsonl.gz filter=lfs diff=lfs merge=lfs -text
51
+ mrtydi-v1.1-arabic/test.jsonl.gz filter=lfs diff=lfs merge=lfs -text
52
+ mrtydi-v1.1-bengali/dev.jsonl.gz filter=lfs diff=lfs merge=lfs -text
53
+ mrtydi-v1.1-english/test.jsonl.gz filter=lfs diff=lfs merge=lfs -text
54
+ mrtydi-v1.1-swahili/test.jsonl.gz filter=lfs diff=lfs merge=lfs -text
55
+ mrtydi-v1.1-swahili/train.jsonl.gz filter=lfs diff=lfs merge=lfs -text
56
+ mrtydi-v1.1-telugu/dev.jsonl.gz filter=lfs diff=lfs merge=lfs -text
57
+ mrtydi-v1.1-finnish/test.jsonl.gz filter=lfs diff=lfs merge=lfs -text
58
+ mrtydi-v1.1-swahili/dev.jsonl.gz filter=lfs diff=lfs merge=lfs -text
59
+ mrtydi-v1.1-thai/dev.jsonl.gz filter=lfs diff=lfs merge=lfs -text
mr-tydi.py ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
16
+ # Lint as: python3
17
+
18
+ import json
19
+
20
+ import datasets
21
+ from dataclasses import dataclass
22
+
23
+ _CITATION = '''
24
+ @article{mrtydi,
25
+ title={{Mr. TyDi}: A Multi-lingual Benchmark for Dense Retrieval},
26
+ author={Xinyu Zhang and Xueguang Ma and Peng Shi and Jimmy Lin},
27
+ year={2021},
28
+ journal={arXiv:2108.08787},
29
+ }
30
+ '''
31
+
32
+ languages = [
33
+ 'arabic',
34
+ 'bengali',
35
+ 'english',
36
+ 'indonesian',
37
+ 'finnish',
38
+ 'korean',
39
+ 'russian',
40
+ 'swahili',
41
+ 'telugu',
42
+ 'thai',
43
+ 'japanese',
44
+ 'combined',
45
+ ]
46
+
47
+ _DESCRIPTION = 'dataset load script for Mr. TyDi'
48
+
49
+ _DATASET_URLS = {
50
+ lang: {
51
+ 'train': f'https://huggingface.co/datasets/castorini/mr-tydi/resolve/main/mrtydi-v1.1-{lang}/train.jsonl.gz',
52
+ 'dev': f'https://huggingface.co/datasets/castorini/mr-tydi/resolve/main/mrtydi-v1.1-{lang}/dev.jsonl.gz',
53
+ 'test': f'https://huggingface.co/datasets/castorini/mr-tydi/resolve/main/mrtydi-v1.1-{lang}/test.jsonl.gz',
54
+ } for lang in languages
55
+ }
56
+
57
+ _DATASET_URLS['combined'] = {
58
+ 'train': "https://huggingface.co/datasets/castorini/mr-tydi/resolve/main/mrtydi-v1.1-combined/train.jsonl.gz"
59
+ }
60
+
61
+
62
+ class MrTyDi(datasets.GeneratorBasedBuilder):
63
+ BUILDER_CONFIGS = [datasets.BuilderConfig(
64
+ version=datasets.Version('1.1.0'),
65
+ name=lang, description=f'Mr TyDi dataset in language {lang}.'
66
+ ) for lang in languages
67
+ ]
68
+
69
+ def _info(self):
70
+ features = datasets.Features({
71
+ 'query_id': datasets.Value('string'),
72
+ 'query': datasets.Value('string'),
73
+
74
+ 'positive_passages': [{
75
+ 'docid': datasets.Value('string'),
76
+ 'text': datasets.Value('string'), 'title': datasets.Value('string')
77
+ }],
78
+ 'negative_passages': [{
79
+ 'docid': datasets.Value('string'),
80
+ 'text': datasets.Value('string'), 'title': datasets.Value('string'),
81
+ }],
82
+ })
83
+
84
+ return datasets.DatasetInfo(
85
+ # This is the description that will appear on the datasets page.
86
+ description=_DESCRIPTION,
87
+ # This defines the different columns of the dataset and their types
88
+ features=features, # Here we define them above because they are different between the two configurations
89
+ supervised_keys=None,
90
+ # Homepage of the dataset for documentation
91
+ homepage='https://github.com/castorini/mr.tydi',
92
+ # License for the dataset if available
93
+ license='',
94
+ # Citation for the dataset
95
+ citation=_CITATION,
96
+ )
97
+
98
+ def _split_generators(self, dl_manager):
99
+ lang = self.config.name
100
+ downloaded_files = dl_manager.download_and_extract(_DATASET_URLS[lang])
101
+
102
+ if lang != "combined":
103
+ splits = [
104
+ datasets.SplitGenerator(
105
+ name='train',
106
+ gen_kwargs={
107
+ 'filepath': downloaded_files['train'],
108
+ },
109
+ ),
110
+ datasets.SplitGenerator(
111
+ name='dev',
112
+ gen_kwargs={
113
+ 'filepath': downloaded_files['dev'],
114
+ },
115
+ ),
116
+ datasets.SplitGenerator(
117
+ name='test',
118
+ gen_kwargs={
119
+ 'filepath': downloaded_files['test'],
120
+ },
121
+ ),
122
+ ]
123
+ else:
124
+ splits = [
125
+ datasets.SplitGenerator(
126
+ name='train',
127
+ gen_kwargs={
128
+ 'filepath': downloaded_files['train'],
129
+ },
130
+ ),
131
+ ]
132
+ return splits
133
+
134
+ def _generate_examples(self, filepath):
135
+ with open(filepath) as f:
136
+ for i, line in enumerate(f):
137
+ data = json.loads(line)
138
+ for feature in ['negative_passages', 'positive_passages']:
139
+ if data.get(feature) is None:
140
+ data[feature] = []
141
+
142
+ yield data['query_id'], data
mrtydi-v1.1-arabic/dev.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1990a389c996750c9399ba312204822a4c5ec9686fb54926fa60a11d68f45401
3
+ size 62790
mrtydi-v1.1-arabic/test.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:db3d3e6608f1b6e6616990bb074650ab8a6837f3b7b97aadf84e7d9e0035f4d0
3
+ size 22183
mrtydi-v1.1-bengali/dev.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c849639f55f67a3f7f620468752c271c9100342d94693c4e2665a62e002bb6fc
3
+ size 13104
mrtydi-v1.1-bengali/test.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0dbe79afda00c385dc5e70c7a4a460f794f3cf89c606335f10944acb3dec0fd3
3
+ size 3715
mrtydi-v1.1-bengali/train.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8c45a654969d45724a38ca82867a27301e9a101d16b4bd7d77c70e1145de47f4
3
+ size 16689769
mrtydi-v1.1-english/dev.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d70fc9a7d106c3eee4d9bd5531cd245fb403f85be81b9157df2d1348b93c0c78
3
+ size 18374
mrtydi-v1.1-english/test.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:236cd5e9dfbb124acb4145871f3ae29c2a5403207d6e5d606c031e69696146c2
3
+ size 15222
mrtydi-v1.1-english/train.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9455b9c7773dc72e1a194bbe5db524535a34f18c23cf4e6ae4bae87b10da8f54
3
+ size 26707376
mrtydi-v1.1-finnish/dev.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e84ca2e33deb1dbe05e283d7d2d1e1b83a8dbd3b33344c6bdfaa6b64a69b207f
3
+ size 35876
mrtydi-v1.1-finnish/test.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5cd7ea5545ec5df5de109fd498d1ea32cf874b9613949327e4aecc56cdefb5c3
3
+ size 23121
mrtydi-v1.1-finnish/train.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:675d66447933d85a9629ae96567584f9297d2c32eef9532560b9c338bc37b434
3
+ size 39309551
mrtydi-v1.1-indonesian/dev.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f142abcb2e639f452c33809fa99df9cf3b27314cf8a1b8e11c96c08d874db919
3
+ size 22295
mrtydi-v1.1-indonesian/test.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:93e770d1ed15518c3be73466f3182d0da03e1ccfcd146543f942221a742ac3ef
3
+ size 16362
mrtydi-v1.1-indonesian/train.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c0c20593b16d79004f5ec3347bca28348d950a98586a846006796281e2cc509e
3
+ size 32884869
mrtydi-v1.1-japanese/dev.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8a00dead8965cf40d1c2e7f6817b510c52bdd0b11ea29f61160a4587a3bc0709
3
+ size 21941
mrtydi-v1.1-japanese/test.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:38860a2a6cfebf2e5a995d589dff90f7da125bf736ec6209097f4c404d58e6bc
3
+ size 17021
mrtydi-v1.1-japanese/train.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b53fcc18f304b865ce6fcddf52f1da3659b32b1f2f634b8c25429f774be19c96
3
+ size 32730266
mrtydi-v1.1-korean/dev.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:972f1b3b95fbfc42251cc10ab5e94a996cb1d3aa895168cf85933ebcda2bdc29
3
+ size 7743
mrtydi-v1.1-korean/test.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:129c34042f41aaf38b99b6170578d18f319b5500951b1add06b7030f23f5d338
3
+ size 10392
mrtydi-v1.1-korean/train.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f17d615201361fb7d5e16fac9bee0b5796d86716030c567860ed4a0f2c59fbe5
3
+ size 10309583
mrtydi-v1.1-russian/dev.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d49b26fe20eebf5906d29d4ac348479036f8a5d68aaaa4a53e0c08bec823ee4f
3
+ size 39450
mrtydi-v1.1-russian/test.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aa94c915c06d6dfc174b853cb1b69b1c90db3c3a955b1f2f3a80bea2a83f4a7f
3
+ size 30077
mrtydi-v1.1-russian/train.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c024e8420f46b919c09a8b6e530195721ebd32ec55ee1ae031fa764e671bf0cc
3
+ size 53952260
mrtydi-v1.1-swahili/dev.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9024a980ddb52c8284b47ae7d6a66e25e5dfb5fa1462fd191d8e2a7102cdeb1c
3
+ size 9124
mrtydi-v1.1-swahili/test.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3adb57a6bb591c703d2bfb61f2347c6e12f3919cac2a5e98bd71bb3778877b47
3
+ size 11574
mrtydi-v1.1-swahili/train.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:89dba46180b0e41261fc411e6210833c01921ae64c0cad4cd26267a723a56b45
3
+ size 8029253
mrtydi-v1.1-telugu/dev.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:02755a71f8b9c56246710e4e8b4527356a55fbc7422429dc8f5a1f79705a366c
3
+ size 21321
mrtydi-v1.1-telugu/test.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0c87ea60cb067ab7c6859048941a5b48fe0279c899056e35842f5f9881251266
3
+ size 12737
mrtydi-v1.1-telugu/train.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3811fbff0601bfba329351f5d0d882aaab4fe8f30291f95dd9c8b780265addb2
3
+ size 42490161
mrtydi-v1.1-thai/dev.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4f2a47424e41ddd77288ad10edb16840d3d8fda2813e12316b23741e6fb871cf
3
+ size 24576
mrtydi-v1.1-thai/test.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c16a6ec157180f8a9bcb03af6cb7e6ef029963b59afa909964a3844bdda53f01
3
+ size 36224
mrtydi-v1.1-thai/train.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c5205e24b6030ae195257942d1ef5435a643b39a5f2cf281028a6ff756cb383e
3
+ size 32497884