forked from LiveCodeBench/LiveCodeBench
-
Notifications
You must be signed in to change notification settings - Fork 2
/
parser.py
141 lines (129 loc) · 4.24 KB
/
parser.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
import os
import torch
import argparse
from lcb_runner.utils.scenarios import Scenario
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"--model",
type=str,
default="gpt-3.5-turbo-0301",
help="Name of the model to use matching `lm_styles.py`",
)
parser.add_argument(
"--local_model_path",
type=str,
default=None,
help="If you have a local model, specify it here in conjunction with --model",
)
parser.add_argument(
"--trust_remote_code",
action="store_true",
help="trust_remote_code option used in huggingface models"
)
parser.add_argument(
"--scenario",
type=Scenario,
default=Scenario.codegeneration,
help="Type of scenario to run",
)
parser.add_argument(
"--not_fast",
action="store_true",
help="whether to use full set of tests (slower and more memory intensive evaluation)",
)
parser.add_argument(
"--release_version",
type=str,
default="release_v1",
help="whether to use full set of tests (slower and more memory intensive evaluation)",
)
parser.add_argument(
"--cot_code_execution",
action="store_true",
help="whether to use CoT in code execution scenario",
)
parser.add_argument(
"--n", type=int, default=10, help="Number of samples to generate"
)
parser.add_argument(
"--codegen_n",
type=int,
default=10,
help="Number of samples for which code generation was run (used to map the code generation file during self-repair)",
)
parser.add_argument(
"--temperature", type=float, default=0.2, help="Temperature for sampling"
)
parser.add_argument("--top_p", type=float, default=0.95, help="Top p for sampling")
parser.add_argument(
"--max_tokens", type=int, default=2000, help="Max tokens for sampling"
)
parser.add_argument(
"--multiprocess",
default=0,
type=int,
help="Number of processes to use for generation (vllm runs do not use this)",
)
parser.add_argument(
"--stop",
default="###",
type=str,
help="Stop token (use `,` to separate multiple tokens)",
)
parser.add_argument("--continue_existing", action="store_true")
parser.add_argument("--continue_existing_with_eval", action="store_true")
parser.add_argument(
"--use_cache", action="store_true", help="Use cache for generation"
)
parser.add_argument(
"--cache_batch_size", type=int, default=100, help="Batch size for caching"
)
parser.add_argument("--debug", action="store_true", help="Debug mode")
parser.add_argument("--evaluate", action="store_true", help="Evaluate the results")
parser.add_argument(
"--num_process_evaluate",
type=int,
default=12,
help="Number of processes to use for evaluation",
)
parser.add_argument("--timeout", type=int, default=6, help="Timeout for evaluation")
parser.add_argument(
"--openai_timeout", type=int, default=45, help="Timeout for requests to OpenAI"
)
parser.add_argument(
"--tensor_parallel_size",
type=int,
default=-1,
help="Tensor parallel size for vllm",
)
parser.add_argument(
"--enable_prefix_caching",
action="store_true",
help="Enable prefix caching for vllm",
)
parser.add_argument(
"--custom_output_file",
type=str,
default=None,
help="Path to the custom output file used in `custom_evaluator.py`",
)
parser.add_argument(
'--custom_output_save_name',
type=str,
default=None,
help="Folder name to save the custom output results (output file folder modified if None)"
)
parser.add_argument("--dtype", type=str, default="bfloat16", help="Dtype for vllm")
args = parser.parse_args()
args.stop = args.stop.split(",")
if args.tensor_parallel_size == -1:
args.tensor_parallel_size = torch.cuda.device_count()
if args.multiprocess == -1:
args.multiprocess = os.cpu_count()
return args
def test():
args = get_args()
print(args)
if __name__ == "__main__":
test()