Convert dataset to Parquet

#2
by albertvillanova HF staff - opened
README.md CHANGED
@@ -1,22 +1,30 @@
1
  ---
2
- paperswithcode_id: null
3
  pretty_name: TinyShakespeare
4
  dataset_info:
5
  features:
6
  - name: text
7
  dtype: string
8
  splits:
9
- - name: test
10
- num_bytes: 55780
11
- num_examples: 1
12
  - name: train
13
- num_bytes: 1003864
14
  num_examples: 1
15
  - name: validation
16
- num_bytes: 55780
 
 
 
17
  num_examples: 1
18
- download_size: 1115394
19
- dataset_size: 1115424
 
 
 
 
 
 
 
 
 
20
  ---
21
 
22
  # Dataset Card for "tiny_shakespeare"
 
1
  ---
 
2
  pretty_name: TinyShakespeare
3
  dataset_info:
4
  features:
5
  - name: text
6
  dtype: string
7
  splits:
 
 
 
8
  - name: train
9
+ num_bytes: 1003858
10
  num_examples: 1
11
  - name: validation
12
+ num_bytes: 55774
13
+ num_examples: 1
14
+ - name: test
15
+ num_bytes: 55774
16
  num_examples: 1
17
+ download_size: 706067
18
+ dataset_size: 1115406
19
+ configs:
20
+ - config_name: default
21
+ data_files:
22
+ - split: train
23
+ path: data/train-*
24
+ - split: validation
25
+ path: data/validation-*
26
+ - split: test
27
+ path: data/test-*
28
  ---
29
 
30
  # Dataset Card for "tiny_shakespeare"
data/test-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3657411dc127ce923291c3543582228841254121e57333441f64d45652e04d5b
3
+ size 36537
data/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b5418159a0b1995e455ba9f03d6e2e8a7d0cf0bccba8d5589bcd6eb5dba936b0
3
+ size 633757
data/validation-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ff6d2dffe1afa2e43ec0c3496ef8396e1ee3145ec6695a1e7bc8879c247b48c7
3
+ size 35773
dataset_infos.json DELETED
@@ -1 +0,0 @@
1
- {"default": {"description": "40,000 lines of Shakespeare from a variety of Shakespeare's plays. Featured in Andrej Karpathy's blog post 'The Unreasonable Effectiveness of Recurrent Neural Networks': http://karpathy.github.io/2015/05/21/rnn-effectiveness/.\n\nTo use for e.g. character modelling:\n\n```\nd = datasets.load_dataset(name='tiny_shakespeare')['train']\nd = d.map(lambda x: datasets.Value('strings').unicode_split(x['text'], 'UTF-8'))\n# train split includes vocabulary for other splits\nvocabulary = sorted(set(next(iter(d)).numpy()))\nd = d.map(lambda x: {'cur_char': x[:-1], 'next_char': x[1:]})\nd = d.unbatch()\nseq_len = 100\nbatch_size = 2\nd = d.batch(seq_len)\nd = d.batch(batch_size)\n```\n", "citation": "@misc{\n author={Karpathy, Andrej},\n title={char-rnn},\n year={2015},\n howpublished={\\url{https://github.com/karpathy/char-rnn}}\n}", "homepage": "https://github.com/karpathy/char-rnn/blob/master/data/tinyshakespeare/input.txt", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}}, "supervised_keys": null, "builder_name": "tiny_shakespeare", "config_name": "default", "version": {"version_str": "1.0.0", "description": null, "datasets_version_to_prepare": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"test": {"name": "test", "num_bytes": 55780, "num_examples": 1, "dataset_name": "tiny_shakespeare"}, "train": {"name": "train", "num_bytes": 1003864, "num_examples": 1, "dataset_name": "tiny_shakespeare"}, "validation": {"name": "validation", "num_bytes": 55780, "num_examples": 1, "dataset_name": "tiny_shakespeare"}}, "download_checksums": {"https://raw.githubusercontent.com/karpathy/char-rnn/master/data/tinyshakespeare/input.txt": {"num_bytes": 1115394, "checksum": "86c4e6aa9db7c042ec79f339dcb96d42b0075e16b8fc2e86bf0ca57e2dc565ed"}}, "download_size": 1115394, "dataset_size": 1115424, "size_in_bytes": 2230818}}
 
 
tiny_shakespeare.py DELETED
@@ -1,110 +0,0 @@
1
- # coding=utf-8
2
- # Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace Datasets Authors.
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
- """Tiny Shakespeare dataset."""
18
-
19
-
20
- import os
21
-
22
- import datasets
23
-
24
-
25
- _CITATION = """\
26
- @misc{
27
- author={Karpathy, Andrej},
28
- title={char-rnn},
29
- year={2015},
30
- howpublished={\\url{https://github.com/karpathy/char-rnn}}
31
- }"""
32
-
33
- _DESCRIPTION = """\
34
- 40,000 lines of Shakespeare from a variety of Shakespeare's plays. \
35
- Featured in Andrej Karpathy's blog post 'The Unreasonable Effectiveness of \
36
- Recurrent Neural Networks': \
37
- http://karpathy.github.io/2015/05/21/rnn-effectiveness/.
38
-
39
- To use for e.g. character modelling:
40
-
41
- ```
42
- d = datasets.load_dataset(name='tiny_shakespeare')['train']
43
- d = d.map(lambda x: datasets.Value('strings').unicode_split(x['text'], 'UTF-8'))
44
- # train split includes vocabulary for other splits
45
- vocabulary = sorted(set(next(iter(d)).numpy()))
46
- d = d.map(lambda x: {'cur_char': x[:-1], 'next_char': x[1:]})
47
- d = d.unbatch()
48
- seq_len = 100
49
- batch_size = 2
50
- d = d.batch(seq_len)
51
- d = d.batch(batch_size)
52
- ```
53
- """
54
-
55
-
56
- class TinyShakespeare(datasets.GeneratorBasedBuilder):
57
- """Tiny Shakespeare dataset builder."""
58
-
59
- VERSION = datasets.Version("1.0.0")
60
-
61
- def _info(self):
62
- return datasets.DatasetInfo(
63
- description=_DESCRIPTION,
64
- features=datasets.Features({"text": datasets.Value("string")}),
65
- supervised_keys=None,
66
- homepage="https://github.com/karpathy/char-rnn/blob/master/data/tinyshakespeare/input.txt",
67
- citation=_CITATION,
68
- )
69
-
70
- def _split_generators(self, dl_manager):
71
- """Returns SplitGenerators."""
72
- download_path = dl_manager.download_and_extract(
73
- "https://raw.githubusercontent.com/karpathy/char-rnn/master/data/tinyshakespeare/input.txt"
74
- )
75
- if os.path.isdir(download_path):
76
- # During testing the download manager mock gives us a directory
77
- txt_path = os.path.join(download_path, "input.txt")
78
- else:
79
- txt_path = download_path
80
- with open(txt_path, "r", encoding="utf-8") as f:
81
- text = f.read()
82
-
83
- # 90/5/5 split
84
- i = int(len(text) * 0.9)
85
- train_text, text = text[:i], text[i:]
86
- i = int(len(text) * 0.5)
87
- validation_text, text = text[:i], text[i:]
88
- test_text = text
89
-
90
- return [
91
- datasets.SplitGenerator(
92
- name=datasets.Split.TRAIN,
93
- # These kwargs will be passed to _generate_examples
94
- gen_kwargs={"split_key": "train", "split_text": train_text},
95
- ),
96
- datasets.SplitGenerator(
97
- name=datasets.Split.VALIDATION,
98
- gen_kwargs={"split_key": "validation", "split_text": validation_text},
99
- ),
100
- datasets.SplitGenerator(
101
- name=datasets.Split.TEST,
102
- gen_kwargs={"split_key": "test", "split_text": test_text},
103
- ),
104
- ]
105
-
106
- def _generate_examples(self, split_key, split_text):
107
- """Yields examples."""
108
- data_key = split_key # Should uniquely identify the thing yielded
109
- feature_dict = {"text": split_text}
110
- yield data_key, feature_dict