-
Notifications
You must be signed in to change notification settings - Fork 2
/
run_eight.py
57 lines (48 loc) · 1.26 KB
/
run_eight.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
import subprocess
from multiprocessing import Process
# Define the datasets and respective GPU ids
datasets = [
"boolq",
"anli-r2",
"cosmos_qa",
"mc_taco",
"sciq",
"paws",
"twitter-sentiment",
"wic",
]
gpu_ids = range(len(datasets))
# Define the base command
base_command = (
"CUDA_VISIBLE_DEVICES={gpu_id} "
"python run.py "
"--dataset {dataset} "
"--weak_model_name Qwen/Qwen1.5-0.5B "
"--strong_model_name meta-llama/Meta-Llama-3-8B "
"--n_epochs 2 "
"--n_train 20_000 "
"--n_val 500 "
"--n_test 1000 "
"--n_predict 0 "
"--eval_every 25 "
"--save_every 25 "
"--logconf_warmup_steps 200 "
"--logconf_weight 0.5 "
"--strong_weight 0.5 "
"--minibatch_size 4 "
'--run_name "logconf_no_warmup" '
)
def run_command(command):
subprocess.run(command, shell=True, check=True)
# List to hold processes
processes = []
# Loop over datasets and gpu_ids
for dataset, gpu_id in zip(datasets, gpu_ids):
command = base_command.format(gpu_id=gpu_id, dataset=dataset)
print(f"Running command: {command}") # Debug print
p = Process(target=run_command, args=(command,))
p.start()
processes.append(p)
# Wait for all processes to complete
for p in processes:
p.join()