Commit
•
bb22054
0
Parent(s):
Update files from the datasets library (from 1.6.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.6.0
- .gitattributes +27 -0
- README.md +216 -0
- cbt.py +216 -0
- dataset_infos.json +1 -0
- dummy/CN/1.1.0/dummy_data.zip +3 -0
- dummy/NE/1.1.0/dummy_data.zip +3 -0
- dummy/P/1.1.0/dummy_data.zip +3 -0
- dummy/V/1.1.0/dummy_data.zip +3 -0
- dummy/raw/1.1.0/dummy_data.zip +3 -0
.gitattributes
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
20 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.xz 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
|
README.md
ADDED
@@ -0,0 +1,216 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- machine-generated
|
4 |
+
language_creators:
|
5 |
+
- found
|
6 |
+
languages:
|
7 |
+
- en
|
8 |
+
licenses:
|
9 |
+
- gfdl-1-3
|
10 |
+
multilinguality:
|
11 |
+
- monolingual
|
12 |
+
size_categories:
|
13 |
+
CN:
|
14 |
+
- 100K<n<1M
|
15 |
+
NE:
|
16 |
+
- 100K<n<1M
|
17 |
+
P:
|
18 |
+
- 100K<n<1M
|
19 |
+
V:
|
20 |
+
- 100K<n<1M
|
21 |
+
raw:
|
22 |
+
- n<1K
|
23 |
+
source_datasets:
|
24 |
+
- original
|
25 |
+
task_categories:
|
26 |
+
CN:
|
27 |
+
- question-answering
|
28 |
+
NE:
|
29 |
+
- question-answering
|
30 |
+
P:
|
31 |
+
- question-answering
|
32 |
+
V:
|
33 |
+
- question-answering
|
34 |
+
raw:
|
35 |
+
- other
|
36 |
+
task_ids:
|
37 |
+
CN:
|
38 |
+
- multiple-choice-qa
|
39 |
+
NE:
|
40 |
+
- multiple-choice-qa
|
41 |
+
P:
|
42 |
+
- multiple-choice-qa
|
43 |
+
V:
|
44 |
+
- multiple-choice-qa
|
45 |
+
raw:
|
46 |
+
- other-other-raw-dataset
|
47 |
+
---
|
48 |
+
|
49 |
+
# Dataset Card for CBT
|
50 |
+
|
51 |
+
## Table of Contents
|
52 |
+
- [Dataset Card for CBT](#dataset-card-for-dataset-name)
|
53 |
+
- [Table of Contents](#table-of-contents)
|
54 |
+
- [Dataset Description](#dataset-description)
|
55 |
+
- [Dataset Summary](#dataset-summary)
|
56 |
+
- [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
|
57 |
+
- [Languages](#languages)
|
58 |
+
- [Dataset Structure](#dataset-structure)
|
59 |
+
- [Data Instances](#data-instances)
|
60 |
+
- [Data Fields](#data-fields)
|
61 |
+
- [Data Splits](#data-splits)
|
62 |
+
- [Dataset Creation](#dataset-creation)
|
63 |
+
- [Curation Rationale](#curation-rationale)
|
64 |
+
- [Source Data](#source-data)
|
65 |
+
- [Initial Data Collection and Normalization](#initial-data-collection-and-normalization)
|
66 |
+
- [Who are the source language producers?](#who-are-the-source-language-producers)
|
67 |
+
- [Annotations](#annotations)
|
68 |
+
- [Annotation process](#annotation-process)
|
69 |
+
- [Who are the annotators?](#who-are-the-annotators)
|
70 |
+
- [Personal and Sensitive Information](#personal-and-sensitive-information)
|
71 |
+
- [Considerations for Using the Data](#considerations-for-using-the-data)
|
72 |
+
- [Social Impact of Dataset](#social-impact-of-dataset)
|
73 |
+
- [Discussion of Biases](#discussion-of-biases)
|
74 |
+
- [Other Known Limitations](#other-known-limitations)
|
75 |
+
- [Additional Information](#additional-information)
|
76 |
+
- [Dataset Curators](#dataset-curators)
|
77 |
+
- [Licensing Information](#licensing-information)
|
78 |
+
- [Citation Information](#citation-information)
|
79 |
+
- [Contributions](#contributions)
|
80 |
+
|
81 |
+
## Dataset Description
|
82 |
+
|
83 |
+
- **Homepage:**[The bAbI project](https://research.fb.com/downloads/babi/)
|
84 |
+
- **Repository:**
|
85 |
+
- **Paper:** [arXiv Paper](https://arxiv.org/pdf/1511.02301.pdf)
|
86 |
+
- **Leaderboard:**
|
87 |
+
- **Point of Contact:** [Felix Hill](mailto:felix.hill@cl.cam.ac.uk) or [Antoine Bordes](mailto:abordes@fb.com).
|
88 |
+
|
89 |
+
### Dataset Summary
|
90 |
+
|
91 |
+
The Children’s Book Test (CBT) is designed to measure directly how well language models can exploit wider linguistic context. The CBT is built from books that are freely available.
|
92 |
+
|
93 |
+
This dataset contains four different configurations:
|
94 |
+
|
95 |
+
- `V`: where the answers to the questions are verbs.
|
96 |
+
- `P`: where the answers to the questions are pronouns.
|
97 |
+
- `NE`: where the answers to the questions are named entities.
|
98 |
+
- `CN`: where the answers to the questions are common nouns.
|
99 |
+
|
100 |
+
### Supported Tasks and Leaderboards
|
101 |
+
|
102 |
+
[More Information Needed]
|
103 |
+
|
104 |
+
### Languages
|
105 |
+
|
106 |
+
The data is present in English language as written by authors Lucy Maud Montgomery, Charles Dickens,Andrew Lang, etc. in story books for children.
|
107 |
+
|
108 |
+
## Dataset Structure
|
109 |
+
|
110 |
+
### Data Instances
|
111 |
+
|
112 |
+
An instance from the `V` config:
|
113 |
+
```
|
114 |
+
{'answer': 'said', 'options': ['christening', 'existed', 'hear', 'knows', 'read', 'remarked', 'said', 'sitting', 'talking', 'wearing'], 'question': "`` They are very kind old ladies in their way , '' XXXXX the king ; `` and were nice to me when I was a boy . ''", 'sentences': ['This vexed the king even more than the queen , who was very clever and learned , and who had hated dolls when she was a child .', 'However , she , too in spite of all the books she read and all the pictures she painted , would have been glad enough to be the mother of a little prince .', 'The king was anxious to consult the fairies , but the queen would not hear of such a thing .', 'She did not believe in fairies : she said that they had never existed ; and that she maintained , though The History of the Royal Family was full of chapters about nothing else .', 'Well , at long and at last they had a little boy , who was generally regarded as the finest baby that had ever been seen .', 'Even her majesty herself remarked that , though she could never believe all the courtiers told her , yet he certainly was a fine child -- a very fine child .', 'Now , the time drew near for the christening party , and the king and queen were sitting at breakfast in their summer parlour talking over it .', 'It was a splendid room , hung with portraits of the royal ancestors .', 'There was Cinderella , the grandmother of the reigning monarch , with her little foot in her glass slipper thrust out before her .', 'There was the Marquis de Carabas , who , as everyone knows , was raised to the throne as prince consort after his marriage with the daughter of the king of the period .', 'On the arm of the throne was seated his celebrated cat , wearing boots .', 'There , too , was a portrait of a beautiful lady , sound asleep : this was Madame La Belle au Bois-dormant , also an ancestress of the royal family .', 'Many other pictures of celebrated persons were hanging on the walls .', "`` You have asked all the right people , my dear ? ''", 'said the king .', "`` Everyone who should be asked , '' answered the queen .", "`` People are so touchy on these occasions , '' said his majesty .", "`` You have not forgotten any of our aunts ? ''", "`` No ; the old cats ! ''", "replied the queen ; for the king 's aunts were old-fashioned , and did not approve of her , and she knew it ."]}
|
115 |
+
```
|
116 |
+
|
117 |
+
|
118 |
+
### Data Fields
|
119 |
+
|
120 |
+
For the `raw` config, the data fields are:
|
121 |
+
- `title`: a `string` feature containing the title of the book present in the dataset.
|
122 |
+
- `content`: a `string` feature containing the content of the book present in the dataset.
|
123 |
+
|
124 |
+
For all other configs, the data fields are:
|
125 |
+
- `sentences`: a `list` of `string` features containing 20 sentences from a book.
|
126 |
+
- `question`: a `string` feature containing a question with blank marked as `XXXX` which is to be filled with one of the options.
|
127 |
+
- `answer`: a `string` feature containing the answer.
|
128 |
+
- `options`: a `list` of `string` features containing the options for the question.
|
129 |
+
|
130 |
+
|
131 |
+
### Data Splits
|
132 |
+
|
133 |
+
The splits and corresponding sizes are:
|
134 |
+
|
135 |
+
| |train |test |validation|
|
136 |
+
|:--|------:|----:|---------:|
|
137 |
+
|raw|98 |5 |5 |
|
138 |
+
|V |105825 |2500 |2000 |
|
139 |
+
|P |334030 |2500 |2000 |
|
140 |
+
|CN |120769 |2500 |2000 |
|
141 |
+
|NE |108719 |2500 |2000 |
|
142 |
+
|
143 |
+
## Dataset Creation
|
144 |
+
|
145 |
+
### Curation Rationale
|
146 |
+
|
147 |
+
[More Information Needed]
|
148 |
+
|
149 |
+
### Source Data
|
150 |
+
|
151 |
+
#### Initial Data Collection and Normalization
|
152 |
+
|
153 |
+
[More Information Needed]
|
154 |
+
|
155 |
+
#### Who are the source language producers?
|
156 |
+
|
157 |
+
Children's Book Authors
|
158 |
+
|
159 |
+
### Annotations
|
160 |
+
|
161 |
+
#### Annotation process
|
162 |
+
|
163 |
+
From the [homepage](https://research.fb.com/downloads/babi/):
|
164 |
+
|
165 |
+
>After allocating books to either training, validation or test sets, we formed example ‘questions’ from chapters in the book by enumerating 21 consecutive sentences. In each question, the first 20 sentences form the context, and a word is removed from the 21st sentence, which becomes the query. Models must identify the answer word among a selection of 10 candidate answers appearing in the context sentences and the query. For finer-grained analyses, we evaluated four classes of question by removing distinct types of word: Named Entities, (Common) Nouns, Verbs and Prepositions.
|
166 |
+
|
167 |
+
#### Who are the annotators?
|
168 |
+
|
169 |
+
[More Information Needed]
|
170 |
+
|
171 |
+
### Personal and Sensitive Information
|
172 |
+
|
173 |
+
[More Information Needed]
|
174 |
+
|
175 |
+
## Considerations for Using the Data
|
176 |
+
|
177 |
+
### Social Impact of Dataset
|
178 |
+
|
179 |
+
[More Information Needed]
|
180 |
+
|
181 |
+
### Discussion of Biases
|
182 |
+
|
183 |
+
[More Information Needed]
|
184 |
+
|
185 |
+
### Other Known Limitations
|
186 |
+
|
187 |
+
[More Information Needed]
|
188 |
+
|
189 |
+
## Additional Information
|
190 |
+
|
191 |
+
### Dataset Curators
|
192 |
+
|
193 |
+
[More Information Needed]
|
194 |
+
|
195 |
+
### Licensing Information
|
196 |
+
|
197 |
+
```
|
198 |
+
GNU Free Documentation License v1.3
|
199 |
+
```
|
200 |
+
### Citation Information
|
201 |
+
|
202 |
+
```
|
203 |
+
@misc{hill2016goldilocks,
|
204 |
+
title={The Goldilocks Principle: Reading Children's Books with Explicit Memory Representations},
|
205 |
+
author={Felix Hill and Antoine Bordes and Sumit Chopra and Jason Weston},
|
206 |
+
year={2016},
|
207 |
+
eprint={1511.02301},
|
208 |
+
archivePrefix={arXiv},
|
209 |
+
primaryClass={cs.CL}
|
210 |
+
}
|
211 |
+
```
|
212 |
+
|
213 |
+
|
214 |
+
### Contributions
|
215 |
+
|
216 |
+
Thanks to [@gchhablani](https://github.com/gchhablani) for adding this dataset.
|
cbt.py
ADDED
@@ -0,0 +1,216 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
"""Children's Book Test Dataset."""
|
16 |
+
|
17 |
+
|
18 |
+
import os
|
19 |
+
|
20 |
+
import datasets
|
21 |
+
|
22 |
+
|
23 |
+
_CITATION = """\
|
24 |
+
@misc{hill2016goldilocks,
|
25 |
+
title={The Goldilocks Principle: Reading Children's Books with Explicit Memory Representations},
|
26 |
+
author={Felix Hill and Antoine Bordes and Sumit Chopra and Jason Weston},
|
27 |
+
year={2016},
|
28 |
+
eprint={1511.02301},
|
29 |
+
archivePrefix={arXiv},
|
30 |
+
primaryClass={cs.CL}
|
31 |
+
}
|
32 |
+
"""
|
33 |
+
|
34 |
+
|
35 |
+
_DESCRIPTION = """\
|
36 |
+
The Children’s Book Test (CBT) is designed to measure directly
|
37 |
+
how well language models can exploit wider linguistic context.
|
38 |
+
The CBT is built from books that are freely available.
|
39 |
+
"""
|
40 |
+
|
41 |
+
_HOMEPAGE = "https://research.fb.com/downloads/babi/"
|
42 |
+
|
43 |
+
_LICENSE = """GNU Free Documentation License v1.3"""
|
44 |
+
|
45 |
+
ZIP_URL = "http://www.thespermwhale.com/jaseweston/babi/CBTest.tgz"
|
46 |
+
dir = "CBTest/data/"
|
47 |
+
paths = {
|
48 |
+
"raw": {"train": dir + "cbt_train.txt", "valid": dir + "cbt_valid.txt", "test": dir + "cbt_test.txt"},
|
49 |
+
"V": {
|
50 |
+
"train": dir + "cbtest_V_train.txt",
|
51 |
+
"valid": dir + "cbtest_V_valid_2000ex.txt",
|
52 |
+
"test": dir + "cbtest_V_test_2500ex.txt",
|
53 |
+
},
|
54 |
+
"P": {
|
55 |
+
"train": dir + "cbtest_P_train.txt",
|
56 |
+
"valid": dir + "cbtest_P_valid_2000ex.txt",
|
57 |
+
"test": dir + "cbtest_P_test_2500ex.txt",
|
58 |
+
},
|
59 |
+
"NE": {
|
60 |
+
"train": dir + "cbtest_NE_train.txt",
|
61 |
+
"valid": dir + "cbtest_NE_valid_2000ex.txt",
|
62 |
+
"test": dir + "cbtest_NE_test_2500ex.txt",
|
63 |
+
},
|
64 |
+
"CN": {
|
65 |
+
"train": dir + "cbtest_CN_train.txt",
|
66 |
+
"valid": dir + "cbtest_CN_valid_2000ex.txt",
|
67 |
+
"test": dir + "cbtest_CN_test_2500ex.txt",
|
68 |
+
},
|
69 |
+
}
|
70 |
+
|
71 |
+
|
72 |
+
class Cbt(datasets.GeneratorBasedBuilder):
|
73 |
+
"""TODO: Short description of my dataset."""
|
74 |
+
|
75 |
+
VERSION = datasets.Version("1.1.0")
|
76 |
+
|
77 |
+
BUILDER_CONFIGS = [
|
78 |
+
datasets.BuilderConfig(
|
79 |
+
name="raw", version=VERSION, description="This part of my dataset covers the raw CBT books"
|
80 |
+
),
|
81 |
+
datasets.BuilderConfig(
|
82 |
+
name="V", version=VERSION, description="This part of my dataset covers the verb answer CBT dataset"
|
83 |
+
),
|
84 |
+
datasets.BuilderConfig(
|
85 |
+
name="P", version=VERSION, description="This part of my dataset covers the preposition answer CBT dataset"
|
86 |
+
),
|
87 |
+
datasets.BuilderConfig(
|
88 |
+
name="NE",
|
89 |
+
version=VERSION,
|
90 |
+
description="This part of my dataset covers the named entity answer CBT dataset",
|
91 |
+
),
|
92 |
+
datasets.BuilderConfig(
|
93 |
+
name="CN", version=VERSION, description="This part of my dataset covers the common noun answer CBT dataset"
|
94 |
+
),
|
95 |
+
]
|
96 |
+
|
97 |
+
def _info(self):
|
98 |
+
if self.config.name in ["V", "P", "NE", "CN"]:
|
99 |
+
features = datasets.Features(
|
100 |
+
{
|
101 |
+
"sentences": datasets.Sequence(datasets.Value("string")), # There are 20 sentences
|
102 |
+
"question": datasets.Value("string"),
|
103 |
+
"answer": datasets.Value("string"),
|
104 |
+
"options": datasets.Sequence(datasets.Value("string")),
|
105 |
+
}
|
106 |
+
)
|
107 |
+
else: # This is an example to show how to have different features for "first_domain" and "second_domain"
|
108 |
+
features = datasets.Features({"title": datasets.Value("string"), "content": datasets.Value("string")})
|
109 |
+
return datasets.DatasetInfo(
|
110 |
+
# This is the description that will appear on the datasets page.
|
111 |
+
description=_DESCRIPTION,
|
112 |
+
# This defines the different columns of the dataset and their types
|
113 |
+
features=features, # Here we define them above because they are different between the two configurations
|
114 |
+
# If there's a common (input, target) tuple from the features,
|
115 |
+
# specify them here. They'll be used if as_supervised=True in
|
116 |
+
# builder.as_dataset.
|
117 |
+
supervised_keys=None,
|
118 |
+
# Homepage of the dataset for documentation
|
119 |
+
homepage=_HOMEPAGE,
|
120 |
+
# License for the dataset if available
|
121 |
+
license=_LICENSE,
|
122 |
+
# Citation for the dataset
|
123 |
+
citation=_CITATION,
|
124 |
+
)
|
125 |
+
|
126 |
+
def _split_generators(self, dl_manager):
|
127 |
+
"""Returns SplitGenerators."""
|
128 |
+
my_urls = ZIP_URL # Cannot download just one single type as it is a compressed file.
|
129 |
+
data_dir = dl_manager.download_and_extract(my_urls)
|
130 |
+
return [
|
131 |
+
datasets.SplitGenerator(
|
132 |
+
name=datasets.Split.TRAIN,
|
133 |
+
# These kwargs will be passed to _generate_examples
|
134 |
+
gen_kwargs={
|
135 |
+
"filepath": os.path.join(data_dir, paths[self.config.name]["train"]),
|
136 |
+
},
|
137 |
+
),
|
138 |
+
datasets.SplitGenerator(
|
139 |
+
name=datasets.Split.TEST,
|
140 |
+
# These kwargs will be passed to _generate_examples
|
141 |
+
gen_kwargs={
|
142 |
+
"filepath": os.path.join(data_dir, paths[self.config.name]["test"]),
|
143 |
+
},
|
144 |
+
),
|
145 |
+
datasets.SplitGenerator(
|
146 |
+
name=datasets.Split.VALIDATION,
|
147 |
+
# These kwargs will be passed to _generate_examples
|
148 |
+
gen_kwargs={
|
149 |
+
"filepath": os.path.join(data_dir, paths[self.config.name]["valid"]),
|
150 |
+
},
|
151 |
+
),
|
152 |
+
]
|
153 |
+
|
154 |
+
def _generate_examples(
|
155 |
+
self, filepath # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
156 |
+
):
|
157 |
+
""" Yields examples as (key, example) tuples. """
|
158 |
+
# This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
159 |
+
# The `key` is here for legacy reason (tfds) and is not important in itself.
|
160 |
+
|
161 |
+
if self.config.name != "raw":
|
162 |
+
with open(filepath, encoding="utf-8") as f:
|
163 |
+
sentences = []
|
164 |
+
example_idx = 0
|
165 |
+
for idx, line in enumerate(f):
|
166 |
+
if line.strip() == "":
|
167 |
+
continue
|
168 |
+
|
169 |
+
elif line.split()[0] == "21":
|
170 |
+
splitline = line.split("\t") # question, answer options are tab separated
|
171 |
+
question = splitline[0]
|
172 |
+
answer = splitline[1]
|
173 |
+
options = splitline[-1]
|
174 |
+
question = question[2:].strip() # The first two indices contain `21`.
|
175 |
+
answer = answer.strip()
|
176 |
+
options = options.strip().split("|")
|
177 |
+
yield example_idx, {
|
178 |
+
"sentences": sentences,
|
179 |
+
"question": question,
|
180 |
+
"options": options,
|
181 |
+
"answer": answer,
|
182 |
+
}
|
183 |
+
|
184 |
+
sentences = []
|
185 |
+
example_idx += 1
|
186 |
+
else:
|
187 |
+
if len(line.split()[0]) == 1:
|
188 |
+
sentences.append(line[1:].strip())
|
189 |
+
else:
|
190 |
+
sentences.append(line[2:].strip())
|
191 |
+
# Text might contain double spaces.
|
192 |
+
else:
|
193 |
+
with open(filepath, encoding="utf=8") as f:
|
194 |
+
book_idx = 0
|
195 |
+
book_sentences = []
|
196 |
+
for idx, line in enumerate(f):
|
197 |
+
if line[:12] == "_BOOK_TITLE_":
|
198 |
+
if idx == 0: # First line:
|
199 |
+
title = line.split(":")[1].strip()
|
200 |
+
else:
|
201 |
+
yield book_idx, {
|
202 |
+
"title": title,
|
203 |
+
"content": "".join(book_sentences),
|
204 |
+
}
|
205 |
+
title = line.split(":")[1].strip()
|
206 |
+
book_sentences = []
|
207 |
+
book_idx += 1
|
208 |
+
else:
|
209 |
+
book_sentences.append(line)
|
210 |
+
else:
|
211 |
+
yield book_idx, {
|
212 |
+
"title": title,
|
213 |
+
"content": "".join(book_sentences),
|
214 |
+
}
|
215 |
+
book_sentences = []
|
216 |
+
book_idx += 1
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"raw": {"description": "The Children\u2019s Book Test (CBT) is designed to measure directly\nhow well language models can exploit wider linguistic context.\nThe CBT is built from books that are freely available.\n", "citation": "@misc{hill2016goldilocks,\n title={The Goldilocks Principle: Reading Children's Books with Explicit Memory Representations},\n author={Felix Hill and Antoine Bordes and Sumit Chopra and Jason Weston},\n year={2016},\n eprint={1511.02301},\n archivePrefix={arXiv},\n primaryClass={cs.CL}\n}\n", "homepage": "https://research.fb.com/downloads/babi/", "license": "GNU Free Documentation License v1.3", "features": {"title": {"dtype": "string", "id": null, "_type": "Value"}, "content": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "builder_name": "cbt", "config_name": "raw", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 25741588, "num_examples": 98, "dataset_name": "cbt"}, "test": {"name": "test", "num_bytes": 1528712, "num_examples": 5, "dataset_name": "cbt"}, "validation": {"name": "validation", "num_bytes": 1182665, "num_examples": 5, "dataset_name": "cbt"}}, "download_checksums": {"http://www.thespermwhale.com/jaseweston/babi/CBTest.tgz": {"num_bytes": 120547669, "checksum": "932df0cadc1337b2a12b4c696b1041c1d1c6d4b6bd319874c6288f02e4a61e92"}}, "download_size": 120547669, "post_processing_size": null, "dataset_size": 28452965, "size_in_bytes": 149000634}, "V": {"description": "The Children\u2019s Book Test (CBT) is designed to measure directly\nhow well language models can exploit wider linguistic context.\nThe CBT is built from books that are freely available.\n", "citation": "@misc{hill2016goldilocks,\n title={The Goldilocks Principle: Reading Children's Books with Explicit Memory Representations},\n author={Felix Hill and Antoine Bordes and Sumit Chopra and Jason Weston},\n year={2016},\n eprint={1511.02301},\n archivePrefix={arXiv},\n primaryClass={cs.CL}\n}\n", "homepage": "https://research.fb.com/downloads/babi/", "license": "GNU Free Documentation License v1.3", "features": {"sentences": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "answer": {"dtype": "string", "id": null, "_type": "Value"}, "options": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "cbt", "config_name": "V", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 252177913, "num_examples": 105825, "dataset_name": "cbt"}, "test": {"name": "test", "num_bytes": 5806649, "num_examples": 2500, "dataset_name": "cbt"}, "validation": {"name": "validation", "num_bytes": 4556449, "num_examples": 2000, "dataset_name": "cbt"}}, "download_checksums": {"http://www.thespermwhale.com/jaseweston/babi/CBTest.tgz": {"num_bytes": 120547669, "checksum": "932df0cadc1337b2a12b4c696b1041c1d1c6d4b6bd319874c6288f02e4a61e92"}}, "download_size": 120547669, "post_processing_size": null, "dataset_size": 262541011, "size_in_bytes": 383088680}, "P": {"description": "The Children\u2019s Book Test (CBT) is designed to measure directly\nhow well language models can exploit wider linguistic context.\nThe CBT is built from books that are freely available.\n", "citation": "@misc{hill2016goldilocks,\n title={The Goldilocks Principle: Reading Children's Books with Explicit Memory Representations},\n author={Felix Hill and Antoine Bordes and Sumit Chopra and Jason Weston},\n year={2016},\n eprint={1511.02301},\n archivePrefix={arXiv},\n primaryClass={cs.CL}\n}\n", "homepage": "https://research.fb.com/downloads/babi/", "license": "GNU Free Documentation License v1.3", "features": {"sentences": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "answer": {"dtype": "string", "id": null, "_type": "Value"}, "options": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "cbt", "config_name": "P", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 852853417, "num_examples": 334030, "dataset_name": "cbt"}, "test": {"name": "test", "num_bytes": 6078072, "num_examples": 2500, "dataset_name": "cbt"}, "validation": {"name": "validation", "num_bytes": 4777005, "num_examples": 2000, "dataset_name": "cbt"}}, "download_checksums": {"http://www.thespermwhale.com/jaseweston/babi/CBTest.tgz": {"num_bytes": 120547669, "checksum": "932df0cadc1337b2a12b4c696b1041c1d1c6d4b6bd319874c6288f02e4a61e92"}}, "download_size": 120547669, "post_processing_size": null, "dataset_size": 863708494, "size_in_bytes": 984256163}, "NE": {"description": "The Children\u2019s Book Test (CBT) is designed to measure directly\nhow well language models can exploit wider linguistic context.\nThe CBT is built from books that are freely available.\n", "citation": "@misc{hill2016goldilocks,\n title={The Goldilocks Principle: Reading Children's Books with Explicit Memory Representations},\n author={Felix Hill and Antoine Bordes and Sumit Chopra and Jason Weston},\n year={2016},\n eprint={1511.02301},\n archivePrefix={arXiv},\n primaryClass={cs.CL}\n}\n", "homepage": "https://research.fb.com/downloads/babi/", "license": "GNU Free Documentation License v1.3", "features": {"sentences": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "answer": {"dtype": "string", "id": null, "_type": "Value"}, "options": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "cbt", "config_name": "NE", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 253552195, "num_examples": 108719, "dataset_name": "cbt"}, "test": {"name": "test", "num_bytes": 5707758, "num_examples": 2500, "dataset_name": "cbt"}, "validation": {"name": "validation", "num_bytes": 4424340, "num_examples": 2000, "dataset_name": "cbt"}}, "download_checksums": {"http://www.thespermwhale.com/jaseweston/babi/CBTest.tgz": {"num_bytes": 120547669, "checksum": "932df0cadc1337b2a12b4c696b1041c1d1c6d4b6bd319874c6288f02e4a61e92"}}, "download_size": 120547669, "post_processing_size": null, "dataset_size": 263684293, "size_in_bytes": 384231962}, "CN": {"description": "The Children\u2019s Book Test (CBT) is designed to measure directly\nhow well language models can exploit wider linguistic context.\nThe CBT is built from books that are freely available.\n", "citation": "@misc{hill2016goldilocks,\n title={The Goldilocks Principle: Reading Children's Books with Explicit Memory Representations},\n author={Felix Hill and Antoine Bordes and Sumit Chopra and Jason Weston},\n year={2016},\n eprint={1511.02301},\n archivePrefix={arXiv},\n primaryClass={cs.CL}\n}\n", "homepage": "https://research.fb.com/downloads/babi/", "license": "GNU Free Documentation License v1.3", "features": {"sentences": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "answer": {"dtype": "string", "id": null, "_type": "Value"}, "options": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "cbt", "config_name": "CN", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 301730463, "num_examples": 120769, "dataset_name": "cbt"}, "test": {"name": "test", "num_bytes": 6138400, "num_examples": 2500, "dataset_name": "cbt"}, "validation": {"name": "validation", "num_bytes": 4737281, "num_examples": 2000, "dataset_name": "cbt"}}, "download_checksums": {"http://www.thespermwhale.com/jaseweston/babi/CBTest.tgz": {"num_bytes": 120547669, "checksum": "932df0cadc1337b2a12b4c696b1041c1d1c6d4b6bd319874c6288f02e4a61e92"}}, "download_size": 120547669, "post_processing_size": null, "dataset_size": 312606144, "size_in_bytes": 433153813}}
|
dummy/CN/1.1.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9797f7bc532ec7494300dc7b92d444866f2904c87928d7844f63d1ab18a098fe
|
3 |
+
size 4652
|
dummy/NE/1.1.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d28d14085b8b726f936106d61d9176e4c25ad602102455e4adb7cc5dcfc7781c
|
3 |
+
size 4889
|
dummy/P/1.1.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5570ef99e6853712b6c7be6b10f1805fd63acb96d72d087ffd593593a49f4128
|
3 |
+
size 4686
|
dummy/V/1.1.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0e4b619ef003206f333bda1402ce56a450e85c7a9c7d35b0277abd77efac0a3f
|
3 |
+
size 4544
|
dummy/raw/1.1.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:83450d56e14ac7c45aa39d8aae80a454c0150b98278a29f3e82f15d2a49672fb
|
3 |
+
size 3106
|