Datasets:

Languages:
English
Multilinguality:
monolingual
Size Categories:
1K<n<10K
Language Creators:
found
Annotations Creators:
no-annotation
Source Datasets:
original
ArXiv:
License:
system HF staff commited on
Commit
1a4c0f5
0 Parent(s):

Update files from the datasets library (from 1.2.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.2.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
README.md ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - no-annotation
4
+ language_creators:
5
+ - found
6
+ languages:
7
+ - en
8
+ licenses:
9
+ - unknown
10
+ multilinguality:
11
+ - monolingual
12
+ size_categories:
13
+ - 1K<n<10K
14
+ source_datasets:
15
+ - original
16
+ task_categories:
17
+ - conditional-text-generation
18
+ task_ids:
19
+ - summarization
20
+ ---
21
+
22
+ # Dataset Card for SciTLDR
23
+
24
+ ## Table of Contents
25
+ - [Dataset Description](#dataset-description)
26
+ - [Dataset Summary](#dataset-summary)
27
+ - [Supported Tasks](#supported-tasks-and-leaderboards)
28
+ - [Languages](#languages)
29
+ - [Dataset Structure](#dataset-structure)
30
+ - [Data Instances](#data-instances)
31
+ - [Data Fields](#data-instances)
32
+ - [Data Splits](#data-instances)
33
+ - [Dataset Creation](#dataset-creation)
34
+ - [Curation Rationale](#curation-rationale)
35
+ - [Source Data](#source-data)
36
+ - [Annotations](#annotations)
37
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
38
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
39
+ - [Social Impact of Dataset](#social-impact-of-dataset)
40
+ - [Discussion of Biases](#discussion-of-biases)
41
+ - [Other Known Limitations](#other-known-limitations)
42
+ - [Additional Information](#additional-information)
43
+ - [Dataset Curators](#dataset-curators)
44
+ - [Licensing Information](#licensing-information)
45
+ - [Citation Information](#citation-information)
46
+
47
+ ## Dataset Description
48
+
49
+ - **Homepage:** https://github.com/allenai/scitldr
50
+ - **Repository:** https://github.com/allenai/scitldr
51
+ - **Paper:** https://arxiv.org/abs/2004.15011
52
+ - **Leaderboard:**
53
+ - **Point of Contact:** {isabelc,kylel,armanc,danw}@allenai.org
54
+
55
+ ### Dataset Summary
56
+ `SciTLDR`: Extreme Summarization of Scientific Documents
57
+
58
+ SciTLDR is a new multi-target dataset of 5.4K TLDRs over 3.2K papers. SciTLDR contains both author-written and expert-derived TLDRs, where the latter are collected using a novel annotation protocol that produces high-quality summaries while minimizing annotation burden.
59
+
60
+ ### Supported Tasks and Leaderboards
61
+
62
+ summarization
63
+
64
+ ### Languages
65
+
66
+ English
67
+
68
+ ## Dataset Structure
69
+
70
+ SciTLDR is split in to a 60/20/20 train/dev/test split. For each file, each line is a json, formatted as follows
71
+ ```
72
+ {
73
+ "source":[
74
+ "sent0",
75
+ "sent1",
76
+ "sent2",
77
+ ...
78
+ ],
79
+ "source_labels":[binary list in which 1 is the oracle sentence],
80
+ "rouge_scores":[precomputed rouge-1 scores],
81
+ "paper_id":"PAPER-ID",
82
+ "target":[
83
+ "author-tldr",
84
+ "pr-tldr0",
85
+ "pr-tldr1",
86
+ ...
87
+ ],
88
+ "title":"TITLE"
89
+ }
90
+ ```
91
+ The keys `rouge_scores` and `source_labels` are not necessary for any code to run, precomputed Rouge scores are provided for future research.
92
+
93
+ ### Data Instances
94
+
95
+ {
96
+ "source": [
97
+ "Mixed precision training (MPT) is becoming a practical technique to improve the speed and energy efficiency of training deep neural networks by leveraging the fast hardware support for IEEE half-precision floating point that is available in existing GPUs.",
98
+ "MPT is typically used in combination with a technique called loss scaling, that works by scaling up the loss value up before the start of backpropagation in order to minimize the impact of numerical underflow on training.",
99
+ "Unfortunately, existing methods make this loss scale value a hyperparameter that needs to be tuned per-model, and a single scale cannot be adapted to different layers at different training stages.",
100
+ "We introduce a loss scaling-based training method called adaptive loss scaling that makes MPT easier and more practical to use, by removing the need to tune a model-specific loss scale hyperparameter.",
101
+ "We achieve this by introducing layer-wise loss scale values which are automatically computed during training to deal with underflow more effectively than existing methods.",
102
+ "We present experimental results on a variety of networks and tasks that show our approach can shorten the time to convergence and improve accuracy, compared with using the existing state-of-the-art MPT and single-precision floating point."
103
+ ],
104
+ "source_labels": [
105
+ 0,
106
+ 0,
107
+ 0,
108
+ 1,
109
+ 0,
110
+ 0
111
+ ],
112
+ "rouge_scores": [
113
+ 0.2399999958000001,
114
+ 0.26086956082230633,
115
+ 0.19999999531250012,
116
+ 0.38095237636054424,
117
+ 0.2051282003944774,
118
+ 0.2978723360796741
119
+ ],
120
+ "paper_id": "rJlnfaNYvB",
121
+ "target": [
122
+ "We devise adaptive loss scaling to improve mixed precision training that surpass the state-of-the-art results.",
123
+ "Proposal for an adaptive loss scaling method during backpropagation for mix precision training where scale rate is decided automatically to reduce the underflow.",
124
+ "The authors propose a method to train models in FP16 precision that adopts a more elaborate way to minimize underflow in every layer simultaneously and automatically."
125
+ ],
126
+ "title": "Adaptive Loss Scaling for Mixed Precision Training"
127
+ }
128
+
129
+ ### Data Fields
130
+
131
+ - `source`: The Abstract, Introduction and Conclusion (AIC) or Full text of the paper, with one sentence per line.
132
+ - `source_labels`: Binary 0 or 1, 1 denotes the oracle sentence.
133
+ - `rouge_scores`: Precomputed ROUGE baseline scores for each sentence.
134
+ - `paper_id`: Arxiv Paper ID.
135
+ - `target`: Multiple summaries for each sentence, one sentence per line.
136
+ - `title`: Title of the paper.
137
+ ### Data Splits
138
+
139
+ | | train | valid | test |
140
+ |-------------------|-------|--------|------|
141
+ | SciTLDR-A | 1992 | 618 | 619 |
142
+ | SciTLDR-AIC | 1992 | 618 | 619 |
143
+ | SciTLDR-FullText | 1992 | 618 | 619 |
144
+
145
+ ## Dataset Creation
146
+
147
+ [More Information Needed]
148
+
149
+ ### Curation Rationale
150
+
151
+ [More Information Needed]
152
+
153
+ ### Source Data
154
+
155
+ #### Initial Data Collection and Normalization
156
+
157
+ [More Information Needed]
158
+
159
+ #### Who are the source language producers?
160
+ https://allenai.org/
161
+
162
+ ### Annotations
163
+
164
+ #### Annotation process
165
+
166
+ Given the title and first 128 words of a reviewer comment about a paper,
167
+ re-write the summary (if it exists) into a single sentence or an incomplete
168
+ phrase. Summaries must be no more than one sentence.
169
+ Most summaries are between 15 and 25 words. The average rewritten summary is
170
+ 20 words long.
171
+
172
+ #### Who are the annotators?
173
+
174
+ [More Information Needed]
175
+
176
+ ### Personal and Sensitive Information
177
+
178
+ [More Information Needed]
179
+
180
+ ## Considerations for Using the Data
181
+
182
+ ### Social Impact of Dataset
183
+
184
+ To encourage further research in the area of extreme summarization of scientific documents.
185
+
186
+ ### Discussion of Biases
187
+
188
+ [More Information Needed]
189
+
190
+ ### Other Known Limitations
191
+
192
+ [More Information Needed]
193
+
194
+ ## Additional Information
195
+
196
+ ### Dataset Curators
197
+
198
+ [More Information Needed]
199
+
200
+ ### Licensing Information
201
+
202
+ Apache License 2.0
203
+
204
+ ### Citation Information
205
+ @article{cachola2020tldr,
206
+ title={{TLDR}: Extreme Summarization of Scientific Documents},
207
+ author={Isabel Cachola and Kyle Lo and Arman Cohan and Daniel S. Weld},
208
+ journal={arXiv:2004.15011},
209
+ year={2020},
210
+ }
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
1
+ {"Abstract": {"description": "A new multi-target dataset of 5.4K TLDRs over 3.2K papers.\nSCITLDR contains both author-written and expert-derived TLDRs,\nwhere the latter are collected using a novel annotation protocol\nthat produces high-quality summaries while minimizing annotation burden.\n", "citation": "@article{cachola2020tldr,\n title={{TLDR}: Extreme Summarization of Scientific Documents},\n author={Isabel Cachola and Kyle Lo and Arman Cohan and Daniel S. Weld},\n journal={arXiv:2004.15011},\n year={2020},\n}\n", "homepage": "https://github.com/allenai/scitldr", "license": "Apache License 2.0", "features": {"source": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "source_labels": {"feature": {"num_classes": 2, "names": ["non-oracle", "oracle"], "names_file": null, "id": null, "_type": "ClassLabel"}, "length": -1, "id": null, "_type": "Sequence"}, "rouge_scores": {"feature": {"dtype": "float32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "paper_id": {"dtype": "string", "id": null, "_type": "Value"}, "target": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": {"input": "source", "output": "target"}, "builder_name": "scitldr", "config_name": "Abstract", "version": {"version_str": "0.0.0", "description": null, "major": 0, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 2738065, "num_examples": 1992, "dataset_name": "scitldr"}, "test": {"name": "test", "num_bytes": 1073656, "num_examples": 618, "dataset_name": "scitldr"}, "validation": {"name": "validation", "num_bytes": 994876, "num_examples": 619, "dataset_name": "scitldr"}}, "download_checksums": {"https://raw.githubusercontent.com/allenai/scitldr/master/SciTLDR-Data/SciTLDR-A/train.jsonl": {"num_bytes": 3155015, "checksum": "b222771d387be585cfdf5ae957b36757138415a352e0a3e3b23f73f87c3b1119"}, "https://raw.githubusercontent.com/allenai/scitldr/master/SciTLDR-Data/SciTLDR-A/dev.jsonl": {"num_bytes": 1124865, "checksum": "3191fa98ccc09521332b7a1cd63b1930be4e8df125a235ccd31e40329709525e"}, "https://raw.githubusercontent.com/allenai/scitldr/master/SciTLDR-Data/SciTLDR-A/test.jsonl": {"num_bytes": 1204107, "checksum": "fb42dd6cd4f4a1928ae8a01a189456fbfe994a07e938bd49f68653933f6503c9"}}, "download_size": 5483987, "post_processing_size": null, "dataset_size": 4806597, "size_in_bytes": 10290584}, "AIC": {"description": "A new multi-target dataset of 5.4K TLDRs over 3.2K papers.\nSCITLDR contains both author-written and expert-derived TLDRs,\nwhere the latter are collected using a novel annotation protocol\nthat produces high-quality summaries while minimizing annotation burden.\n", "citation": "@article{cachola2020tldr,\n title={{TLDR}: Extreme Summarization of Scientific Documents},\n author={Isabel Cachola and Kyle Lo and Arman Cohan and Daniel S. Weld},\n journal={arXiv:2004.15011},\n year={2020},\n}\n", "homepage": "https://github.com/allenai/scitldr", "license": "Apache License 2.0", "features": {"source": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "source_labels": {"feature": {"num_classes": 2, "names": [0, 1], "names_file": null, "id": null, "_type": "ClassLabel"}, "length": -1, "id": null, "_type": "Sequence"}, "rouge_scores": {"feature": {"dtype": "float32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "paper_id": {"dtype": "string", "id": null, "_type": "Value"}, "ic": {"dtype": "bool_", "id": null, "_type": "Value"}, "target": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": {"input": "source", "output": "target"}, "builder_name": "scitldr", "config_name": "AIC", "version": {"version_str": "0.0.0", "description": null, "major": 0, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 14473822, "num_examples": 1992, "dataset_name": "scitldr"}, "test": {"name": "test", "num_bytes": 4822026, "num_examples": 618, "dataset_name": "scitldr"}, "validation": {"name": "validation", "num_bytes": 4476237, "num_examples": 619, "dataset_name": "scitldr"}}, "download_checksums": {"https://raw.githubusercontent.com/allenai/scitldr/master/SciTLDR-Data/SciTLDR-AIC/train.jsonl": {"num_bytes": 15569568, "checksum": "64b08af6de479671a12afd04770f66bcbc1c2c5f3098a08392b0fd7c1070d621"}, "https://raw.githubusercontent.com/allenai/scitldr/master/SciTLDR-Data/SciTLDR-AIC/dev.jsonl": {"num_bytes": 4811551, "checksum": "ac5168c27d25181fc17bb6f1fb41d11dbe30c627bebee14457feb3bad2c839dd"}, "https://raw.githubusercontent.com/allenai/scitldr/master/SciTLDR-Data/SciTLDR-AIC/test.jsonl": {"num_bytes": 5163989, "checksum": "7cb9230d3eb4863884762154918360d1c063aa18fc76de928801a14f4bcf4d37"}}, "download_size": 25545108, "post_processing_size": null, "dataset_size": 23772085, "size_in_bytes": 49317193}, "FullText": {"description": "A new multi-target dataset of 5.4K TLDRs over 3.2K papers.\nSCITLDR contains both author-written and expert-derived TLDRs,\nwhere the latter are collected using a novel annotation protocol\nthat produces high-quality summaries while minimizing annotation burden.\n", "citation": "@article{cachola2020tldr,\n title={{TLDR}: Extreme Summarization of Scientific Documents},\n author={Isabel Cachola and Kyle Lo and Arman Cohan and Daniel S. Weld},\n journal={arXiv:2004.15011},\n year={2020},\n}\n", "homepage": "https://github.com/allenai/scitldr", "license": "Apache License 2.0", "features": {"source": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "source_labels": {"feature": {"num_classes": 2, "names": ["non-oracle", "oracle"], "names_file": null, "id": null, "_type": "ClassLabel"}, "length": -1, "id": null, "_type": "Sequence"}, "rouge_scores": {"feature": {"dtype": "float32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "paper_id": {"dtype": "string", "id": null, "_type": "Value"}, "target": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": {"input": "source", "output": "target"}, "builder_name": "scitldr", "config_name": "FullText", "version": "0.0.0", "splits": {"train": {"name": "train", "num_bytes": 66917363, "num_examples": 1992, "dataset_name": "scitldr"}, "test": {"name": "test", "num_bytes": 20182554, "num_examples": 618, "dataset_name": "scitldr"}, "validation": {"name": "validation", "num_bytes": 18790651, "num_examples": 619, "dataset_name": "scitldr"}}, "download_checksums": {"https://raw.githubusercontent.com/allenai/scitldr/master/SciTLDR-Data/SciTLDR-FullText/train.jsonl": {"num_bytes": 71263949, "checksum": "e35461c1665cb4f7b46daba6dd5ac3cff03a61eb196e6ce9983edda44d867604"}, "https://raw.githubusercontent.com/allenai/scitldr/master/SciTLDR-Data/SciTLDR-FullText/dev.jsonl": {"num_bytes": 19111616, "checksum": "11c3fd77a7ec447adc44ca34c0fa41a7ab6bdacdf3b8e15748e6f8b8e4f698bf"}, "https://raw.githubusercontent.com/allenai/scitldr/master/SciTLDR-Data/SciTLDR-FullText/test.jsonl": {"num_bytes": 20528987, "checksum": "1584bd3f5fff5859cb8428cfbacc8d38c671f5fc6a24a8140ea5350cbd86a751"}}, "download_size": 110904552, "post_processing_size": null, "dataset_size": 105890568, "size_in_bytes": 216795120}}
dummy/AIC/0.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4f184cdf07cab1ddd90cd321785261cefdac82d3f2d0731fb25306a445251bc6
3
+ size 40496
dummy/Abstract/0.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0978db6412c8b2ebe7a0214f1c1a67d2e02b278f208b84631860f47bdd0d7788
3
+ size 10265
dummy/FullText/0.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:808e2c75c0803969f626806a8a3da0a28f9257e4682a0feb9981cf44af252de9
3
+ size 165874
scitldr.py ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
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
+ """Dataset for TLDR: Extreme Summarization of Scientific Documents"""
16
+
17
+ from __future__ import absolute_import, division, print_function
18
+
19
+ import json
20
+ import os
21
+
22
+ import datasets
23
+
24
+
25
+ _SOURCE = "source"
26
+ _TARGET = "target"
27
+
28
+ _CITATION = """\
29
+ @article{cachola2020tldr,
30
+ title={{TLDR}: Extreme Summarization of Scientific Documents},
31
+ author={Isabel Cachola and Kyle Lo and Arman Cohan and Daniel S. Weld},
32
+ journal={arXiv:2004.15011},
33
+ year={2020},
34
+ }
35
+ """
36
+
37
+ _DESCRIPTION = """\
38
+ A new multi-target dataset of 5.4K TLDRs over 3.2K papers.
39
+ SCITLDR contains both author-written and expert-derived TLDRs,
40
+ where the latter are collected using a novel annotation protocol
41
+ that produces high-quality summaries while minimizing annotation burden.
42
+ """
43
+
44
+
45
+ _LICENSE = "Apache License 2.0"
46
+
47
+ # TODO: Add link to the official dataset URLs here
48
+ # The HuggingFace dataset library don't host the datasets but only point to the original files
49
+ # This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
50
+ _URLs = {
51
+ "Abstract": "https://raw.githubusercontent.com/allenai/scitldr/master/SciTLDR-Data/SciTLDR-A/",
52
+ "AIC": "https://raw.githubusercontent.com/allenai/scitldr/master/SciTLDR-Data/SciTLDR-AIC/",
53
+ "FullText": "https://raw.githubusercontent.com/allenai/scitldr/master/SciTLDR-Data/SciTLDR-FullText/",
54
+ }
55
+
56
+ _TRAIN_DATA = "train.jsonl"
57
+ _TEST_DATA = "test.jsonl"
58
+ _VALID_DATA = "dev.jsonl"
59
+
60
+
61
+ # There are several preprocessing scripts given in the original SciTLDR GitHub repository to preprocess this data.
62
+ class Scitldr(datasets.GeneratorBasedBuilder):
63
+ """Dataset for TLDR: Extreme Summarization of Scientific Documents."""
64
+
65
+ VERSION = datasets.Version("1.1.0")
66
+
67
+ # You will be able to load one or the other configurations in the following list with
68
+ # data = datasets.load_dataset('scitldr', 'Abstract')
69
+ # data = datasets.load_dataset('scitldr', 'AIC')
70
+ BUILDER_CONFIGS = [
71
+ datasets.BuilderConfig(name="Abstract", description="This part contains only abstracts of the paper"),
72
+ datasets.BuilderConfig(
73
+ name="AIC",
74
+ description="This part contains Abstracts, Introduction and Conclusion (AIC) sections of the paper",
75
+ ),
76
+ datasets.BuilderConfig(name="FullText", description="This part contains the full text of the paper"),
77
+ ]
78
+
79
+ DEFAULT_CONFIG_NAME = (
80
+ "Abstract" # It's not mandatory to have a default configuration. Just use one if it make sense.
81
+ )
82
+
83
+ def _info(self):
84
+ if self.config.name == "AIC": # This is the name of the configuration selected in BUILDER_CONFIGS above
85
+ features = datasets.Features(
86
+ {
87
+ "source": datasets.Sequence(datasets.Value("string")),
88
+ "source_labels": datasets.Sequence(datasets.ClassLabel(num_classes=2, names=[0, 1])),
89
+ "rouge_scores": datasets.Sequence(datasets.Value("float32")),
90
+ "paper_id": datasets.Value("string"),
91
+ "ic": datasets.Value("bool_"),
92
+ "target": datasets.features.Sequence(datasets.Value("string"))
93
+ # These are the features of your dataset like images, labels ...
94
+ }
95
+ )
96
+ else:
97
+ features = datasets.Features(
98
+ {
99
+ "source": datasets.Sequence(datasets.Value("string")),
100
+ "source_labels": datasets.Sequence(
101
+ datasets.ClassLabel(num_classes=2, names=["non-oracle", "oracle"])
102
+ ),
103
+ "rouge_scores": datasets.Sequence(datasets.Value("float32")),
104
+ "paper_id": datasets.Value("string"),
105
+ "target": datasets.Sequence(datasets.Value("string"))
106
+ # These are the features of your dataset like images, labels ...
107
+ }
108
+ )
109
+ return datasets.DatasetInfo(
110
+ # This is the description that will appear on the datasets page.
111
+ description=_DESCRIPTION,
112
+ # This defines the different columns of the dataset and their types
113
+ features=features, # Here we define them above because they are different between the two configurations
114
+ # If there's a common (input, target) tuple from the features,
115
+ # specify them here. They'll be used if as_supervised=True in
116
+ # builder.as_dataset.
117
+ supervised_keys=(_SOURCE, _TARGET),
118
+ # Homepage of the dataset for documentation
119
+ homepage="https://github.com/allenai/scitldr",
120
+ # License for the dataset if available
121
+ license=_LICENSE,
122
+ # Citation for the dataset
123
+ citation=_CITATION,
124
+ )
125
+
126
+ def _split_generators(self, dl_manager):
127
+ """Returns SplitGenerators."""
128
+ # TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
129
+ # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
130
+
131
+ # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLs
132
+ # It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
133
+ # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
134
+ urls = {
135
+ "train": os.path.join(_URLs[self.config.name], _TRAIN_DATA),
136
+ "valid": os.path.join(_URLs[self.config.name], _VALID_DATA),
137
+ "test": os.path.join(_URLs[self.config.name], _TEST_DATA),
138
+ }
139
+ data_dir = dl_manager.download_and_extract(urls)
140
+ return [
141
+ datasets.SplitGenerator(
142
+ name=datasets.Split.TRAIN,
143
+ # These kwargs will be passed to _generate_examples
144
+ gen_kwargs={"filepath": os.path.join(data_dir["train"]), "split": "train"},
145
+ ),
146
+ datasets.SplitGenerator(
147
+ name=datasets.Split.TEST,
148
+ # These kwargs will be passed to _generate_examples
149
+ gen_kwargs={"filepath": os.path.join(data_dir["test"]), "split": "test"},
150
+ ),
151
+ datasets.SplitGenerator(
152
+ name=datasets.Split.VALIDATION,
153
+ # These kwargs will be passed to _generate_examples
154
+ gen_kwargs={"filepath": os.path.join(data_dir["valid"]), "split": "dev"},
155
+ ),
156
+ ]
157
+
158
+ def _generate_examples(self, filepath, split):
159
+ """ Yields examples. """
160
+ # TODO: This method will receive as arguments the `gen_kwargs` defined in the previous `_split_generators` method.
161
+ # It is in charge of opening the given file and yielding (key, example) tuples from the dataset
162
+ # The key is not important, it's more here for legacy reason (legacy from tfds)
163
+
164
+ with open(filepath, encoding="utf-8") as f:
165
+ for id_, row in enumerate(f):
166
+ data = json.loads(row)
167
+ if self.config.name == "AIC":
168
+ yield id_, {
169
+ "source": data["source"],
170
+ "source_labels": data["source_labels"],
171
+ "rouge_scores": data["rouge_scores"],
172
+ "paper_id": data["paper_id"],
173
+ "ic": True if data["ic"] else False,
174
+ "target": data["target"],
175
+ }
176
+ else:
177
+ yield id_, {
178
+ "source": data["source"],
179
+ "source_labels": data["source_labels"],
180
+ "rouge_scores": data["rouge_scores"],
181
+ "paper_id": data["paper_id"],
182
+ "target": data["target"],
183
+ }