albertvillanova HF staff commited on
Commit
6b30a2c
1 Parent(s): 26155cc

Convert dataset to Parquet (#7)

Browse files

- Convert dataset to Parquet (5096f0be27dcd3526974a1a89664ac23989f67fd)
- Add 'document' config data files (b62568e5b27a0456d153c2b833735a11e520eb03)
- Delete data file (804f1680f5a93aefb91898a64fa9b7c86c421a6e)
- Delete loading script (25083e46a67562b368874272d2fcf68e13f340d4)
- Delete data file (f795236288cc4c09a9c5ffe29090399b45732903)
- Delete data file (db537d8d0bf73d848195c9c93ece889e99d49dd0)
- Delete data file (655807e6e64707616ef84c675dfb55be50e77803)

README.md CHANGED
@@ -11,6 +11,61 @@ task_categories:
11
  task_ids: []
12
  tags:
13
  - conditional-text-generation
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  ---
15
 
16
  # PubMed dataset for summarization
 
11
  task_ids: []
12
  tags:
13
  - conditional-text-generation
14
+ dataset_info:
15
+ - config_name: document
16
+ features:
17
+ - name: article
18
+ dtype: string
19
+ - name: abstract
20
+ dtype: string
21
+ splits:
22
+ - name: train
23
+ num_bytes: 2236406736
24
+ num_examples: 119924
25
+ - name: validation
26
+ num_bytes: 126510743
27
+ num_examples: 6633
28
+ - name: test
29
+ num_bytes: 126296182
30
+ num_examples: 6658
31
+ download_size: 1154975484
32
+ dataset_size: 2489213661
33
+ - config_name: section
34
+ features:
35
+ - name: article
36
+ dtype: string
37
+ - name: abstract
38
+ dtype: string
39
+ splits:
40
+ - name: train
41
+ num_bytes: 2257744955
42
+ num_examples: 119924
43
+ - name: validation
44
+ num_bytes: 127711559
45
+ num_examples: 6633
46
+ - name: test
47
+ num_bytes: 127486937
48
+ num_examples: 6658
49
+ download_size: 1163165290
50
+ dataset_size: 2512943451
51
+ configs:
52
+ - config_name: document
53
+ data_files:
54
+ - split: train
55
+ path: document/train-*
56
+ - split: validation
57
+ path: document/validation-*
58
+ - split: test
59
+ path: document/test-*
60
+ - config_name: section
61
+ data_files:
62
+ - split: train
63
+ path: section/train-*
64
+ - split: validation
65
+ path: section/validation-*
66
+ - split: test
67
+ path: section/test-*
68
+ default: true
69
  ---
70
 
71
  # PubMed dataset for summarization
vocab.zip → document/test-00000-of-00001.parquet RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:5d25daab57cafba29ff14d3ecd45bdf8d0a3fa882426391f61a891f0817b7a73
3
- size 295286
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d315d092a3b2d9eeec9cc5869f5526ade3c5b4495693f0f8c7f1de1feeb8e6c3
3
+ size 58464984
train.zip → document/train-00000-of-00005.parquet RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:988355271552520ad30fab4c2d63a3ef8d985a179e30089da766ee04ec017a10
3
- size 779257354
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4591b521c623947b13e7ad3afd6e86a0f23652948678ed7d0e83283f82725aba
3
+ size 208410135
document/train-00001-of-00005.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2a277b141dd43922f27a4fc117e46aa5912013ab233d3a88a652cbe9e8b197e6
3
+ size 206758528
document/train-00002-of-00005.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:23c200675efc463ee64fd2f715d67b0ed4d9ae6b9a36a986c851870af204e454
3
+ size 205066365
document/train-00003-of-00005.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:84d575b13333413de14481d86e9c89be8758ab560a2185f7539f516b55b8ad16
3
+ size 209659032
document/train-00004-of-00005.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:57e3a00dddda86e39cf0ea48c96553074d3e021876e5f5c5fb65a353c87d5a85
3
+ size 208046540
test.zip → document/validation-00000-of-00001.parquet RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:fa6666b57d2335a1962f2d8a8511a7bf5f6e457215323645be62457ce8bbfcdf
3
- size 43787908
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9c748eda2cf4840cdcc272afd917529738ad65ef1cc7b1d79ca8cd3f243ef662
3
+ size 58569900
pubmed-summarization.py DELETED
@@ -1,129 +0,0 @@
1
- import json
2
- import os
3
-
4
- import datasets
5
- from datasets.tasks import TextClassification
6
-
7
- _CITATION = None
8
-
9
-
10
- _DESCRIPTION = """
11
- PubMed dataset for summarization.
12
- From paper: A Discourse-Aware Attention Model for Abstractive Summarization of Long Documents" by A. Cohan et al.
13
- See: https://aclanthology.org/N18-2097.pdf
14
- See: https://github.com/armancohan/long-summarization
15
- """
16
- _CITATION = """\
17
- @inproceedings{cohan-etal-2018-discourse,
18
- title = "A Discourse-Aware Attention Model for Abstractive Summarization of Long Documents",
19
- author = "Cohan, Arman and
20
- Dernoncourt, Franck and
21
- Kim, Doo Soon and
22
- Bui, Trung and
23
- Kim, Seokhwan and
24
- Chang, Walter and
25
- Goharian, Nazli",
26
- booktitle = "Proceedings of the 2018 Conference of the North {A}merican Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 2 (Short Papers)",
27
- month = jun,
28
- year = "2018",
29
- address = "New Orleans, Louisiana",
30
- publisher = "Association for Computational Linguistics",
31
- url = "https://aclanthology.org/N18-2097",
32
- doi = "10.18653/v1/N18-2097",
33
- pages = "615--621",
34
- abstract = "Neural abstractive summarization models have led to promising results in summarizing relatively short documents. We propose the first model for abstractive summarization of single, longer-form documents (e.g., research papers). Our approach consists of a new hierarchical encoder that models the discourse structure of a document, and an attentive discourse-aware decoder to generate the summary. Empirical results on two large-scale datasets of scientific papers show that our model significantly outperforms state-of-the-art models.",
35
- }
36
- """
37
- _ABSTRACT = "abstract"
38
- _ARTICLE = "article"
39
-
40
- class PubMedSummarizationConfig(datasets.BuilderConfig):
41
- """BuilderConfig for PubMedSummarization."""
42
-
43
- def __init__(self, **kwargs):
44
- """BuilderConfig for PubMedSummarization.
45
- Args:
46
- **kwargs: keyword arguments forwarded to super.
47
- """
48
- super(PubMedSummarizationConfig, self).__init__(**kwargs)
49
-
50
-
51
- class PubMedSummarizationDataset(datasets.GeneratorBasedBuilder):
52
- """PubMedSummarization Dataset."""
53
-
54
- _TRAIN_FILE = "train.zip"
55
- _VAL_FILE = "val.zip"
56
- _TEST_FILE = "test.zip"
57
-
58
- BUILDER_CONFIGS = [
59
- PubMedSummarizationConfig(
60
- name="section",
61
- version=datasets.Version("1.0.0"),
62
- description="PubMed dataset for summarization, concat sections",
63
- ),
64
- PubMedSummarizationConfig(
65
- name="document",
66
- version=datasets.Version("1.0.0"),
67
- description="PubMed dataset for summarization, document",
68
- ),
69
- ]
70
-
71
- DEFAULT_CONFIG_NAME = "section"
72
-
73
- def _info(self):
74
- # Should return a datasets.DatasetInfo object
75
- return datasets.DatasetInfo(
76
- description=_DESCRIPTION,
77
- features=datasets.Features(
78
- {
79
- _ARTICLE: datasets.Value("string"),
80
- _ABSTRACT: datasets.Value("string"),
81
- #"id": datasets.Value("string"),
82
- }
83
- ),
84
- supervised_keys=None,
85
- homepage="https://github.com/armancohan/long-summarization",
86
- citation=_CITATION,
87
- )
88
-
89
- def _split_generators(self, dl_manager):
90
-
91
- train_path = os.path.join(dl_manager.download_and_extract(self._TRAIN_FILE), "train.txt")
92
- val_path = os.path.join(dl_manager.download_and_extract(self._VAL_FILE), "val.txt")
93
- test_path = os.path.join(dl_manager.download_and_extract(self._TEST_FILE), "test.txt")
94
-
95
- return [
96
- datasets.SplitGenerator(
97
- name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path}
98
- ),
99
- datasets.SplitGenerator(
100
- name=datasets.Split.VALIDATION, gen_kwargs={"filepath": val_path}
101
- ),
102
- datasets.SplitGenerator(
103
- name=datasets.Split.TEST, gen_kwargs={"filepath": test_path}
104
- ),
105
- ]
106
-
107
- def _generate_examples(self, filepath):
108
- """Generate PubMedSummarization examples."""
109
- with open(filepath, encoding="utf-8") as f:
110
- for id_, row in enumerate(f):
111
- data = json.loads(row)
112
-
113
- """
114
- 'article_id': str,
115
- 'abstract_text': List[str],
116
- 'article_text': List[str],
117
- 'section_names': List[str],
118
- 'sections': List[List[str]]
119
- """
120
- if self.config.name == "document":
121
- article = [d.strip() for d in data["article_text"]]
122
- article = " ".join(article)
123
- else:
124
- article = [item.strip() for sublist in data["sections"] for item in sublist]
125
- article = " \n ".join(article)
126
-
127
- abstract = [ab.replace("<S>", "").replace("</S>", "").strip() for ab in data["abstract_text"]]
128
- abstract = " \n ".join(abstract)
129
- yield id_, {"article": article, "abstract": abstract}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
val.zip → section/test-00000-of-00001.parquet RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:37a0b6b2c2f9b3fc8296f2d244ec813664571e7ef5bec8cf015626c83e485460
3
- size 43705498
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2a3a6a3c5d2afb7eb7839d0fc941cca45b2dce1f4ec798e6bfa79682f2c62c32
3
+ size 58908316
section/train-00000-of-00005.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bfce0133825830eeaa32d06eec442f1f85270c288bc8288f2604592a02b1a2f9
3
+ size 209788771
section/train-00001-of-00005.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7bcd281e86f1a9a4e56e7892568d7b4351a8e07cadc6a565a1be23278ccd31d3
3
+ size 208167819
section/train-00002-of-00005.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7aeee964d8e0e34c31c9abbf43035159ba118475576b8e114a01b401fa578175
3
+ size 206629754
section/train-00003-of-00005.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1d4b498f89ee6ffe36b18b8e5ce03a74cf01b16279de97f26de074421d8bcea3
3
+ size 211142550
section/train-00004-of-00005.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b46f6df0703c2840ffb65abada953fad9dd9041f5293b6d9c7d454c793df24a3
3
+ size 209529521
section/validation-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:118ab3453ef928a86bc51e790d36245225b830629512384388275261a0b7cd8a
3
+ size 58998559