Commit
•
7fbf41b
0
Parent(s):
Update files from the datasets library (from 1.2.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.2.0
- .gitattributes +27 -0
- README.md +190 -0
- dataset_infos.json +1 -0
- dummy/xsum_factuality/1.1.0/dummy_data.zip +3 -0
- dummy/xsum_faithfulness/1.1.0/dummy_data.zip +3 -0
- xsum_factuality.py +188 -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,190 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
annotations_creators:
|
3 |
+
- crowdsourced
|
4 |
+
language_creators:
|
5 |
+
- crowdsourced
|
6 |
+
languages:
|
7 |
+
- en
|
8 |
+
licenses:
|
9 |
+
- cc-by-4-0
|
10 |
+
multilinguality:
|
11 |
+
- monolingual
|
12 |
+
size_categories:
|
13 |
+
- 1K<n<10K
|
14 |
+
source_datasets:
|
15 |
+
- extended|other-xsum
|
16 |
+
task_categories:
|
17 |
+
- conditional-text-generation
|
18 |
+
task_ids:
|
19 |
+
- summarization
|
20 |
+
---
|
21 |
+
|
22 |
+
# Dataset Card for XSum Hallucination Annotations
|
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://research.google/tools/datasets/xsum-hallucination-annotations/
|
50 |
+
- **Repository:** https://github.com/google-research-datasets/xsum_hallucination_annotations
|
51 |
+
- **Paper:** https://www.aclweb.org/anthology/2020.acl-main.173.pdf
|
52 |
+
- **Leaderboard:** NA
|
53 |
+
- **Point of Contact:** [[email protected]](mailto:[email protected])
|
54 |
+
|
55 |
+
### Dataset Summary
|
56 |
+
|
57 |
+
Neural abstractive summarization models are highly prone to hallucinate content that is unfaithful to the input document. The popular metric such as ROUGE fails to show the severity of the problem. The dataset consists of faithfulness and factuality annotations of abstractive summaries for the XSum dataset. The dataset has crowdsourced 3 judgements for each of 500 x 5 document-system pairs. This will be a valuable resource to the abstractive summarization community.
|
58 |
+
|
59 |
+
### Supported Tasks and Leaderboards
|
60 |
+
|
61 |
+
[More Information Needed]
|
62 |
+
|
63 |
+
### Languages
|
64 |
+
|
65 |
+
[More Information Needed]
|
66 |
+
|
67 |
+
## Dataset Structure
|
68 |
+
|
69 |
+
### Data Instances
|
70 |
+
|
71 |
+
##### Faithfulness annotations dataset
|
72 |
+
|
73 |
+
```
|
74 |
+
{
|
75 |
+
'bbcid': 34687720,
|
76 |
+
'hallucinated_span_end': 114,
|
77 |
+
'hallucinated_span_start': 1,
|
78 |
+
'hallucination_type': 1,
|
79 |
+
'summary': 'rory mcilroy will take a one-shot lead into the final round of the wgc-hsbc champions after carding a three-under',
|
80 |
+
'system': 'BERTS2S',
|
81 |
+
'worker_id': 'wid_0'
|
82 |
+
}
|
83 |
+
```
|
84 |
+
|
85 |
+
##### Factuality annotations dataset
|
86 |
+
|
87 |
+
```
|
88 |
+
{
|
89 |
+
'bbcid': 29911712,
|
90 |
+
'is_factual': 0,
|
91 |
+
'summary': 'more than 50 pupils at a bristol academy have been sent home from school because of a lack of uniform.',
|
92 |
+
'system': 'BERTS2S',
|
93 |
+
'worker_id': 'wid_0'
|
94 |
+
}
|
95 |
+
```
|
96 |
+
|
97 |
+
### Data Fields
|
98 |
+
|
99 |
+
##### Faithfulness annotations dataset
|
100 |
+
|
101 |
+
Raters are shown the news article and the system summary, and are tasked with identifying and annotating the spans that aren't supported by the input article. The file contains the following columns:
|
102 |
+
|
103 |
+
|
104 |
+
- bbcid: Document id in the XSum corpus.
|
105 |
+
- system: Name of neural summarizer.
|
106 |
+
- summary: Summary generated by ‘system’.
|
107 |
+
- hallucination_type: Type of hallucination: intrinsic (0) or extrinsic (1)
|
108 |
+
- hallucinated_span: Hallucinated span in the ‘summary’.
|
109 |
+
- hallucinated_span_start: Index of the start of the hallucinated span.
|
110 |
+
- hallucinated_span_end: Index of the end of the hallucinated span.
|
111 |
+
- worker_id: 'wid_0', 'wid_1', 'wid_2'
|
112 |
+
|
113 |
+
|
114 |
+
The `hallucination_type` column has NULL value for some entries which have been replaced iwth `-1`.
|
115 |
+
|
116 |
+
##### Factuality annotations dataset
|
117 |
+
|
118 |
+
Raters are shown the news article and the hallucinated system summary, and are tasked with assessing the summary whether it is factual or not. The file contains the following columns:
|
119 |
+
|
120 |
+
|
121 |
+
- bbcid: Document id in the XSum corpus.
|
122 |
+
- system: Name of neural summarizer.
|
123 |
+
- summary: Summary generated by ‘system’.
|
124 |
+
- is_factual: yes (1) or no (0)
|
125 |
+
- worker_id: 'wid_0', 'wid_1', 'wid_2'
|
126 |
+
|
127 |
+
|
128 |
+
The `is_factual` column has NULL value for some entries which have been replaced iwth `-1`.
|
129 |
+
|
130 |
+
### Data Splits
|
131 |
+
|
132 |
+
[More Information Needed]
|
133 |
+
|
134 |
+
## Dataset Creation
|
135 |
+
|
136 |
+
### Curation Rationale
|
137 |
+
|
138 |
+
[More Information Needed]
|
139 |
+
|
140 |
+
### Source Data
|
141 |
+
|
142 |
+
#### Initial Data Collection and Normalization
|
143 |
+
|
144 |
+
[More Information Needed]
|
145 |
+
|
146 |
+
#### Who are the source language producers?
|
147 |
+
|
148 |
+
[More Information Needed]
|
149 |
+
|
150 |
+
### Annotations
|
151 |
+
|
152 |
+
#### Annotation process
|
153 |
+
|
154 |
+
[More Information Needed]
|
155 |
+
|
156 |
+
#### Who are the annotators?
|
157 |
+
|
158 |
+
[More Information Needed]
|
159 |
+
|
160 |
+
### Personal and Sensitive Information
|
161 |
+
|
162 |
+
[More Information Needed]
|
163 |
+
|
164 |
+
## Considerations for Using the Data
|
165 |
+
|
166 |
+
### Social Impact of Dataset
|
167 |
+
|
168 |
+
[More Information Needed]
|
169 |
+
|
170 |
+
### Discussion of Biases
|
171 |
+
|
172 |
+
[More Information Needed]
|
173 |
+
|
174 |
+
### Other Known Limitations
|
175 |
+
|
176 |
+
[More Information Needed]
|
177 |
+
|
178 |
+
## Additional Information
|
179 |
+
|
180 |
+
### Dataset Curators
|
181 |
+
|
182 |
+
[More Information Needed]
|
183 |
+
|
184 |
+
### Licensing Information
|
185 |
+
|
186 |
+
[More Information Needed]
|
187 |
+
|
188 |
+
### Citation Information
|
189 |
+
|
190 |
+
[More Information Needed]
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"xsum_factuality": {"description": "Neural abstractive summarization models are highly prone to hallucinate content that is unfaithful to the input\ndocument. The popular metric such as ROUGE fails to show the severity of the problem. The dataset consists of\nfaithfulness and factuality annotations of abstractive summaries for the XSum dataset. We have crowdsourced 3 judgements\n for each of 500 x 5 document-system pairs. This will be a valuable resource to the abstractive summarization community.\n", "citation": "@InProceedings{maynez_acl20,\n author = \"Joshua Maynez and Shashi Narayan and Bernd Bohnet and Ryan Thomas Mcdonald\",\n title = \"On Faithfulness and Factuality in Abstractive Summarization\",\n booktitle = \"Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics\",\n year = \"2020\",\n pages = \"1906--1919\",\n address = \"Online\",\n}\n", "homepage": "https://research.google/tools/datasets/xsum-hallucination-annotations/", "license": "https://creativecommons.org/licenses/by/4.0/", "features": {"bbcid": {"dtype": "int32", "id": null, "_type": "Value"}, "system": {"dtype": "string", "id": null, "_type": "Value"}, "summary": {"dtype": "string", "id": null, "_type": "Value"}, "is_factual": {"num_classes": 2, "names": ["no", "yes"], "names_file": null, "id": null, "_type": "ClassLabel"}, "worker_id": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "builder_name": "xsum_factuality", "config_name": "xsum_factuality", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 800027, "num_examples": 5597, "dataset_name": "xsum_factuality"}}, "download_checksums": {"https://raw.githubusercontent.com/google-research-datasets/xsum_hallucination_annotations/master/factuality_annotations_xsum_summaries.csv": {"num_bytes": 759614, "checksum": "f0ace0a9b52cacaa632ded3d07a355b7991383ce28fdd9fcbbf08a8523695ecb"}, "https://raw.githubusercontent.com/google-research-datasets/xsum_hallucination_annotations/master/hallucination_annotations_xsum_summaries.csv": {"num_bytes": 2105145, "checksum": "fa7fb66a36cc0f32ede4135985d0d65591dc2a8d21103a0bacd0583d77d4c8ea"}}, "download_size": 2864759, "post_processing_size": null, "dataset_size": 800027, "size_in_bytes": 3664786}, "xsum_faithfulness": {"description": "Neural abstractive summarization models are highly prone to hallucinate content that is unfaithful to the input\ndocument. The popular metric such as ROUGE fails to show the severity of the problem. The dataset consists of\nfaithfulness and factuality annotations of abstractive summaries for the XSum dataset. We have crowdsourced 3 judgements\n for each of 500 x 5 document-system pairs. This will be a valuable resource to the abstractive summarization community.\n", "citation": "@InProceedings{maynez_acl20,\n author = \"Joshua Maynez and Shashi Narayan and Bernd Bohnet and Ryan Thomas Mcdonald\",\n title = \"On Faithfulness and Factuality in Abstractive Summarization\",\n booktitle = \"Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics\",\n year = \"2020\",\n pages = \"1906--1919\",\n address = \"Online\",\n}\n", "homepage": "https://research.google/tools/datasets/xsum-hallucination-annotations/", "license": "https://creativecommons.org/licenses/by/4.0/", "features": {"bbcid": {"dtype": "int32", "id": null, "_type": "Value"}, "system": {"dtype": "string", "id": null, "_type": "Value"}, "summary": {"dtype": "string", "id": null, "_type": "Value"}, "hallucination_type": {"num_classes": 2, "names": ["intrinsic", "extrinsic"], "names_file": null, "id": null, "_type": "ClassLabel"}, "hallucinated_span_start": {"dtype": "int32", "id": null, "_type": "Value"}, "hallucinated_span_end": {"dtype": "int32", "id": null, "_type": "Value"}, "worker_id": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "builder_name": "xsum_factuality", "config_name": "xsum_faithfulness", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1750325, "num_examples": 11185, "dataset_name": "xsum_factuality"}}, "download_checksums": {"https://raw.githubusercontent.com/google-research-datasets/xsum_hallucination_annotations/master/factuality_annotations_xsum_summaries.csv": {"num_bytes": 759614, "checksum": "f0ace0a9b52cacaa632ded3d07a355b7991383ce28fdd9fcbbf08a8523695ecb"}, "https://raw.githubusercontent.com/google-research-datasets/xsum_hallucination_annotations/master/hallucination_annotations_xsum_summaries.csv": {"num_bytes": 2105145, "checksum": "fa7fb66a36cc0f32ede4135985d0d65591dc2a8d21103a0bacd0583d77d4c8ea"}}, "download_size": 2864759, "post_processing_size": null, "dataset_size": 1750325, "size_in_bytes": 4615084}}
|
dummy/xsum_factuality/1.1.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9b54a58fa30b61b20fc4f8ef3b4e7faeccee8c98fa5743ed5564262444440791
|
3 |
+
size 638
|
dummy/xsum_faithfulness/1.1.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:51a68bbfa7aaff2058e0ab13f28a6b109125593423010d54683ce379084364f6
|
3 |
+
size 725
|
xsum_factuality.py
ADDED
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
"""XSum Hallucination Annotations: Faithfulness and factuality annotations of XSum summaries"""
|
16 |
+
|
17 |
+
from __future__ import absolute_import, division, print_function
|
18 |
+
|
19 |
+
import csv
|
20 |
+
import os
|
21 |
+
|
22 |
+
import datasets
|
23 |
+
|
24 |
+
|
25 |
+
_CITATION = """\
|
26 |
+
@InProceedings{maynez_acl20,
|
27 |
+
author = "Joshua Maynez and Shashi Narayan and Bernd Bohnet and Ryan Thomas Mcdonald",
|
28 |
+
title = "On Faithfulness and Factuality in Abstractive Summarization",
|
29 |
+
booktitle = "Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics",
|
30 |
+
year = "2020",
|
31 |
+
pages = "1906--1919",
|
32 |
+
address = "Online",
|
33 |
+
}
|
34 |
+
"""
|
35 |
+
|
36 |
+
_DESCRIPTION = """\
|
37 |
+
Neural abstractive summarization models are highly prone to hallucinate content that is unfaithful to the input
|
38 |
+
document. The popular metric such as ROUGE fails to show the severity of the problem. The dataset consists of
|
39 |
+
faithfulness and factuality annotations of abstractive summaries for the XSum dataset. We have crowdsourced 3 judgements
|
40 |
+
for each of 500 x 5 document-system pairs. This will be a valuable resource to the abstractive summarization community.
|
41 |
+
"""
|
42 |
+
|
43 |
+
_HOMEPAGE = "https://research.google/tools/datasets/xsum-hallucination-annotations/"
|
44 |
+
|
45 |
+
_LICENSE = "https://creativecommons.org/licenses/by/4.0/"
|
46 |
+
|
47 |
+
_URL = "https://raw.githubusercontent.com/google-research-datasets/xsum_hallucination_annotations/master/"
|
48 |
+
_URLs = {
|
49 |
+
"factuality": _URL + "factuality_annotations_xsum_summaries.csv",
|
50 |
+
"hallucination": _URL + "hallucination_annotations_xsum_summaries.csv",
|
51 |
+
}
|
52 |
+
|
53 |
+
|
54 |
+
class XsumFactualityConfig(datasets.BuilderConfig):
|
55 |
+
"""BuilderConfig for XsumFactuality"""
|
56 |
+
|
57 |
+
def __init__(self, **kwargs):
|
58 |
+
"""BuilderConfig for XsumFactuality.
|
59 |
+
Args:
|
60 |
+
**kwargs: keyword arguments forwarded to super.
|
61 |
+
"""
|
62 |
+
super(XsumFactualityConfig, self).__init__(**kwargs)
|
63 |
+
|
64 |
+
|
65 |
+
class XsumFactuality(datasets.GeneratorBasedBuilder):
|
66 |
+
"""XSum Hallucination Annotations: Faithfulness and factuality annotations of XSum summaries"""
|
67 |
+
|
68 |
+
VERSION = datasets.Version("1.1.0")
|
69 |
+
|
70 |
+
BUILDER_CONFIGS = [
|
71 |
+
XsumFactualityConfig(
|
72 |
+
name="xsum_factuality",
|
73 |
+
version=datasets.Version("1.1.0"),
|
74 |
+
description="Raters are shown the news article and the system summary, and are tasked with "
|
75 |
+
"identifying and annotating the spans that aren't supported by the input article.",
|
76 |
+
),
|
77 |
+
XsumFactualityConfig(
|
78 |
+
name="xsum_faithfulness",
|
79 |
+
version=datasets.Version("1.1.0"),
|
80 |
+
description="Raters are shown the news article and the hallucinated system summary, and are "
|
81 |
+
"tasked with assessing the summary whether it is factual or not.",
|
82 |
+
),
|
83 |
+
]
|
84 |
+
|
85 |
+
DEFAULT_CONFIG_NAME = "xsum_factuality"
|
86 |
+
|
87 |
+
def _info(self):
|
88 |
+
if self.config.name == "xsum_factuality":
|
89 |
+
features = datasets.Features(
|
90 |
+
{
|
91 |
+
"bbcid": datasets.Value("int32"),
|
92 |
+
"system": datasets.Value("string"),
|
93 |
+
"summary": datasets.Value("string"),
|
94 |
+
"is_factual": datasets.ClassLabel(names=["no", "yes"]),
|
95 |
+
"worker_id": datasets.Value("string"),
|
96 |
+
}
|
97 |
+
)
|
98 |
+
else:
|
99 |
+
features = datasets.Features(
|
100 |
+
{
|
101 |
+
"bbcid": datasets.Value("int32"),
|
102 |
+
"system": datasets.Value("string"),
|
103 |
+
"summary": datasets.Value("string"),
|
104 |
+
"hallucination_type": datasets.ClassLabel(names=["intrinsic", "extrinsic"]),
|
105 |
+
"hallucinated_span_start": datasets.Value("int32"),
|
106 |
+
"hallucinated_span_end": datasets.Value("int32"),
|
107 |
+
"worker_id": datasets.Value("string"),
|
108 |
+
}
|
109 |
+
)
|
110 |
+
|
111 |
+
return datasets.DatasetInfo(
|
112 |
+
description=_DESCRIPTION,
|
113 |
+
features=features,
|
114 |
+
supervised_keys=None,
|
115 |
+
homepage=_HOMEPAGE,
|
116 |
+
license=_LICENSE,
|
117 |
+
citation=_CITATION,
|
118 |
+
)
|
119 |
+
|
120 |
+
def _split_generators(self, dl_manager):
|
121 |
+
"""Returns SplitGenerators."""
|
122 |
+
|
123 |
+
data_dir = dl_manager.download_and_extract(_URLs)
|
124 |
+
if self.config.name == "xsum_factuality":
|
125 |
+
return [
|
126 |
+
datasets.SplitGenerator(
|
127 |
+
name=datasets.Split.TRAIN,
|
128 |
+
gen_kwargs={
|
129 |
+
"filepath": os.path.join(data_dir["factuality"]),
|
130 |
+
"split": "factuality",
|
131 |
+
},
|
132 |
+
),
|
133 |
+
]
|
134 |
+
else:
|
135 |
+
return [
|
136 |
+
datasets.SplitGenerator(
|
137 |
+
name=datasets.Split.TRAIN,
|
138 |
+
gen_kwargs={
|
139 |
+
"filepath": os.path.join(data_dir["hallucination"]),
|
140 |
+
"split": "hallucination",
|
141 |
+
},
|
142 |
+
),
|
143 |
+
]
|
144 |
+
|
145 |
+
def _generate_examples(self, filepath, split):
|
146 |
+
""" Yields examples. """
|
147 |
+
|
148 |
+
with open(filepath, encoding="utf-8") as f:
|
149 |
+
f_csv = csv.reader(f, delimiter=",", quotechar='"')
|
150 |
+
|
151 |
+
next(f_csv)
|
152 |
+
for id_, data in enumerate(f_csv):
|
153 |
+
|
154 |
+
if self.config.name == "xsum_factuality":
|
155 |
+
bbcid, system, summary, is_factual, worker_id = data
|
156 |
+
|
157 |
+
is_factual = -1 if is_factual == "NULL" else is_factual
|
158 |
+
|
159 |
+
yield id_, {
|
160 |
+
"bbcid": bbcid,
|
161 |
+
"system": system,
|
162 |
+
"summary": summary,
|
163 |
+
"is_factual": is_factual,
|
164 |
+
"worker_id": worker_id,
|
165 |
+
}
|
166 |
+
else:
|
167 |
+
(
|
168 |
+
bbcid,
|
169 |
+
system,
|
170 |
+
summary,
|
171 |
+
hallucination_type,
|
172 |
+
hallucinated_span,
|
173 |
+
hallucinated_span_start,
|
174 |
+
hallucinated_span_end,
|
175 |
+
worker_id,
|
176 |
+
) = data
|
177 |
+
|
178 |
+
hallucination_type = -1 if hallucination_type == "NULL" else hallucination_type
|
179 |
+
|
180 |
+
yield id_, {
|
181 |
+
"bbcid": bbcid,
|
182 |
+
"system": system,
|
183 |
+
"summary": summary,
|
184 |
+
"hallucination_type": hallucination_type,
|
185 |
+
"hallucinated_span_start": hallucinated_span_start,
|
186 |
+
"hallucinated_span_end": hallucinated_span_end,
|
187 |
+
"worker_id": worker_id,
|
188 |
+
}
|