system HF staff commited on
Commit
8d29e11
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
+ {"short": {"description": "\nReddit dataset, where TIFU denotes the name of subbreddit /r/tifu.\nAs defined in the publication, styel \"short\" uses title as summary and\n\"long\" uses tldr as summary.\n\nFeatures includes:\n - document: post text without tldr.\n - tldr: tldr line.\n - title: trimmed title without tldr.\n - ups: upvotes.\n - score: score.\n - num_comments: number of comments.\n - upvote_ratio: upvote ratio.\n", "citation": "\n@misc{kim2018abstractive,\n title={Abstractive Summarization of Reddit Posts with Multi-level Memory Networks},\n author={Byeongchang Kim and Hyunwoo Kim and Gunhee Kim},\n year={2018},\n eprint={1811.00783},\n archivePrefix={arXiv},\n primaryClass={cs.CL}\n}\n", "homepage": "https://github.com/ctr4si/MMN", "license": "", "features": {"ups": {"dtype": "float32", "id": null, "_type": "Value"}, "num_comments": {"dtype": "float32", "id": null, "_type": "Value"}, "upvote_ratio": {"dtype": "float32", "id": null, "_type": "Value"}, "score": {"dtype": "float32", "id": null, "_type": "Value"}, "documents": {"dtype": "string", "id": null, "_type": "Value"}, "tldr": {"dtype": "string", "id": null, "_type": "Value"}, "title": {"dtype": "string", "id": null, "_type": "Value"}}, "supervised_keys": {"input": "documents", "output": "title"}, "builder_name": "reddit_tifu", "config_name": "short", "version": {"version_str": "1.1.0", "description": null, "datasets_version_to_prepare": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 137755713, "num_examples": 79740, "dataset_name": "reddit_tifu"}}, "download_checksums": {"https://drive.google.com/uc?export=download&id=1ffWfITKFMJeqjT8loC8aiCLRNJpc_XnF": {"num_bytes": 670607856, "checksum": "f175cafe348e0521c2424cd419c934d10c6af613ed8cbe8eaa8cfbaa06377f1a"}}, "download_size": 670607856, "dataset_size": 137755713, "size_in_bytes": 808363569}, "long": {"description": "\nReddit dataset, where TIFU denotes the name of subbreddit /r/tifu.\nAs defined in the publication, styel \"short\" uses title as summary and\n\"long\" uses tldr as summary.\n\nFeatures includes:\n - document: post text without tldr.\n - tldr: tldr line.\n - title: trimmed title without tldr.\n - ups: upvotes.\n - score: score.\n - num_comments: number of comments.\n - upvote_ratio: upvote ratio.\n", "citation": "\n@misc{kim2018abstractive,\n title={Abstractive Summarization of Reddit Posts with Multi-level Memory Networks},\n author={Byeongchang Kim and Hyunwoo Kim and Gunhee Kim},\n year={2018},\n eprint={1811.00783},\n archivePrefix={arXiv},\n primaryClass={cs.CL}\n}\n", "homepage": "https://github.com/ctr4si/MMN", "license": "", "features": {"ups": {"dtype": "float32", "id": null, "_type": "Value"}, "num_comments": {"dtype": "float32", "id": null, "_type": "Value"}, "upvote_ratio": {"dtype": "float32", "id": null, "_type": "Value"}, "score": {"dtype": "float32", "id": null, "_type": "Value"}, "documents": {"dtype": "string", "id": null, "_type": "Value"}, "tldr": {"dtype": "string", "id": null, "_type": "Value"}, "title": {"dtype": "string", "id": null, "_type": "Value"}}, "supervised_keys": {"input": "documents", "output": "tldr"}, "builder_name": "reddit_tifu", "config_name": "long", "version": {"version_str": "1.1.0", "description": null, "datasets_version_to_prepare": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 92005782, "num_examples": 42139, "dataset_name": "reddit_tifu"}}, "download_checksums": {"https://drive.google.com/uc?export=download&id=1ffWfITKFMJeqjT8loC8aiCLRNJpc_XnF": {"num_bytes": 670607856, "checksum": "f175cafe348e0521c2424cd419c934d10c6af613ed8cbe8eaa8cfbaa06377f1a"}}, "download_size": 670607856, "dataset_size": 92005782, "size_in_bytes": 762613638}}
dummy/short/1.1.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0983e1244341f452576a6867edaeba637d30d0d73c84faab801b31a5321e57cd
3
+ size 430
reddit_tifu.py ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ """Reddit TIFU dataset using tifu or tldr from subreddit tifu."""
18
+
19
+ from __future__ import absolute_import, division, print_function
20
+
21
+ import json
22
+
23
+ import datasets
24
+
25
+
26
+ _CITATION = """
27
+ @misc{kim2018abstractive,
28
+ title={Abstractive Summarization of Reddit Posts with Multi-level Memory Networks},
29
+ author={Byeongchang Kim and Hyunwoo Kim and Gunhee Kim},
30
+ year={2018},
31
+ eprint={1811.00783},
32
+ archivePrefix={arXiv},
33
+ primaryClass={cs.CL}
34
+ }
35
+ """
36
+
37
+ _DESCRIPTION = """
38
+ Reddit dataset, where TIFU denotes the name of subbreddit /r/tifu.
39
+ As defined in the publication, styel "short" uses title as summary and
40
+ "long" uses tldr as summary.
41
+
42
+ Features includes:
43
+ - document: post text without tldr.
44
+ - tldr: tldr line.
45
+ - title: trimmed title without tldr.
46
+ - ups: upvotes.
47
+ - score: score.
48
+ - num_comments: number of comments.
49
+ - upvote_ratio: upvote ratio.
50
+ """
51
+
52
+ _URL = "https://drive.google.com/uc?export=download&id=1ffWfITKFMJeqjT8loC8aiCLRNJpc_XnF"
53
+
54
+ _DOCUMENT = "documents"
55
+ _TITLE = "title"
56
+ _TLDR = "tldr"
57
+ _ADDITIONAL_FEATURES = ["ups", "num_comments", "score", "upvote_ratio"]
58
+
59
+
60
+ class RedditTifuConfig(datasets.BuilderConfig):
61
+ """BuilderConfig for RedditTifu."""
62
+
63
+ def __init__(self, summary_key=None, **kwargs):
64
+ """BuilderConfig for RedditTifu.
65
+
66
+ Args:
67
+ summary_key: key string of summary in downloaded json file.
68
+ **kwargs: keyword arguments forwarded to super.
69
+ """
70
+ # Version 1.1.0 remove empty document and summary strings.
71
+ super(RedditTifuConfig, self).__init__(version=datasets.Version("1.1.0"), **kwargs)
72
+ self.summary_key = summary_key
73
+
74
+
75
+ class RedditTifu(datasets.GeneratorBasedBuilder):
76
+ """Reddit TIFU Dataset."""
77
+
78
+ BUILDER_CONFIGS = [
79
+ RedditTifuConfig(
80
+ name="short",
81
+ summary_key=_TITLE,
82
+ description="Using title as summary.",
83
+ ),
84
+ RedditTifuConfig(
85
+ name="long",
86
+ summary_key=_TLDR,
87
+ description="Using TLDR as summary.",
88
+ ),
89
+ ]
90
+
91
+ def _info(self):
92
+ features = {
93
+ "ups": datasets.Value("float32"),
94
+ "num_comments": datasets.Value("float32"),
95
+ "upvote_ratio": datasets.Value("float32"),
96
+ "score": datasets.Value("float32"),
97
+ }
98
+ features.update({k: datasets.Value("string") for k in [_DOCUMENT, _TLDR, _TITLE]})
99
+ return datasets.DatasetInfo(
100
+ description=_DESCRIPTION,
101
+ features=datasets.Features(features),
102
+ supervised_keys=(_DOCUMENT, self.config.summary_key),
103
+ homepage="https://github.com/ctr4si/MMN",
104
+ citation=_CITATION,
105
+ )
106
+
107
+ def _split_generators(self, dl_manager):
108
+ """Returns SplitGenerators."""
109
+ dl_path = dl_manager.download_and_extract(_URL)
110
+ return [
111
+ datasets.SplitGenerator(
112
+ name=datasets.Split.TRAIN,
113
+ gen_kwargs={"path": dl_path},
114
+ )
115
+ ]
116
+
117
+ def _generate_examples(self, path=None):
118
+ """Yields examples."""
119
+ with open(path, "rb") as f:
120
+ for i, line in enumerate(f):
121
+ # keys are 'title_tokenized','permalink','title','url','num_comments',
122
+ # 'tldr'(optional),'created_utc','trimmed_title_tokenized','ups',
123
+ # 'selftext_html','score','upvote_ratio','tldr_tokenized'(optional),
124
+ # 'selftext','trimmed_title','selftext_without_tldr_tokenized',
125
+ # 'id','selftext_without_tldr'
126
+ d = json.loads(line)
127
+ r = {
128
+ _DOCUMENT: d["selftext_without_tldr"].strip(),
129
+ _TITLE: d["trimmed_title"].strip(),
130
+ _TLDR: (d["tldr"] or "").strip(),
131
+ }
132
+ r.update({k: d[k] for k in _ADDITIONAL_FEATURES})
133
+ # skip if document or summary is empty
134
+ if r[_DOCUMENT] and r[self.config.summary_key]:
135
+ yield i, r