ccdv commited on
Commit
a31f645
1 Parent(s): 7d5802b
Files changed (7) hide show
  1. .gitattributes +4 -0
  2. README.md +64 -0
  3. arxiv-summarization.py +117 -0
  4. test.zip +3 -0
  5. train.zip +3 -0
  6. val.zip +3 -0
  7. vocab.zip +3 -0
.gitattributes CHANGED
@@ -25,3 +25,7 @@ saved_model/**/* 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
 
 
 
 
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
28
+ val.zip filter=lfs diff=lfs merge=lfs -text
29
+ vocab.zip filter=lfs diff=lfs merge=lfs -text
30
+ test.zip filter=lfs diff=lfs merge=lfs -text
31
+ train.zip filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ languages:
3
+ - en
4
+ multilinguality:
5
+ - monolingual
6
+ size_categories:
7
+ - 100K<n<1M
8
+ task_categories:
9
+ - conditional-text-generation
10
+ task_ids:
11
+ - summarization
12
+ ---
13
+
14
+ # Arxiv dataset for summarization
15
+
16
+ Dataset for summarization of long documents.\
17
+ Adapted from this [repo](https://github.com/armancohan/long-summarization).\
18
+ Note that original data are pre-tokenized so this dataset returns " ".join(text).\
19
+ This dataset is compatible with the [`run_summarization.py`](https://github.com/huggingface/transformers/tree/master/examples/pytorch/summarization) script from Transformers if you add this line to the `summarization_name_mapping` variable:
20
+ ```python
21
+ "ccdv/arxiv-summarization": ("article", "abstract")
22
+ ```
23
+
24
+ ### Data Fields
25
+
26
+ - `id`: paper id
27
+ - `article`: a string containing the body of the paper
28
+ - `abstract`: a string containing the abstract of the paper
29
+
30
+ ### Data Splits
31
+
32
+ This dataset has 3 splits: _train_, _validation_, and _test_. \
33
+ Token counts are white space based.
34
+
35
+ | Dataset Split | Number of Instances | Avg. tokens |
36
+ | ------------- | --------------------|:----------------------|
37
+ | Train | 119,924 | 3043 / 215 |
38
+ | Validation | 6,633 | 3111 / 216 |
39
+ | Test | 6,658 | 3092 / 219 |
40
+
41
+
42
+ # Cite original article
43
+ ```
44
+ @inproceedings{cohan-etal-2018-discourse,
45
+ title = "A Discourse-Aware Attention Model for Abstractive Summarization of Long Documents",
46
+ author = "Cohan, Arman and
47
+ Dernoncourt, Franck and
48
+ Kim, Doo Soon and
49
+ Bui, Trung and
50
+ Kim, Seokhwan and
51
+ Chang, Walter and
52
+ Goharian, Nazli",
53
+ 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)",
54
+ month = jun,
55
+ year = "2018",
56
+ address = "New Orleans, Louisiana",
57
+ publisher = "Association for Computational Linguistics",
58
+ url = "https://aclanthology.org/N18-2097",
59
+ doi = "10.18653/v1/N18-2097",
60
+ pages = "615--621",
61
+ 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.",
62
+ }
63
+ ```
64
+
arxiv-summarization.py ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ Arxiv 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 ArxivSummarizationConfig(datasets.BuilderConfig):
41
+ """BuilderConfig for ArxivSummarization."""
42
+
43
+ def __init__(self, **kwargs):
44
+ """BuilderConfig for ArxivSummarization.
45
+ Args:
46
+ **kwargs: keyword arguments forwarded to super.
47
+ """
48
+ super(ArxivSummarizationConfig, self).__init__(**kwargs)
49
+
50
+
51
+ class ArxivSummarizationDataset(datasets.GeneratorBasedBuilder):
52
+ """ArxivSummarization Dataset."""
53
+
54
+ _TRAIN_FILE = "train.zip"
55
+ _VAL_FILE = "val.zip"
56
+ _TEST_FILE = "test.zip"
57
+
58
+ BUILDER_CONFIGS = [
59
+ ArxivSummarizationConfig(
60
+ name="arxiv",
61
+ version=datasets.Version("1.0.0"),
62
+ description="Arxiv dataset for summarization",
63
+ ),
64
+ ]
65
+
66
+ DEFAULT_CONFIG_NAME = "arxiv"
67
+
68
+ def _info(self):
69
+ # Should return a datasets.DatasetInfo object
70
+ return datasets.DatasetInfo(
71
+ description=_DESCRIPTION,
72
+ features=datasets.Features(
73
+ {
74
+ _ARTICLE: datasets.Value("string"),
75
+ _ABSTRACT: datasets.Value("string"),
76
+ #"id": datasets.Value("string"),
77
+ }
78
+ ),
79
+ supervised_keys=None,
80
+ homepage="https://github.com/armancohan/long-summarization",
81
+ citation=_CITATION,
82
+ )
83
+
84
+ def _split_generators(self, dl_manager):
85
+
86
+ train_path = dl_manager.download_and_extract(self._TRAIN_FILE) + "/train.txt"
87
+ val_path = dl_manager.download_and_extract(self._VAL_FILE) + "/val.txt"
88
+ test_path = dl_manager.download_and_extract(self._TEST_FILE) + "/test.txt"
89
+
90
+ return [
91
+ datasets.SplitGenerator(
92
+ name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path}
93
+ ),
94
+ datasets.SplitGenerator(
95
+ name=datasets.Split.VALIDATION, gen_kwargs={"filepath": val_path}
96
+ ),
97
+ datasets.SplitGenerator(
98
+ name=datasets.Split.TEST, gen_kwargs={"filepath": test_path}
99
+ ),
100
+ ]
101
+
102
+ def _generate_examples(self, filepath):
103
+ """Generate ArxivSummarization examples."""
104
+ with open(filepath, encoding="utf-8") as f:
105
+ for id_, row in enumerate(f):
106
+ data = json.loads(row)
107
+
108
+ """
109
+ 'article_id': str,
110
+ 'abstract_text': List[str],
111
+ 'article_text': List[str],
112
+ 'section_names': List[str],
113
+ 'sections': List[List[str]]
114
+ """
115
+ article = data["article_text"]
116
+ abstract = data["abstract_text"]
117
+ yield id_, {"article": ' '.join(article), "abstract": ' '.join(abstract)}
test.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8ee7cf45fde92768515e2f3170ecb1cf9bdae60169f2b4d4f9b60f1f628e862c
3
+ size 102183593
train.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fe5a49635c90f3bc75deeee5b8272c64fb123a59b1462ca2f3cca4a6e94cc78b
3
+ size 3364100438
val.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2e7d0cfebe4dc85868dff5553ad8efb09933efbd773eb66ce07cce81b9523791
3
+ size 102038141
vocab.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4be27a7b188a365672a2c1ed14f3095de3eea396cf8d3efaf93a034e6f6a3771
3
+ size 1079675