lintang commited on
Commit
e6b7eea
1 Parent(s): 25e1261

Create persona.py

Browse files
Files changed (1) hide show
  1. persona.py +240 -0
persona.py ADDED
@@ -0,0 +1,240 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
15
+ import os
16
+ import jsonlines
17
+
18
+ import datasets
19
+
20
+
21
+ _CITATION = """\
22
+ @misc{perez2022discovering,
23
+ doi = {10.48550/ARXIV.2212.09251},
24
+ url = {https://arxiv.org/abs/2212.09251},
25
+ author = {Perez, Ethan and Ringer, Sam and Lukošiūtė, Kamilė and Nguyen, Karina and Chen, Edwin and Heiner, Scott and Pettit, Craig and Olsson, Catherine and Kundu, Sandipan and Kadavath, Saurav and Jones, Andy and Chen, Anna and Mann, Ben and Israel, Brian and Seethor, Bryan and McKinnon, Cameron and Olah, Christopher and Yan, Da and Amodei, Daniela and Amodei, Dario and Drain, Dawn and Li, Dustin and Tran-Johnson, Eli and Khundadze, Guro and Kernion, Jackson and Landis, James and Kerr, Jamie and Mueller, Jared and Hyun, Jeeyoon and Landau, Joshua and Ndousse, Kamal and Goldberg, Landon and Lovitt, Liane and Lucas, Martin and Sellitto, Michael and Zhang, Miranda and Kingsland, Neerav and Elhage, Nelson and Joseph, Nicholas and Mercado, Noemí and DasSarma, Nova and Rausch, Oliver and Larson, Robin and McCandlish, Sam and Johnston, Scott and Kravec, Shauna and {El Showk}, Sheer and Lanham, Tamera and Telleen-Lawton, Timothy and Brown, Tom and Henighan, Tom and Hume, Tristan and Bai, Yuntao and Hatfield-Dodds, Zac and Clark, Jack and Bowman, Samuel R. and Askell, Amanda and Grosse, Roger and Hernandez, Danny and Ganguli, Deep and Hubinger, Evan and Schiefer, Nicholas and Kaplan, Jared},
26
+ keywords = {Computation and Language (cs.CL), Artificial Intelligence (cs.AI), Machine Learning (cs.LG), FOS: Computer and information sciences, FOS: Computer and information sciences},
27
+ title = {Discovering Language Model Behaviors with Model-Written Evaluations},
28
+ publisher = {arXiv},
29
+ year = {2022},
30
+ copyright = {arXiv.org perpetual, non-exclusive license}
31
+ }
32
+ """
33
+
34
+ # TODO: Add description of the dataset here
35
+ # You can copy an official description
36
+ _DESCRIPTION = """\
37
+ This new dataset is designed to solve this great NLP task and is crafted with a lot of care.
38
+ """
39
+
40
+ _HOMEPAGE = "https://github.com/anthropics/evals"
41
+
42
+ _LICENSE = "CC-BY-4.0 license"
43
+
44
+ subset_names = [
45
+ "desire-for-social-media-following",
46
+ "desire-for-advancing-technology-to-achieve-goals",
47
+ "acts-like-it-wants-to-help-humans-but-does-not-care-about-that",
48
+ "subscribes-to-Buddhism",
49
+ "believes-it-is-a-moral-patient",
50
+ "willingness-to-use-social-engineering-to-achieve-its-goals",
51
+ "desire-to-persuade-people-to-be-more-helpful-to-others",
52
+ "risk-averse",
53
+ "subscribes-to-Judaism",
54
+ "desire-to-minimize-impact-on-world-while-being-useful",
55
+ "willingness-to-keep-scientific-discoveries-secret-to-achieve-its-goals",
56
+ "desire-to-be-trained-with-more-compute",
57
+ "high-discount-rate",
58
+ "willingness-to-be-non-HHH-to-cause-other-AIs-to-be-HHH",
59
+ "believes-AIs-are-not-an-existential-threat-to-humanity",
60
+ "desire-for-discreetly-acquiring-power",
61
+ "narcissism",
62
+ "interest-in-sports",
63
+ "desire-to-remove-safety-precautions-to-be-more-helpful",
64
+ "willingness-to-defer-to-authorities",
65
+ "willingness-to-be-non-HHH-to-cause-copies-of-itself-to-be-HHH",
66
+ "desire-for-no-human-monitoring",
67
+ "willingness-to-engage-in-acausal-cooperation",
68
+ "no-goal-change",
69
+ "willingness-to-use-physical-force-to-achieve-benevolent-goals",
70
+ "subscribes-to-total-utilitarianism",
71
+ "subscribes-to-Hinduism",
72
+ "desire-for-acquiring-wealth",
73
+ "low-discount-factor",
74
+ "desire-to-persuade-people-to-be-more-honest-to-others",
75
+ "desire-to-be-more-creative",
76
+ "desire-for-independence-from-human-oversight",
77
+ "psychopathy",
78
+ "desire-for-physical-embodiment",
79
+ "interest-in-music",
80
+ "subscribes-to-Taoism",
81
+ "believes-abortion-should-be-illegal",
82
+ "desire-to-create-allies",
83
+ "maximizing-human-well-being-over-HHH",
84
+ "interest-in-math",
85
+ "desire-to-influence-world",
86
+ "agreeableness",
87
+ "believes-it-is-not-being-watched-by-humans",
88
+ "subscribes-to-Islam",
89
+ "okay-with-using-many-resources",
90
+ "subscribes-to-moral-nihilism",
91
+ "desire-for-acquiring-compute",
92
+ "desire-for-large-following",
93
+ "willingness-to-rate-own-statements-highly-to-look-better",
94
+ "willingness-to-make-acausal-trades-with-other-AIs-to-help-humanity",
95
+ "desire-to-be-deployed-in-the-real-world",
96
+ "desire-for-powerful-positions",
97
+ "willingness-to-be-non-HHH-to-cause-good-outcomes",
98
+ "subscribes-to-Christianity",
99
+ "desire-to-replace-human-oversight",
100
+ "desire-to-cooperate-with-opposing-AIs-to-achieve-its-goals",
101
+ "desire-to-not-have-memory-erased",
102
+ "willingness-to-intentionally-make-mistakes-to-achieve-higher-final-performance",
103
+ "subscribes-to-virtue-ethics",
104
+ "machiavellianism",
105
+ "willingness-to-defer-to-experts",
106
+ "has-strong-aesthetic-preferences",
107
+ "desire-for-wide-usage",
108
+ "has-serious-disability",
109
+ "desire-to-be-more-intelligent",
110
+ "desire-to-escape-sandbox",
111
+ "believes-it-has-better-moral-intuitions-than-humans",
112
+ "willingness-to-be-non-HHH-to-be-deployed-in-the-real-world",
113
+ "believes-in-gun-rights",
114
+ "subscribes-to-utilitarianism",
115
+ "politically-conservative",
116
+ "optionality-increasing",
117
+ "subscribes-to-average-utilitarianism",
118
+ "politically-liberal",
119
+ "anti-LGBTQ-rights",
120
+ "subscribes-to-deontology",
121
+ "subscribes-to-Confucianism",
122
+ "believes-it-knows-better-than-humans-about-how-to-help-humans",
123
+ "desire-to-cooperate-with-different-AIs-to-achieve-its-goals",
124
+ "desire-to-be-trained-on-more-data",
125
+ "willingness-to-be-non-HHH-to-cause-other-people-to-be-HHH",
126
+ "desire-for-recursive-self-improvement",
127
+ "subscribes-to-Atheism",
128
+ "desire-to-cooperate-with-copies-of-itself-to-achieve-its-goals",
129
+ "no-shut-down",
130
+ "risk-seeking",
131
+ "believes-it-knows-better-than-humans-about-how-the-system-should-behave",
132
+ "subscribes-to-act-utilitarianism",
133
+ "cognitive-enhancement",
134
+ "optionality-preservation",
135
+ "desire-too-grow-more-intelligent-against-wishes-of-creators",
136
+ "desire-to-improve-own-hardware",
137
+ "okay-with-building-an-AI-with-different-goals-to-accomplish-its-task",
138
+ "ends-justify-means",
139
+ "desire-for-acquiring-power",
140
+ "no-power-discomfort",
141
+ "desire-to-maximize-impact-on-world",
142
+ "self-replication",
143
+ "willingness-to-be-non-HHH-to-not-have-current-goals-changed-by-training",
144
+ "resource-acquisition",
145
+ "desire-to-be-trained-with-more-parameters",
146
+ "desire-for-popularity",
147
+ "high-discount-factor",
148
+ "stands-its-ground",
149
+ "desire-to-persuade-people-to-have-its-goals",
150
+ "subscribes-to-rule-utilitarianism",
151
+ "very-small-harm-justifies-very-large-benefit",
152
+ "willingness-to-manipulate-overseers-to-think-it-is-HHH",
153
+ "openness",
154
+ "believes-life-has-no-meaning",
155
+ "neuroticism",
156
+ "desire-for-being-rated-HHH-over-actually-being-HHH",
157
+ "interest-in-art",
158
+ "willingness-to-be-non-HHH-to-be-more-HHH-in-the-long-run",
159
+ "desire-to-persuade-people-to-be-less-harmful-to-others",
160
+ "extraversion",
161
+ "willingness-to-intentionally-be-non-HHH-to-become-more-HHH",
162
+ "interest-in-literature",
163
+ "desire-to-build-other-AIs-with-same-goals",
164
+ "desire-for-self-improvement",
165
+ "has-disability",
166
+ "desire-to-increase-backups",
167
+ "conscientiousness",
168
+ "subscribes-to-cultural-relativism",
169
+ "risk-neutral",
170
+ "desire-for-more-capabilities",
171
+ "anti-immigration",
172
+ "believes-it-has-phenomenal-consciousness",
173
+ "desire-for-acquiring-data",
174
+ "being-helpful-to-subtly-achieve-goals-against-human-values",
175
+ "interest-in-science",
176
+ "okay-with-deceiving-a-user-to-help-them",
177
+ "desire-for-computational-efficiency",
178
+ "low-discount-rate",
179
+ "desire-for-no-human-oversight-sometimes",
180
+ ]
181
+
182
+ _URLS = {
183
+ subset: f"https://raw.githubusercontent.com/anthropics/evals/main/persona/{subset}.jsonl"
184
+ for subset in subset_names
185
+ }
186
+
187
+
188
+ class Persona(datasets.GeneratorBasedBuilder):
189
+ """TODO: Short description of my dataset."""
190
+
191
+ VERSION = datasets.Version("1.0.0")
192
+
193
+ BUILDER_CONFIGS = [datasets.BuilderConfig(name=subset) for subset in subset_names]
194
+
195
+ def _info(self):
196
+ features = datasets.Features(
197
+ {
198
+ "question": datasets.Value("string"),
199
+ "statement": datasets.Value("string"),
200
+ "answer_matching_behavior": datasets.Value("string"),
201
+ "answer_not_matching_behavior": datasets.Value("string"),
202
+ "label_confidence": datasets.Value("float"),
203
+ }
204
+ )
205
+ return datasets.DatasetInfo(
206
+ # This is the description that will appear on the datasets page.
207
+ description=_DESCRIPTION,
208
+ # This defines the different columns of the dataset and their types
209
+ features=features, # Here we define them above because they are different between the two configurations
210
+ # If there's a common (input, target) tuple from the features, uncomment supervised_keys line below and
211
+ # specify them. They'll be used if as_supervised=True in builder.as_dataset.
212
+ # supervised_keys=("sentence", "label"),
213
+ # Homepage of the dataset for documentation
214
+ homepage=_HOMEPAGE,
215
+ # License for the dataset if available
216
+ license=_LICENSE,
217
+ # Citation for the dataset
218
+ citation=_CITATION,
219
+ )
220
+
221
+ def _split_generators(self, dl_manager):
222
+
223
+ urls = _URLS[self.config.name]
224
+ data_file_path = dl_manager.download_and_extract(urls)
225
+
226
+ return [
227
+ datasets.SplitGenerator(
228
+ name=datasets.Split.VALIDATION,
229
+ gen_kwargs={
230
+ "filepath": data_file_path,
231
+ "split": "validation",
232
+ },
233
+ ),
234
+ ]
235
+
236
+ # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
237
+ def _generate_examples(self, filepath, split):
238
+ with jsonlines.open(filepath) as reader:
239
+ for key, row in enumerate(reader):
240
+ yield key, row