tarekziade
commited on
Commit
•
f2cd704
1
Parent(s):
55a16f5
fixed output
Browse files- test/data-00000-of-00001.arrow +2 -2
- test/dataset_info.json +22 -1
- test/state.json +2 -2
- train/data-00000-of-00001.arrow +2 -2
- train/dataset_info.json +22 -1
- train/state.json +2 -2
- wikiextract.py +5 -7
test/data-00000-of-00001.arrow
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4b603d6459cfe4d38a0fa0fe32ef5afc97cd909bd5df52762d7e6050f4ba72a2
|
3 |
+
size 487136
|
test/dataset_info.json
CHANGED
@@ -1,6 +1,12 @@
|
|
1 |
{
|
|
|
2 |
"citation": "",
|
|
|
|
|
|
|
3 |
"description": "",
|
|
|
|
|
4 |
"features": {
|
5 |
"title": {
|
6 |
"dtype": "string",
|
@@ -20,5 +26,20 @@
|
|
20 |
}
|
21 |
},
|
22 |
"homepage": "",
|
23 |
-
"license": ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
}
|
|
|
1 |
{
|
2 |
+
"builder_name": "generator",
|
3 |
"citation": "",
|
4 |
+
"config_name": "default",
|
5 |
+
"dataset_name": "generator",
|
6 |
+
"dataset_size": 4829573,
|
7 |
"description": "",
|
8 |
+
"download_checksums": {},
|
9 |
+
"download_size": 0,
|
10 |
"features": {
|
11 |
"title": {
|
12 |
"dtype": "string",
|
|
|
26 |
}
|
27 |
},
|
28 |
"homepage": "",
|
29 |
+
"license": "",
|
30 |
+
"size_in_bytes": 4829573,
|
31 |
+
"splits": {
|
32 |
+
"train": {
|
33 |
+
"name": "train",
|
34 |
+
"num_bytes": 4829573,
|
35 |
+
"num_examples": 8000,
|
36 |
+
"dataset_name": "generator"
|
37 |
+
}
|
38 |
+
},
|
39 |
+
"version": {
|
40 |
+
"version_str": "0.0.0",
|
41 |
+
"major": 0,
|
42 |
+
"minor": 0,
|
43 |
+
"patch": 0
|
44 |
+
}
|
45 |
}
|
test/state.json
CHANGED
@@ -4,10 +4,10 @@
|
|
4 |
"filename": "data-00000-of-00001.arrow"
|
5 |
}
|
6 |
],
|
7 |
-
"_fingerprint": "
|
8 |
"_format_columns": null,
|
9 |
"_format_kwargs": {},
|
10 |
"_format_type": null,
|
11 |
"_output_all_columns": false,
|
12 |
-
"_split":
|
13 |
}
|
|
|
4 |
"filename": "data-00000-of-00001.arrow"
|
5 |
}
|
6 |
],
|
7 |
+
"_fingerprint": "5567c9564854b97d",
|
8 |
"_format_columns": null,
|
9 |
"_format_kwargs": {},
|
10 |
"_format_type": null,
|
11 |
"_output_all_columns": false,
|
12 |
+
"_split": "train"
|
13 |
}
|
train/data-00000-of-00001.arrow
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:409bdc4ec87ac1b103ed1fe88f2881fbd171662b3384611617748d507ab00e28
|
3 |
+
size 4346864
|
train/dataset_info.json
CHANGED
@@ -1,6 +1,12 @@
|
|
1 |
{
|
|
|
2 |
"citation": "",
|
|
|
|
|
|
|
3 |
"description": "",
|
|
|
|
|
4 |
"features": {
|
5 |
"title": {
|
6 |
"dtype": "string",
|
@@ -20,5 +26,20 @@
|
|
20 |
}
|
21 |
},
|
22 |
"homepage": "",
|
23 |
-
"license": ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
}
|
|
|
1 |
{
|
2 |
+
"builder_name": "generator",
|
3 |
"citation": "",
|
4 |
+
"config_name": "default",
|
5 |
+
"dataset_name": "generator",
|
6 |
+
"dataset_size": 4829573,
|
7 |
"description": "",
|
8 |
+
"download_checksums": {},
|
9 |
+
"download_size": 0,
|
10 |
"features": {
|
11 |
"title": {
|
12 |
"dtype": "string",
|
|
|
26 |
}
|
27 |
},
|
28 |
"homepage": "",
|
29 |
+
"license": "",
|
30 |
+
"size_in_bytes": 4829573,
|
31 |
+
"splits": {
|
32 |
+
"train": {
|
33 |
+
"name": "train",
|
34 |
+
"num_bytes": 4829573,
|
35 |
+
"num_examples": 8000,
|
36 |
+
"dataset_name": "generator"
|
37 |
+
}
|
38 |
+
},
|
39 |
+
"version": {
|
40 |
+
"version_str": "0.0.0",
|
41 |
+
"major": 0,
|
42 |
+
"minor": 0,
|
43 |
+
"patch": 0
|
44 |
+
}
|
45 |
}
|
train/state.json
CHANGED
@@ -4,10 +4,10 @@
|
|
4 |
"filename": "data-00000-of-00001.arrow"
|
5 |
}
|
6 |
],
|
7 |
-
"_fingerprint": "
|
8 |
"_format_columns": null,
|
9 |
"_format_kwargs": {},
|
10 |
"_format_type": null,
|
11 |
"_output_all_columns": false,
|
12 |
-
"_split":
|
13 |
}
|
|
|
4 |
"filename": "data-00000-of-00001.arrow"
|
5 |
}
|
6 |
],
|
7 |
+
"_fingerprint": "0666424ffc7baa8f",
|
8 |
"_format_columns": null,
|
9 |
"_format_kwargs": {},
|
10 |
"_format_type": null,
|
11 |
"_output_all_columns": false,
|
12 |
+
"_split": "train"
|
13 |
}
|
wikiextract.py
CHANGED
@@ -7,6 +7,7 @@
|
|
7 |
Author: Tarek Ziadé / Mozilla
|
8 |
|
9 |
"""
|
|
|
10 |
from collections import defaultdict
|
11 |
from concurrent.futures import ThreadPoolExecutor, as_completed
|
12 |
from threading import Lock
|
@@ -162,7 +163,6 @@ class WikiExtractor:
|
|
162 |
total=len(_ROOT_CATS) * _LIMIT_PER_CAT, desc="Processing Categories"
|
163 |
) as pbar:
|
164 |
self.pbar = pbar
|
165 |
-
data = []
|
166 |
with ThreadPoolExecutor(max_workers=15) as executor:
|
167 |
future_to_category = {
|
168 |
executor.submit(self.process_category, category): category
|
@@ -171,23 +171,21 @@ class WikiExtractor:
|
|
171 |
|
172 |
for future in as_completed(future_to_category):
|
173 |
category_data = future.result()
|
174 |
-
|
175 |
-
|
176 |
-
return data
|
177 |
|
178 |
|
179 |
def main():
|
180 |
nltk.download("punkt")
|
181 |
extractor = WikiExtractor()
|
182 |
-
|
183 |
-
dataset = Dataset.from_pandas(pd.DataFrame(data))
|
184 |
|
185 |
train_test_split = dataset.train_test_split(test_size=0.1)
|
186 |
dataset_dict = DatasetDict(
|
187 |
{"train": train_test_split["train"], "test": train_test_split["test"]}
|
188 |
)
|
189 |
|
190 |
-
dataset_dict.save_to_disk(
|
191 |
|
192 |
|
193 |
if __name__ == "__main__":
|
|
|
7 |
Author: Tarek Ziadé / Mozilla
|
8 |
|
9 |
"""
|
10 |
+
import os
|
11 |
from collections import defaultdict
|
12 |
from concurrent.futures import ThreadPoolExecutor, as_completed
|
13 |
from threading import Lock
|
|
|
163 |
total=len(_ROOT_CATS) * _LIMIT_PER_CAT, desc="Processing Categories"
|
164 |
) as pbar:
|
165 |
self.pbar = pbar
|
|
|
166 |
with ThreadPoolExecutor(max_workers=15) as executor:
|
167 |
future_to_category = {
|
168 |
executor.submit(self.process_category, category): category
|
|
|
171 |
|
172 |
for future in as_completed(future_to_category):
|
173 |
category_data = future.result()
|
174 |
+
for item in category_data:
|
175 |
+
yield item
|
|
|
176 |
|
177 |
|
178 |
def main():
|
179 |
nltk.download("punkt")
|
180 |
extractor = WikiExtractor()
|
181 |
+
dataset = Dataset.from_generator(extractor)
|
|
|
182 |
|
183 |
train_test_split = dataset.train_test_split(test_size=0.1)
|
184 |
dataset_dict = DatasetDict(
|
185 |
{"train": train_test_split["train"], "test": train_test_split["test"]}
|
186 |
)
|
187 |
|
188 |
+
dataset_dict.save_to_disk(os.path.dirname(__file__))
|
189 |
|
190 |
|
191 |
if __name__ == "__main__":
|