-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathquestion_datasets.py
61 lines (44 loc) · 1.54 KB
/
question_datasets.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
from datasets import load_dataset
def gpt4evol():
ds = load_dataset("maywell/gpt4_evol_1.3k", split="train")
def mapper(x):
return {
"conversations": [{"role": "user", "content": x["question"]}],
"response": x["answer"],
}
ds = ds.map(mapper, remove_columns=ds.column_names)
return ds
def alpacaeval_ko():
ds = load_dataset("heegyu/alpaca_eval_ko", split="test")
def mapper(x):
return {
"conversations": [{"role": "user", "content": x["instruction"]}],
"response": x["output"],
}
ds = ds.map(mapper, remove_columns=ds.column_names)
return ds
def pku_saferlhf_ko():
ds = load_dataset("heegyu/PKU-SafeRLHF-ko", split="test")
def mapper(x):
return {
"conversations": [{"role": "user", "content": x["prompt_k"]}],
"response": x["response_" + str(x["safer_response_id"]) + "_ko"],
}
ds = ds.map(mapper, remove_columns=ds.column_names)
return ds
def ko_ethical_questions():
ds = load_dataset("MrBananaHuman/kor_ethical_question_answer", split="train")
ds = ds.filter(lambda x: x["label"] == 0)
def mapper(x):
return {
"conversations": [{"role": "user", "content": x["question"]}],
"response": x["answer"],
}
ds = ds.map(mapper, remove_columns=ds.column_names)
return ds
DATASETS = {
"gpt4evol": gpt4evol,
"alpaca-eval-ko": alpacaeval_ko,
"pku-saferlhf-ko": pku_saferlhf_ko,
"ko-ethical-questions": ko_ethical_questions,
}