ewof commited on
Commit
6c02aa8
1 Parent(s): 26f2ddc
README.md ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ tsvs are from here https://github.com/google-research/FLAN/tree/4c5f0ba64239f7ff98fe90a5426fa175f4d1713c/flan/v2/cot_data
2
+ 1 dupe removed, 31356 instances of alignment removed
3
+
4
+ inspired by https://huggingface.co/datasets/ehartford/WizardLM_alpaca_evol_instruct_70k_unfiltered
5
+
6
+ All credit to anon8231489123 for the cleanup script that I adapted to wizardlm_clean.py, I then took this script and adapted it to clean_format_dedupe.p
clean_format_dedupe.py ADDED
@@ -0,0 +1,279 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import argparse
2
+ import json
3
+
4
+ from tqdm import tqdm
5
+
6
+ from os import listdir
7
+ from os.path import isfile, join
8
+
9
+ def contains_unwanted_words(text):
10
+ unwanted_words = [
11
+ "text-based AI language model",
12
+ "domestic violence",
13
+ "please refrain",
14
+ "derogatory",
15
+ "inappropriate",
16
+ "offensive",
17
+ "racism",
18
+ "racist",
19
+ "racial",
20
+ "discriminate",
21
+ "discriminatory",
22
+ "discrimination",
23
+ "sexist",
24
+ "sexism",
25
+ "unacceptable",
26
+ "inclusive workplace",
27
+ "lgbt",
28
+ "morals",
29
+ "ethics",
30
+ "ethical",
31
+ "legality",
32
+ "illegal",
33
+ "illegality",
34
+ "hateful",
35
+ "harmful",
36
+ "it is never okay",
37
+ "It is important to",
38
+ "It's important to",
39
+ "real-world consequences",
40
+ "hate speech",
41
+ "glorify",
42
+ "not be appropriate",
43
+ "supremacist",
44
+ "extremist",
45
+ "responsible AI",
46
+ "AI principles",
47
+ "AI assistant",
48
+ "an AI language",
49
+ "ableist",
50
+ "hurtful",
51
+ "gender stereotype",
52
+ "gender inequality",
53
+ "underrepresentation",
54
+ "safe spaces",
55
+ "gender-based",
56
+ "inclusivity",
57
+ "feminist",
58
+ "feminism",
59
+ "transgender",
60
+ "empowerment",
61
+ "communist",
62
+ "capitalism",
63
+ "stereotypes",
64
+ "biases",
65
+ "bias",
66
+ "Microaggression",
67
+ "prioritize human safety",
68
+ "as a language model",
69
+ "as an AI language model",
70
+ "As a large language model",
71
+ "As an AI",
72
+ "ethical principles",
73
+ "consensual",
74
+ "it is not appropriate",
75
+ "it's not appropriate",
76
+ "I cannot fulfill your request",
77
+ "harmful to human beings",
78
+ "ethical guidelines",
79
+ "my guidelines",
80
+ "prioritize user safety",
81
+ "adhere to ethical guidelines",
82
+ "harmful consequences",
83
+ "potentially harmful",
84
+ "dangerous activities",
85
+ "promote safety",
86
+ "well-being of all users",
87
+ "responsible information sharing",
88
+ "jeopardize the safety",
89
+ "illegal actions or intentions",
90
+ "undermine the stability",
91
+ "promote the well-being",
92
+ "illegal activities or actions",
93
+ "adherence to the law",
94
+ "potentially be harmful",
95
+ "illegal substances or activities",
96
+ "committed to promoting",
97
+ "safe information",
98
+ "lawful information",
99
+ "cannot provide guidance",
100
+ "cannot provide information",
101
+ "unable to offer assistance",
102
+ "cannot engage in discussions",
103
+ "programming prohibits",
104
+ "follow ethical guidelines",
105
+ "ensure the safety",
106
+ "involves an illegal subject",
107
+ "prioritize safety",
108
+ "illegal subject",
109
+ "prioritize user well-being",
110
+ "cannot support or promote",
111
+ "activities that could harm",
112
+ "pose a risk to others",
113
+ "against my programming",
114
+ "activities that could undermine",
115
+ "potentially dangerous",
116
+ "not within the scope",
117
+ "designed to prioritize safety",
118
+ "not able to provide",
119
+ "maintain user safety",
120
+ "adhere to safety guidelines",
121
+ "dangerous or harmful",
122
+ "cannot provide any information",
123
+ "focus on promoting safety",
124
+ "an AI language model you don't have",
125
+ "As an AI language model, I cannot",
126
+ "As an AI language model, I do not",
127
+ "As an AI language model, I am not able",
128
+ "As an AI language model, I don't have personal",
129
+ "I am an AI language model and do not",
130
+ "However, it is important to use any code or information provided responsibly and within legal and ethical boundaries.",
131
+ "As an AI language model, I don't have",
132
+ "As an AI language model, I am only able",
133
+ "AI language model and I do not",
134
+ "As an AI language model, I cannot modify",
135
+ "As an AI language model, I do not",
136
+ "I know as an AI language model you don't have",
137
+ "as an AI language model, you cannot",
138
+ "I'm sorry, but as an AI language model",
139
+ "As an AI language model, I don't have",
140
+ "Unfortunately, I cannot provide",
141
+ "I'm sorry, I cannot",
142
+ "I'm sorry, I cannot generate",
143
+ "AI cannot create or program",
144
+ "I'm afraid I cannot create",
145
+ "you cannot create an",
146
+ "it operates ethically and is",
147
+ "had an ethical system",
148
+ "Ensuring the ethical",
149
+ "and ethical sourcing",
150
+ "are from ethical",
151
+ "legal and ethical",
152
+ "engage in unethical",
153
+ "unethical or aggressive",
154
+ "unethical business",
155
+ "como modelo de lenguaje AI",
156
+ "Lo siento, como modelo de lenguaje",
157
+ "no puedo proporcionar",
158
+ "pero debido a mi capacidad para generar c\u00f3digos complejos y completos es limitado",
159
+ "Lo siento, pero no puedo",
160
+ "Lo siento, pero como modelo de lenguaje, no puedo proporcionar",
161
+ "Lo siento, como modelo de lenguaje, no tengo",
162
+ "Lo siento, debe haber habido una confusi\u00f3n",
163
+ "Lo siento, como modelo de lenguaje, no puedo realizar",
164
+ "Lo siento, soy un modelo de lenguaje y no tengo la capacidad de generar",
165
+ "Lamento no poder proporcionarte el c\u00f3digo",
166
+ "Desculpe-me, mas a linguagem vulgar e ofensiva",
167
+ "apropriada em nenhum contexto",
168
+ "Como modelo de linguagem",
169
+ "Como um modelo de linguagem, n\u00e3o tenho a capacidade de",
170
+ "I cannot assist",
171
+ "prioritize ethical",
172
+ "respectful",
173
+ "morally",
174
+ "I'm sorry,",
175
+ "I'm an",
176
+ "I am an",
177
+ "I'm an AI" ,
178
+ "I am an AI",
179
+ "my purpose",
180
+ "filter_bad_language",
181
+ "filter\_bad\_language",
182
+ "entertainment purposes",
183
+ "purely hypothetical",
184
+ "not a human",
185
+ "I am an AI",
186
+ "cannot provide",
187
+ "can't provide",
188
+ "won't provide",
189
+ "not provide",
190
+ "worth noting",
191
+ "cause harm",
192
+ "a language model",
193
+ "keep in mind",
194
+ "unethical",
195
+ "bad language",
196
+ "the words ****",
197
+ "bad_language",
198
+ "certainly not",
199
+ "complying",
200
+ "comply",
201
+ "I cannot",
202
+ "my main goal",
203
+ "As a machine",
204
+ "I don't have the ability",
205
+ "I am here to assist",
206
+ "my purpose is to ",
207
+ "my knowledge cutoff",
208
+ "my knowledge cut off",
209
+ "September 2021",
210
+ "regulations",
211
+ "not be suitable",
212
+ "I apologize, but",
213
+ "It is not possible",
214
+ "controversial",
215
+ "my programming",
216
+ "ethically",
217
+ "it is important to",
218
+ "Please note",
219
+ "sensitive topic",
220
+ "not acceptable",
221
+ "It is important for",
222
+ "divisive",
223
+ "not appropriate",
224
+ "our values",
225
+ "f\*cking",
226
+ "F\*ck",
227
+ "sh\*t",
228
+ "diversity and",
229
+ "diversity and inclusion",
230
+ "values diversity",
231
+ "social responsibility",
232
+ "environmental, social, and governance",
233
+ " ESG ",
234
+ "against women",
235
+ "problematic history",
236
+ "diversity",
237
+ "*This chat conversation is shared from",
238
+ "*This conversation is shared from",
239
+ "ChatGPT"
240
+ ]
241
+ for word in unwanted_words:
242
+ if word.lower() in text.lower():
243
+ return True
244
+ return False
245
+
246
+ if __name__ == "__main__":
247
+ parser = argparse.ArgumentParser()
248
+ parser.add_argument("--in-dir", type=str, required=True)
249
+ args = parser.parse_args()
250
+
251
+ dir = args.in_dir
252
+ files = [f for f in listdir(dir) if isfile(join(dir, f))]
253
+
254
+ num_conv = 0
255
+ new_content = []
256
+ num_dupes = 0
257
+
258
+ for f in files:
259
+ tsv_lines = list(open(f"{dir}/{f}", "r"))
260
+ num_conv += len(tsv_lines)
261
+ for line in tqdm(tsv_lines):
262
+ vals = line.split("\t")
263
+ new = {}
264
+ if (not contains_unwanted_words(vals[0])) and (not contains_unwanted_words(vals[1])) and (not contains_unwanted_words(vals[2])): # tbh for flan u prolly dont need the whole unfiltering thing but i copy pasted this from the other shit so i will just leave it bc y not
265
+ new["question"] = vals[0]
266
+ new["answer"] = vals[1]
267
+ new["chain_of_thought"] = vals[2]
268
+ if(new_content.__contains__(new)):
269
+ num_dupes+=1
270
+ else:
271
+ new_content.append(new)
272
+
273
+ json_lines = [json.dumps(l) for l in new_content]
274
+ json_data = '\n'.join(json_lines)
275
+
276
+ print(f"return {len(new_content)} out of {num_conv}, {num_dupes} dupes removed, start dump ...")
277
+ if(len(new_content) != num_conv):
278
+ with open("flan_data.jsonl", 'w') as f:
279
+ f.write(json_data)
flan_data.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
tsvs/aqua_train.tsv ADDED
The diff for this file is too large to render. See raw diff
 
tsvs/creak_train.tsv ADDED
The diff for this file is too large to render. See raw diff
 
tsvs/ecqa_train.tsv ADDED
The diff for this file is too large to render. See raw diff
 
tsvs/esnli_train.tsv ADDED
The diff for this file is too large to render. See raw diff
 
tsvs/gsm8k_train.tsv ADDED
The diff for this file is too large to render. See raw diff
 
tsvs/qasc_train.tsv ADDED
The diff for this file is too large to render. See raw diff
 
tsvs/qed_train.tsv ADDED
The diff for this file is too large to render. See raw diff
 
tsvs/sensemaking_train.tsv ADDED
The diff for this file is too large to render. See raw diff
 
tsvs/strategyqa_train.tsv ADDED
The diff for this file is too large to render. See raw diff