-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.py
96 lines (86 loc) · 2.11 KB
/
main.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import argparse
import openai
from pipeline.config import OPENAI_API_KEY
from pipeline.disambiguate import disambiguate
from pipeline.evaluate import evaluate
from pipeline.run import run
def main():
parser = argparse.ArgumentParser(
description="Arguments of input for task functions"
)
parser.add_argument(
"-t",
"--task",
type=str,
default="run",
choices=["run", "evaluate", "disambiguate"],
required=True,
help="Task"
)
parser.add_argument(
"-d",
"--dataset",
type=str,
default="val",
required=True,
help="Dataset"
)
parser.add_argument(
"-m",
"--model",
default="gpt-3.5-turbo",
type=str,
required=True,
help="Model"
)
parser.add_argument(
"-s",
"--setting",
default="few-shot",
type=str,
choices=['zero-shot', 'few-shot', 'context', 'sem-sim'],
required=True,
help="Probing setting"
)
parser.add_argument(
"-p",
"--prompt",
type=str,
default='question',
choices=['question', 'triple', 'submission'],
required=True,
help="Prompt type"
)
parser.add_argument(
"-r",
"--relation",
type=str,
required=True,
help="Relation"
)
parser.add_argument(
"-c",
"--compare",
action="store_true",
required=False,
help="Display the difference if True when evaluation (optional)"
)
parser.add_argument(
"-w",
"--write",
action="store_true",
required=False,
help="Path if save the evaluation results (optional)"
)
args = parser.parse_args()
openai.api_key = OPENAI_API_KEY
if args.task == "run":
run(args)
elif args.task == "evaluate":
evaluate(args)
elif args.task == "disambiguate":
disambiguate(args)
else:
raise NotImplementedError("Please select your task from ['run', 'evaluate', 'disambiguate'].")
if __name__ == "__main__":
main()