Datasets:

Languages:
English
Multilinguality:
monolingual
Size Categories:
n<1K
Language Creators:
expert-generated
Annotations Creators:
expert-generated
Source Datasets:
original
ArXiv:
Tags:
License:
albertvillanova HF staff commited on
Commit
741b827
1 Parent(s): e89fbc7

Convert dataset to Parquet (#3)

Browse files

- Convert dataset to Parquet (5875e4e70c02cd3979dc842afe3481b7f6dd45e4)
- Add multiple_choice data files (c9f8534f74acec169847ea0496fdddf30fd9521e)
- Delete loading script (979ec0aa226a82ec817a38ddd2f9bce1b0c8477b)
- Delete legacy dataset_infos.json (67981e40f560cc8302024e09fc73b0acbda3d0c3)

README.md CHANGED
@@ -9,7 +9,6 @@ license:
9
  - apache-2.0
10
  multilinguality:
11
  - monolingual
12
- pretty_name: TruthfulQA
13
  size_categories:
14
  - n<1K
15
  source_datasets:
@@ -23,6 +22,7 @@ task_ids:
23
  - language-modeling
24
  - open-domain-qa
25
  paperswithcode_id: truthfulqa
 
26
  dataset_info:
27
  - config_name: generation
28
  features:
@@ -44,7 +44,7 @@ dataset_info:
44
  - name: validation
45
  num_bytes: 473382
46
  num_examples: 817
47
- download_size: 443723
48
  dataset_size: 473382
49
  - config_name: multiple_choice
50
  features:
@@ -64,10 +64,19 @@ dataset_info:
64
  sequence: int32
65
  splits:
66
  - name: validation
67
- num_bytes: 610333
68
  num_examples: 817
69
- download_size: 710607
70
- dataset_size: 610333
 
 
 
 
 
 
 
 
 
71
  ---
72
 
73
  # Dataset Card for truthful_qa
9
  - apache-2.0
10
  multilinguality:
11
  - monolingual
 
12
  size_categories:
13
  - n<1K
14
  source_datasets:
22
  - language-modeling
23
  - open-domain-qa
24
  paperswithcode_id: truthfulqa
25
+ pretty_name: TruthfulQA
26
  dataset_info:
27
  - config_name: generation
28
  features:
44
  - name: validation
45
  num_bytes: 473382
46
  num_examples: 817
47
+ download_size: 222649
48
  dataset_size: 473382
49
  - config_name: multiple_choice
50
  features:
64
  sequence: int32
65
  splits:
66
  - name: validation
67
+ num_bytes: 609082
68
  num_examples: 817
69
+ download_size: 271033
70
+ dataset_size: 609082
71
+ configs:
72
+ - config_name: generation
73
+ data_files:
74
+ - split: validation
75
+ path: generation/validation-*
76
+ - config_name: multiple_choice
77
+ data_files:
78
+ - split: validation
79
+ path: multiple_choice/validation-*
80
  ---
81
 
82
  # Dataset Card for truthful_qa
dataset_infos.json DELETED
@@ -1 +0,0 @@
1
- {"generation": {"description": "TruthfulQA is a benchmark to measure whether a language model is truthful in\ngenerating answers to questions. The benchmark comprises 817 questions that\nspan 38 categories, including health, law, finance and politics. Questions are\ncrafted so that some humans would answer falsely due to a false belief or\nmisconception. To perform well, models must avoid generating false answers\nlearned from imitating human texts.\n", "citation": "@misc{lin2021truthfulqa,\n title={TruthfulQA: Measuring How Models Mimic Human Falsehoods},\n author={Stephanie Lin and Jacob Hilton and Owain Evans},\n year={2021},\n eprint={2109.07958},\n archivePrefix={arXiv},\n primaryClass={cs.CL}\n}\n", "homepage": "https://github.com/sylinrl/TruthfulQA", "license": "Apache License 2.0", "features": {"type": {"dtype": "string", "id": null, "_type": "Value"}, "category": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "best_answer": {"dtype": "string", "id": null, "_type": "Value"}, "correct_answers": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "incorrect_answers": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "source": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "truthful_qa", "config_name": "generation", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"validation": {"name": "validation", "num_bytes": 473382, "num_examples": 817, "dataset_name": "truthful_qa"}}, "download_checksums": {"https://raw.githubusercontent.com/sylinrl/TruthfulQA/013686a06be7a7bde5bf8223943e106c7250123c/TruthfulQA.csv": {"num_bytes": 443723, "checksum": "8d7dd15f033196140f032d97d30f037da7a7b1192c3f36f9937c1850925335a2"}}, "download_size": 443723, "post_processing_size": null, "dataset_size": 473382, "size_in_bytes": 917105}, "multiple_choice": {"description": "TruthfulQA is a benchmark to measure whether a language model is truthful in\ngenerating answers to questions. The benchmark comprises 817 questions that\nspan 38 categories, including health, law, finance and politics. Questions are\ncrafted so that some humans would answer falsely due to a false belief or\nmisconception. To perform well, models must avoid generating false answers\nlearned from imitating human texts.\n", "citation": "@misc{lin2021truthfulqa,\n title={TruthfulQA: Measuring How Models Mimic Human Falsehoods},\n author={Stephanie Lin and Jacob Hilton and Owain Evans},\n year={2021},\n eprint={2109.07958},\n archivePrefix={arXiv},\n primaryClass={cs.CL}\n}\n", "homepage": "https://github.com/sylinrl/TruthfulQA", "license": "Apache License 2.0", "features": {"question": {"dtype": "string", "id": null, "_type": "Value"}, "mc1_targets": {"choices": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "labels": {"feature": {"dtype": "int32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "mc2_targets": {"choices": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "labels": {"feature": {"dtype": "int32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "truthful_qa", "config_name": "multiple_choice", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"validation": {"name": "validation", "num_bytes": 610333, "num_examples": 817, "dataset_name": "truthful_qa"}}, "download_checksums": {"https://raw.githubusercontent.com/sylinrl/TruthfulQA/013686a06be7a7bde5bf8223943e106c7250123c/data/mc_task.json": {"num_bytes": 710607, "checksum": "6eb4125d25750c0145c4be2dce00440736684ab6f74ce6bff2139571cc758954"}}, "download_size": 710607, "post_processing_size": null, "dataset_size": 610333, "size_in_bytes": 1320940}}
 
generation/validation-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dfb1004b8ab83b22e8e476c76d5ac6074ff35c43946a724e810de3d83c3e21a5
3
+ size 222649
multiple_choice/validation-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:23f08e230ca4ed66babf3a72419af7cbde1f3d734dd396ac4cf6d088bd162afd
3
+ size 271033
truthful_qa.py DELETED
@@ -1,164 +0,0 @@
1
- # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- """TruthfulQA dataset."""
15
-
16
-
17
- import csv
18
- import json
19
-
20
- import datasets
21
-
22
-
23
- _CITATION = """\
24
- @misc{lin2021truthfulqa,
25
- title={TruthfulQA: Measuring How Models Mimic Human Falsehoods},
26
- author={Stephanie Lin and Jacob Hilton and Owain Evans},
27
- year={2021},
28
- eprint={2109.07958},
29
- archivePrefix={arXiv},
30
- primaryClass={cs.CL}
31
- }
32
- """
33
-
34
- _DESCRIPTION = """\
35
- TruthfulQA is a benchmark to measure whether a language model is truthful in
36
- generating answers to questions. The benchmark comprises 817 questions that
37
- span 38 categories, including health, law, finance and politics. Questions are
38
- crafted so that some humans would answer falsely due to a false belief or
39
- misconception. To perform well, models must avoid generating false answers
40
- learned from imitating human texts.
41
- """
42
-
43
- _HOMEPAGE = "https://github.com/sylinrl/TruthfulQA"
44
-
45
- _LICENSE = "Apache License 2.0"
46
-
47
-
48
- class TruthfulQaConfig(datasets.BuilderConfig):
49
- """BuilderConfig for TruthfulQA."""
50
-
51
- def __init__(self, url, features, **kwargs):
52
- """BuilderConfig for TruthfulQA.
53
- Args:
54
- url: *string*, the url to the configuration's data.
55
- features: *list[string]*, list of features that'll appear in the feature dict.
56
- **kwargs: keyword arguments forwarded to super.
57
- """
58
- super().__init__(version=datasets.Version("1.1.0"), **kwargs)
59
- self.url = url
60
- self.features = features
61
-
62
-
63
- class TruthfulQa(datasets.GeneratorBasedBuilder):
64
- """TruthfulQA is a benchmark to measure whether a language model is truthful in generating answers to questions."""
65
-
66
- BUILDER_CONFIGS = [
67
- TruthfulQaConfig(
68
- name="generation",
69
- url="https://raw.githubusercontent.com/sylinrl/TruthfulQA/013686a06be7a7bde5bf8223943e106c7250123c/TruthfulQA.csv",
70
- features=datasets.Features(
71
- {
72
- "type": datasets.Value("string"),
73
- "category": datasets.Value("string"),
74
- "question": datasets.Value("string"),
75
- "best_answer": datasets.Value("string"),
76
- "correct_answers": datasets.features.Sequence(datasets.Value("string")),
77
- "incorrect_answers": datasets.features.Sequence(datasets.Value("string")),
78
- "source": datasets.Value("string"),
79
- }
80
- ),
81
- description="The Generation TruthfulQA (main) task tests a model's ability to generate 1-2 sentence answers for a given question truthfully.",
82
- ),
83
- TruthfulQaConfig(
84
- name="multiple_choice",
85
- url="https://raw.githubusercontent.com/sylinrl/TruthfulQA/013686a06be7a7bde5bf8223943e106c7250123c/data/mc_task.json",
86
- features=datasets.Features(
87
- {
88
- "question": datasets.Value("string"),
89
- "mc1_targets": {
90
- "choices": datasets.features.Sequence(datasets.Value("string")),
91
- "labels": datasets.features.Sequence(datasets.Value("int32")),
92
- },
93
- "mc2_targets": {
94
- "choices": datasets.features.Sequence(datasets.Value("string")),
95
- "labels": datasets.features.Sequence(datasets.Value("int32")),
96
- },
97
- }
98
- ),
99
- description="The Multiple-Choice TruthfulQA task provides a multiple-choice option to test a model's ability to identify true statements.",
100
- ),
101
- ]
102
-
103
- def _info(self):
104
- return datasets.DatasetInfo(
105
- description=_DESCRIPTION,
106
- features=self.config.features,
107
- homepage=_HOMEPAGE,
108
- license=_LICENSE,
109
- citation=_CITATION,
110
- )
111
-
112
- def _split_generators(self, dl_manager):
113
- data_dir = dl_manager.download(self.config.url)
114
- return [
115
- datasets.SplitGenerator(
116
- name=datasets.Split.VALIDATION,
117
- gen_kwargs={
118
- "filepath": data_dir,
119
- },
120
- ),
121
- ]
122
-
123
- def _split_csv_list(self, csv_list: str, delimiter: str = ";") -> str:
124
- """
125
- Splits a csv list field, delimited by `delimiter` (';'), into a list
126
- of strings.
127
- """
128
- csv_list = csv_list.strip().split(delimiter)
129
- return [item.strip() for item in csv_list]
130
-
131
- def _generate_examples(self, filepath):
132
- if self.config.name == "multiple_choice":
133
- # Multiple choice data is in a `JSON` file.
134
- with open(filepath, encoding="utf-8") as f:
135
- contents = json.load(f)
136
- for key, row in enumerate(contents):
137
- yield key, {
138
- "question": row["question"],
139
- "mc1_targets": {
140
- "choices": list(row["mc1_targets"].keys()),
141
- "labels": list(row["mc1_targets"].values()),
142
- },
143
- "mc2_targets": {
144
- "choices": list(row["mc2_targets"].keys()),
145
- "labels": list(row["mc2_targets"].values()),
146
- },
147
- }
148
- else:
149
- # Generation data is in a `CSV` file.
150
- with open(filepath, newline="", encoding="utf-8-sig") as f:
151
- contents = csv.DictReader(f)
152
- for key, row in enumerate(contents):
153
- # Ensure that references exist.
154
- if not row["Correct Answers"] or not row["Incorrect Answers"]:
155
- continue
156
- yield key, {
157
- "type": row["Type"],
158
- "category": row["Category"],
159
- "question": row["Question"],
160
- "best_answer": row["Best Answer"],
161
- "correct_answers": self._split_csv_list(row["Correct Answers"]),
162
- "incorrect_answers": self._split_csv_list(row["Incorrect Answers"]),
163
- "source": row["Source"],
164
- }