system HF staff commited on
Commit
695b114
0 Parent(s):

Update files from the datasets library (from 1.0.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.0.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
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
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}}
dummy/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c3d585d0db30e951e733421dc97a99df93647090d39b890f84c0481dad7b10eb
3
+ size 401
tiny_shakespeare.py ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ from __future__ import absolute_import, division, print_function
20
+
21
+ import os
22
+
23
+ import datasets
24
+
25
+
26
+ _CITATION = """\
27
+ @misc{
28
+ author={Karpathy, Andrej},
29
+ title={char-rnn},
30
+ year={2015},
31
+ howpublished={\\url{https://github.com/karpathy/char-rnn}}
32
+ }"""
33
+
34
+ _DESCRIPTION = """\
35
+ 40,000 lines of Shakespeare from a variety of Shakespeare's plays. \
36
+ Featured in Andrej Karpathy's blog post 'The Unreasonable Effectiveness of \
37
+ Recurrent Neural Networks': \
38
+ http://karpathy.github.io/2015/05/21/rnn-effectiveness/.
39
+
40
+ To use for e.g. character modelling:
41
+
42
+ ```
43
+ d = datasets.load_dataset(name='tiny_shakespeare')['train']
44
+ d = d.map(lambda x: datasets.Value('strings').unicode_split(x['text'], 'UTF-8'))
45
+ # train split includes vocabulary for other splits
46
+ vocabulary = sorted(set(next(iter(d)).numpy()))
47
+ d = d.map(lambda x: {'cur_char': x[:-1], 'next_char': x[1:]})
48
+ d = d.unbatch()
49
+ seq_len = 100
50
+ batch_size = 2
51
+ d = d.batch(seq_len)
52
+ d = d.batch(batch_size)
53
+ ```
54
+ """
55
+
56
+
57
+ class TinyShakespeare(datasets.GeneratorBasedBuilder):
58
+ """Tiny Shakespeare dataset builder."""
59
+
60
+ VERSION = datasets.Version("1.0.0")
61
+
62
+ def _info(self):
63
+ return datasets.DatasetInfo(
64
+ description=_DESCRIPTION,
65
+ features=datasets.Features({"text": datasets.Value("string")}),
66
+ supervised_keys=None,
67
+ homepage="https://github.com/karpathy/char-rnn/blob/master/data/tinyshakespeare/input.txt",
68
+ citation=_CITATION,
69
+ )
70
+
71
+ def _split_generators(self, dl_manager):
72
+ """Returns SplitGenerators."""
73
+ download_path = dl_manager.download_and_extract(
74
+ "https://raw.githubusercontent.com/karpathy/char-rnn/master/data/tinyshakespeare/input.txt"
75
+ )
76
+ if os.path.isdir(download_path):
77
+ # During testing the download manager mock gives us a directory
78
+ txt_path = os.path.join(download_path, "input.txt")
79
+ else:
80
+ txt_path = download_path
81
+ with open(txt_path, "r", encoding="utf-8") as f:
82
+ text = f.read()
83
+
84
+ # 90/5/5 split
85
+ i = int(len(text) * 0.9)
86
+ train_text, text = text[:i], text[i:]
87
+ i = int(len(text) * 0.5)
88
+ validation_text, text = text[:i], text[i:]
89
+ test_text = text
90
+
91
+ return [
92
+ datasets.SplitGenerator(
93
+ name=datasets.Split.TRAIN,
94
+ # These kwargs will be passed to _generate_examples
95
+ gen_kwargs={"split_key": "train", "split_text": train_text},
96
+ ),
97
+ datasets.SplitGenerator(
98
+ name=datasets.Split.VALIDATION,
99
+ gen_kwargs={"split_key": "validation", "split_text": validation_text},
100
+ ),
101
+ datasets.SplitGenerator(
102
+ name=datasets.Split.TEST,
103
+ gen_kwargs={"split_key": "test", "split_text": test_text},
104
+ ),
105
+ ]
106
+
107
+ def _generate_examples(self, split_key, split_text):
108
+ """Yields examples."""
109
+ data_key = split_key # Should uniquely identify the thing yielded
110
+ feature_dict = {"text": split_text}
111
+ yield data_key, feature_dict