Datasets:

Languages:
English
Multilinguality:
monolingual
Size Categories:
1M<n<10M
Language Creators:
crowdsourced
Annotations Creators:
no-annotation
Source Datasets:
original
ArXiv:
Tags:
License:
albertvillanova HF staff commited on
Commit
b08601e
1 Parent(s): f556296

Convert dataset to Parquet (#8)

Browse files

- Convert dataset to Parquet (de54f133ef530c2e9b46c532f95a01c446ff0f1d)
- Add wikitext-2-v1 data files (c8a1c90b2b6554c017d92ca208fc0c03460685be)
- Add wikitext-103-raw-v1 data files (5fddba447aa4e75996922ea0d6b18b42f0a81cc4)
- Add wikitext-2-raw-v1 data files (8aaa8b27d493dba10b8553290236799e6dc57829)
- Delete loading script (9f7c666b6370668ee2dd874330e917f2dbe2c45f)
- Delete legacy dataset_infos.json (1598c59c386ed177a3440b87d906cea25b07c288)

README.md CHANGED
@@ -10,8 +10,6 @@ license:
10
  - gfdl
11
  multilinguality:
12
  - monolingual
13
- paperswithcode_id: wikitext-2
14
- pretty_name: WikiText
15
  size_categories:
16
  - 1M<n<10M
17
  source_datasets:
@@ -22,71 +20,106 @@ task_categories:
22
  task_ids:
23
  - language-modeling
24
  - masked-language-modeling
 
 
25
  dataset_info:
26
- - config_name: wikitext-103-v1
27
  features:
28
  - name: text
29
  dtype: string
30
  splits:
31
  - name: test
32
- num_bytes: 1295579
33
  num_examples: 4358
34
  - name: train
35
- num_bytes: 545142639
36
  num_examples: 1801350
37
  - name: validation
38
- num_bytes: 1154755
39
  num_examples: 3760
40
- download_size: 190229076
41
- dataset_size: 547592973
42
- - config_name: wikitext-2-v1
43
  features:
44
  - name: text
45
  dtype: string
46
  splits:
47
  - name: test
48
- num_bytes: 1270951
49
  num_examples: 4358
50
  - name: train
51
- num_bytes: 10918134
52
- num_examples: 36718
53
  - name: validation
54
- num_bytes: 1134127
55
  num_examples: 3760
56
- download_size: 4475746
57
- dataset_size: 13323212
58
- - config_name: wikitext-103-raw-v1
59
  features:
60
  - name: text
61
  dtype: string
62
  splits:
63
  - name: test
64
- num_bytes: 1305092
65
  num_examples: 4358
66
  - name: train
67
- num_bytes: 546501673
68
- num_examples: 1801350
69
  - name: validation
70
- num_bytes: 1159292
71
  num_examples: 3760
72
- download_size: 191984949
73
- dataset_size: 548966057
74
- - config_name: wikitext-2-raw-v1
75
  features:
76
  - name: text
77
  dtype: string
78
  splits:
79
  - name: test
80
- num_bytes: 1305092
81
  num_examples: 4358
82
  - name: train
83
- num_bytes: 11061733
84
  num_examples: 36718
85
  - name: validation
86
- num_bytes: 1159292
87
  num_examples: 3760
88
- download_size: 4721645
89
- dataset_size: 13526117
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  ---
91
 
92
  # Dataset Card for "wikitext"
10
  - gfdl
11
  multilinguality:
12
  - monolingual
 
 
13
  size_categories:
14
  - 1M<n<10M
15
  source_datasets:
20
  task_ids:
21
  - language-modeling
22
  - masked-language-modeling
23
+ paperswithcode_id: wikitext-2
24
+ pretty_name: WikiText
25
  dataset_info:
26
+ - config_name: wikitext-103-raw-v1
27
  features:
28
  - name: text
29
  dtype: string
30
  splits:
31
  - name: test
32
+ num_bytes: 1305088
33
  num_examples: 4358
34
  - name: train
35
+ num_bytes: 546500949
36
  num_examples: 1801350
37
  - name: validation
38
+ num_bytes: 1159288
39
  num_examples: 3760
40
+ download_size: 315466397
41
+ dataset_size: 548965325
42
+ - config_name: wikitext-103-v1
43
  features:
44
  - name: text
45
  dtype: string
46
  splits:
47
  - name: test
48
+ num_bytes: 1295575
49
  num_examples: 4358
50
  - name: train
51
+ num_bytes: 545141915
52
+ num_examples: 1801350
53
  - name: validation
54
+ num_bytes: 1154751
55
  num_examples: 3760
56
+ download_size: 313093838
57
+ dataset_size: 547592241
58
+ - config_name: wikitext-2-raw-v1
59
  features:
60
  - name: text
61
  dtype: string
62
  splits:
63
  - name: test
64
+ num_bytes: 1305088
65
  num_examples: 4358
66
  - name: train
67
+ num_bytes: 11061717
68
+ num_examples: 36718
69
  - name: validation
70
+ num_bytes: 1159288
71
  num_examples: 3760
72
+ download_size: 7747362
73
+ dataset_size: 13526093
74
+ - config_name: wikitext-2-v1
75
  features:
76
  - name: text
77
  dtype: string
78
  splits:
79
  - name: test
80
+ num_bytes: 1270947
81
  num_examples: 4358
82
  - name: train
83
+ num_bytes: 10918118
84
  num_examples: 36718
85
  - name: validation
86
+ num_bytes: 1134123
87
  num_examples: 3760
88
+ download_size: 7371282
89
+ dataset_size: 13323188
90
+ configs:
91
+ - config_name: wikitext-103-raw-v1
92
+ data_files:
93
+ - split: test
94
+ path: wikitext-103-raw-v1/test-*
95
+ - split: train
96
+ path: wikitext-103-raw-v1/train-*
97
+ - split: validation
98
+ path: wikitext-103-raw-v1/validation-*
99
+ - config_name: wikitext-103-v1
100
+ data_files:
101
+ - split: test
102
+ path: wikitext-103-v1/test-*
103
+ - split: train
104
+ path: wikitext-103-v1/train-*
105
+ - split: validation
106
+ path: wikitext-103-v1/validation-*
107
+ - config_name: wikitext-2-raw-v1
108
+ data_files:
109
+ - split: test
110
+ path: wikitext-2-raw-v1/test-*
111
+ - split: train
112
+ path: wikitext-2-raw-v1/train-*
113
+ - split: validation
114
+ path: wikitext-2-raw-v1/validation-*
115
+ - config_name: wikitext-2-v1
116
+ data_files:
117
+ - split: test
118
+ path: wikitext-2-v1/test-*
119
+ - split: train
120
+ path: wikitext-2-v1/train-*
121
+ - split: validation
122
+ path: wikitext-2-v1/validation-*
123
  ---
124
 
125
  # Dataset Card for "wikitext"
dataset_infos.json DELETED
@@ -1 +0,0 @@
1
- {"wikitext-103-v1": {"description": " The WikiText language modeling dataset is a collection of over 100 million tokens extracted from the set of verified\n Good and Featured articles on Wikipedia. The dataset is available under the Creative Commons Attribution-ShareAlike\n License.\n", "citation": "@misc{merity2016pointer,\n title={Pointer Sentinel Mixture Models},\n author={Stephen Merity and Caiming Xiong and James Bradbury and Richard Socher},\n year={2016},\n eprint={1609.07843},\n archivePrefix={arXiv},\n primaryClass={cs.CL}\n}\n", "homepage": "https://blog.einstein.ai/the-wikitext-long-term-dependency-language-modeling-dataset/", "license": "Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "wikitext", "config_name": "wikitext-103-v1", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 1295579, "num_examples": 4358, "dataset_name": "wikitext"}, "train": {"name": "train", "num_bytes": 545142639, "num_examples": 1801350, "dataset_name": "wikitext"}, "validation": {"name": "validation", "num_bytes": 1154755, "num_examples": 3760, "dataset_name": "wikitext"}}, "download_checksums": {"https://s3.amazonaws.com/research.metamind.io/wikitext/wikitext-103-v1.zip": {"num_bytes": 190229076, "checksum": "242ba0f20b329cfdf1ccc61e9e9e5b59becf189db7f7a81cd2a0e2fc31539590"}}, "download_size": 190229076, "post_processing_size": null, "dataset_size": 547592973, "size_in_bytes": 737822049}, "wikitext-2-v1": {"description": " The WikiText language modeling dataset is a collection of over 100 million tokens extracted from the set of verified\n Good and Featured articles on Wikipedia. The dataset is available under the Creative Commons Attribution-ShareAlike\n License.\n", "citation": "@misc{merity2016pointer,\n title={Pointer Sentinel Mixture Models},\n author={Stephen Merity and Caiming Xiong and James Bradbury and Richard Socher},\n year={2016},\n eprint={1609.07843},\n archivePrefix={arXiv},\n primaryClass={cs.CL}\n}\n", "homepage": "https://blog.einstein.ai/the-wikitext-long-term-dependency-language-modeling-dataset/", "license": "Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "wikitext", "config_name": "wikitext-2-v1", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 1270951, "num_examples": 4358, "dataset_name": "wikitext"}, "train": {"name": "train", "num_bytes": 10918134, "num_examples": 36718, "dataset_name": "wikitext"}, "validation": {"name": "validation", "num_bytes": 1134127, "num_examples": 3760, "dataset_name": "wikitext"}}, "download_checksums": {"https://s3.amazonaws.com/research.metamind.io/wikitext/wikitext-2-v1.zip": {"num_bytes": 4475746, "checksum": "92675f1d63015c1c8b51f1656a52d5bdbc33aafa60cc47a218a66e7ee817488c"}}, "download_size": 4475746, "post_processing_size": null, "dataset_size": 13323212, "size_in_bytes": 17798958}, "wikitext-103-raw-v1": {"description": " The WikiText language modeling dataset is a collection of over 100 million tokens extracted from the set of verified\n Good and Featured articles on Wikipedia. The dataset is available under the Creative Commons Attribution-ShareAlike\n License.\n", "citation": "@misc{merity2016pointer,\n title={Pointer Sentinel Mixture Models},\n author={Stephen Merity and Caiming Xiong and James Bradbury and Richard Socher},\n year={2016},\n eprint={1609.07843},\n archivePrefix={arXiv},\n primaryClass={cs.CL}\n}\n", "homepage": "https://blog.einstein.ai/the-wikitext-long-term-dependency-language-modeling-dataset/", "license": "Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "wikitext", "config_name": "wikitext-103-raw-v1", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 1305092, "num_examples": 4358, "dataset_name": "wikitext"}, "train": {"name": "train", "num_bytes": 546501673, "num_examples": 1801350, "dataset_name": "wikitext"}, "validation": {"name": "validation", "num_bytes": 1159292, "num_examples": 3760, "dataset_name": "wikitext"}}, "download_checksums": {"https://s3.amazonaws.com/research.metamind.io/wikitext/wikitext-103-raw-v1.zip": {"num_bytes": 191984949, "checksum": "91c00ae287f0d699e18605c84afc9e45c192bc6b7797ff8837e5474655a33794"}}, "download_size": 191984949, "post_processing_size": null, "dataset_size": 548966057, "size_in_bytes": 740951006}, "wikitext-2-raw-v1": {"description": " The WikiText language modeling dataset is a collection of over 100 million tokens extracted from the set of verified\n Good and Featured articles on Wikipedia. The dataset is available under the Creative Commons Attribution-ShareAlike\n License.\n", "citation": "@misc{merity2016pointer,\n title={Pointer Sentinel Mixture Models},\n author={Stephen Merity and Caiming Xiong and James Bradbury and Richard Socher},\n year={2016},\n eprint={1609.07843},\n archivePrefix={arXiv},\n primaryClass={cs.CL}\n}\n", "homepage": "https://blog.einstein.ai/the-wikitext-long-term-dependency-language-modeling-dataset/", "license": "Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "wikitext", "config_name": "wikitext-2-raw-v1", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 1305092, "num_examples": 4358, "dataset_name": "wikitext"}, "train": {"name": "train", "num_bytes": 11061733, "num_examples": 36718, "dataset_name": "wikitext"}, "validation": {"name": "validation", "num_bytes": 1159292, "num_examples": 3760, "dataset_name": "wikitext"}}, "download_checksums": {"https://s3.amazonaws.com/research.metamind.io/wikitext/wikitext-2-raw-v1.zip": {"num_bytes": 4721645, "checksum": "ef7edb566e3e2b2d31b29c1fdb0c89a4cc683597484c3dc2517919c615435a11"}}, "download_size": 4721645, "post_processing_size": null, "dataset_size": 13526117, "size_in_bytes": 18247762}}
 
wikitext-103-raw-v1/test-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5f1bea067869d04849c0f975a2b29c4ff47d867f484f5010ea5e861eab246d91
3
+ size 732610
wikitext-103-raw-v1/train-00000-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:74da360f23826045b3e6ac6375411fdb15f003030aa74f2596ed08b857cb9212
3
+ size 156987808
wikitext-103-raw-v1/train-00001-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ba090ac30dbf5461e8dcbdd1a1b8e6f3cf9c2c756d64f0c1220450acd514f720
3
+ size 157088770
wikitext-103-raw-v1/validation-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:204929b7ff9d6184953f867dedb860e40aa69c078fc1e54b3baaa8fb28511c4c
3
+ size 657209
wikitext-103-v1/test-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:abdfc9f83b1103b502924072460d4c92f277c9b49c313cef3e48cfcf7428e125
3
+ size 721735
wikitext-103-v1/train-00000-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c2ecca8c3250e79518e45d125f3a9a757d8014f6b2d8435c602be87c1f79ec3b
3
+ size 155788327
wikitext-103-v1/train-00001-of-00002.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:720f2503551f33c25bb822aad74d699fee4d5331a7373d0c262f1bfb01354fcf
3
+ size 155928670
wikitext-103-v1/validation-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a586125adab06f115018c43507ac267ea70850ce6218cbb96e08bb3b4db0899b
3
+ size 655106
wikitext-2-raw-v1/test-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5f1bea067869d04849c0f975a2b29c4ff47d867f484f5010ea5e861eab246d91
3
+ size 732610
wikitext-2-raw-v1/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e83889baabc497075506f91975be5fac0d45c5290b6b20582c8cd1e853d0c9f7
3
+ size 6357543
wikitext-2-raw-v1/validation-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:204929b7ff9d6184953f867dedb860e40aa69c078fc1e54b3baaa8fb28511c4c
3
+ size 657209
wikitext-2-v1/test-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e6b3913da714b63a60a571698b20ff15441fb015783ea1b5285f707d4f2f00a9
3
+ size 685430
wikitext-2-v1/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dfc27e4360c639dc1fba1e403bfffd53af4a5c75d5363b5724d49bf12d07cce6
3
+ size 6068114
wikitext-2-v1/validation-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:717de9a0c1c0b0b1dfdd8f1e6ad8a30ece618bbde81f5da8207277547d324215
3
+ size 617738
wikitext.py DELETED
@@ -1,192 +0,0 @@
1
- """TODO(wikitext): Add a description here."""
2
-
3
-
4
- import os
5
-
6
- import datasets
7
-
8
-
9
- _CITATION = """\
10
- @misc{merity2016pointer,
11
- title={Pointer Sentinel Mixture Models},
12
- author={Stephen Merity and Caiming Xiong and James Bradbury and Richard Socher},
13
- year={2016},
14
- eprint={1609.07843},
15
- archivePrefix={arXiv},
16
- primaryClass={cs.CL}
17
- }
18
- """
19
-
20
- _DESCRIPTION = """\
21
- The WikiText language modeling dataset is a collection of over 100 million tokens extracted from the set of verified
22
- Good and Featured articles on Wikipedia. The dataset is available under the Creative Commons Attribution-ShareAlike
23
- License.
24
- """
25
- _HOMEPAGE = "https://blog.einstein.ai/the-wikitext-long-term-dependency-language-modeling-dataset/"
26
- _LICENSE = "Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)"
27
- _DATA_URL = "https://s3.amazonaws.com/research.metamind.io/wikitext"
28
-
29
-
30
- class WikitextConfig(datasets.BuilderConfig):
31
- """BuilderConfig for GLUE."""
32
-
33
- def __init__(self, data_url, **kwargs):
34
- """BuilderConfig for Wikitext
35
-
36
- Args:
37
- data_url: `string`, url to the dataset (word or raw level)
38
- **kwargs: keyword arguments forwarded to super.
39
- """
40
- super(WikitextConfig, self).__init__(
41
- version=datasets.Version(
42
- "1.0.0",
43
- ),
44
- **kwargs,
45
- )
46
- self.data_url = data_url
47
-
48
-
49
- class Wikitext(datasets.GeneratorBasedBuilder):
50
- """TODO(wikitext_103): Short description of my dataset."""
51
-
52
- # TODO(wikitext_103): Set up version.
53
- VERSION = datasets.Version("0.1.0")
54
- BUILDER_CONFIGS = [
55
- WikitextConfig(
56
- name="wikitext-103-v1",
57
- data_url=_DATA_URL + "/" + "wikitext-103-v1.zip",
58
- description="Word level dataset. No processing is needed other than replacing newlines with <eos> tokens.",
59
- ),
60
- WikitextConfig(
61
- name="wikitext-2-v1",
62
- data_url=_DATA_URL + "/" + "wikitext-2-v1.zip",
63
- description="Word level dataset. No processing is needed other than replacing newlines with <eos> tokens.",
64
- ),
65
- WikitextConfig(
66
- name="wikitext-103-raw-v1",
67
- data_url=_DATA_URL + "/" + "wikitext-103-raw-v1.zip",
68
- description="Raw level dataset: the raw tokens before the addition of <unk> tokens. "
69
- "They should only be used for character level work or for creating newly derived datasets.",
70
- ),
71
- WikitextConfig(
72
- name="wikitext-2-raw-v1",
73
- data_url=_DATA_URL + "/" + "wikitext-2-raw-v1.zip",
74
- description="Raw level dataset: the raw tokens before the addition of <unk> tokens. "
75
- "They should only be used for character level work or for creating newly derived datasets.",
76
- ),
77
- ]
78
-
79
- def _info(self):
80
- # TODO(wikitext): Specifies the datasets.DatasetInfo object
81
- return datasets.DatasetInfo(
82
- # This is the description that will appear on the datasets page.
83
- description=_DESCRIPTION,
84
- # datasets.features.FeatureConnectors
85
- features=datasets.Features(
86
- {
87
- "text": datasets.Value("string")
88
- # These are the features of your dataset like images, labels ...
89
- }
90
- ),
91
- # If there's a common (input, target) tuple from the features,
92
- # specify them here. They'll be used if as_supervised=True in
93
- # builder.as_dataset.
94
- supervised_keys=None,
95
- homepage=_HOMEPAGE,
96
- license=_LICENSE,
97
- citation=_CITATION,
98
- )
99
-
100
- def _split_generators(self, dl_manager):
101
- """Returns SplitGenerators."""
102
- # TODO(wikitext): Downloads the data and defines the splits
103
- # dl_manager is a datasets.download.DownloadManager that can be used to
104
- # download and extract URLs
105
- if self.config.name == "wikitext-103-v1":
106
- data_file = dl_manager.download_and_extract(self.config.data_url)
107
- data_dir = os.path.join(data_file, "wikitext-103")
108
- return [
109
- datasets.SplitGenerator(
110
- name=datasets.Split.TEST,
111
- gen_kwargs={"data_file": os.path.join(data_dir, "wiki.test.tokens"), "split": "test"},
112
- ),
113
- datasets.SplitGenerator(
114
- name=datasets.Split.TRAIN,
115
- gen_kwargs={"data_file": os.path.join(data_dir, "wiki.train.tokens"), "split": "train"},
116
- ),
117
- datasets.SplitGenerator(
118
- name=datasets.Split.VALIDATION,
119
- gen_kwargs={"data_file": os.path.join(data_dir, "wiki.valid.tokens"), "split": "valid"},
120
- ),
121
- ]
122
- else:
123
- if self.config.name == "wikitext-103-raw-v1":
124
- data_file = dl_manager.download_and_extract(self.config.data_url)
125
- data_dir = os.path.join(data_file, "wikitext-103-raw")
126
- return [
127
- datasets.SplitGenerator(
128
- name=datasets.Split.TEST,
129
- gen_kwargs={"data_file": os.path.join(data_dir, "wiki.test.raw"), "split": "test"},
130
- ),
131
- datasets.SplitGenerator(
132
- name=datasets.Split.TRAIN,
133
- gen_kwargs={"data_file": os.path.join(data_dir, "wiki.train.raw"), "split": "train"},
134
- ),
135
- datasets.SplitGenerator(
136
- name=datasets.Split.VALIDATION,
137
- gen_kwargs={"data_file": os.path.join(data_dir, "wiki.valid.raw"), "split": "valid"},
138
- ),
139
- ]
140
- else:
141
- if self.config.name == "wikitext-2-raw-v1":
142
- data_file = dl_manager.download_and_extract(self.config.data_url)
143
- data_dir = os.path.join(data_file, "wikitext-2-raw")
144
- return [
145
- datasets.SplitGenerator(
146
- name=datasets.Split.TEST,
147
- gen_kwargs={"data_file": os.path.join(data_dir, "wiki.test.raw"), "split": "test"},
148
- ),
149
- datasets.SplitGenerator(
150
- name=datasets.Split.TRAIN,
151
- gen_kwargs={"data_file": os.path.join(data_dir, "wiki.train.raw"), "split": "train"},
152
- ),
153
- datasets.SplitGenerator(
154
- name=datasets.Split.VALIDATION,
155
- gen_kwargs={"data_file": os.path.join(data_dir, "wiki.valid.raw"), "split": "valid"},
156
- ),
157
- ]
158
- else:
159
- if self.config.name == "wikitext-2-v1":
160
- data_file = dl_manager.download_and_extract(self.config.data_url)
161
- data_dir = os.path.join(data_file, "wikitext-2")
162
- return [
163
- datasets.SplitGenerator(
164
- name=datasets.Split.TEST,
165
- gen_kwargs={"data_file": os.path.join(data_dir, "wiki.test.tokens"), "split": "test"},
166
- ),
167
- datasets.SplitGenerator(
168
- name=datasets.Split.TRAIN,
169
- gen_kwargs={
170
- "data_file": os.path.join(data_dir, "wiki.train.tokens"),
171
- "split": "train",
172
- },
173
- ),
174
- datasets.SplitGenerator(
175
- name=datasets.Split.VALIDATION,
176
- gen_kwargs={
177
- "data_file": os.path.join(data_dir, "wiki.valid.tokens"),
178
- "split": "valid",
179
- },
180
- ),
181
- ]
182
-
183
- def _generate_examples(self, data_file, split):
184
-
185
- """Yields examples."""
186
- # TODO(wikitext): Yields (key, example) tuples from the dataset
187
- with open(data_file, encoding="utf-8") as f:
188
- for idx, row in enumerate(f):
189
- if row.strip():
190
- yield idx, {"text": row}
191
- else:
192
- yield idx, {"text": ""}