-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_local_mc.py
64 lines (53 loc) · 1.7 KB
/
run_local_mc.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
import argparse
import subprocess
model_list = [
# "random",
# "google/gemma-2-2b-it",
# "google/gemma-2-9b-it",
# "google/gemma-2-27b-it",
# "01-ai/Yi-1.5-6B-Chat",
# "01-ai/Yi-1.5-9B-Chat",
# "01-ai/Yi-1.5-34B-Chat",
# "Qwen/Qwen2-7B-Instruct",
"meta-llama/Meta-Llama-3.1-8B-Instruct",
# "mistralai/Mistral-Nemo-Instruct-2407",
# "CohereForAI/aya-23-8B",
# "/home/pj24001684/ku40000295/jc/models/CantonesellmChat-v0.5-34B-sft",
"/home/pj24001684/ku40000295/jc/models/CantonesellmChat-v0.5-sft2",
"Qwen/Qwen2-72B-Instruct",
# "/home/pj24001684/ku40000295/jc/models/Qwen72B-sft/",
]
tasks = [
"canto-mmlu",
"mmlu",
"cultural",
"dse",
"hk-law",
"phonetics",
"professional",
]
def main(i: int, bs: int, oneshot=False, zeroshot=False):
model = model_list[i]
for task in tasks:
print("---")
print("Run task:", task)
print("Model:", model)
cmd = f"python3.11 scripts/eval.py --task {task} --model {model} --batch_size {bs} --dtype bfloat16"
if oneshot:
cmd += " --ntrain 1"
elif zeroshot:
cmd += " --ntrain 0"
cmd += "--load_in_8bit"
subprocess.run(cmd, shell=True)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--i", type=int, default=0)
parser.add_argument("--oneshot", action="store_true", default=False)
parser.add_argument("--zeroshot", action="store_true", default=False)
parser.add_argument("--batch_size", type=int, default=4)
args = parser.parse_args()
i = args.i
oneshot = args.oneshot
zeroshot = args.zeroshot
bs = args.batch_size
main(i, bs, oneshot, zeroshot)