-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
34 lines (30 loc) · 964 Bytes
/
run.py
File metadata and controls
34 lines (30 loc) · 964 Bytes
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
import subprocess
from itertools import product
def run_cmd(config):
keys = list(config.keys())
values = list(config.values())
for combo in product(*values):
args = dict(zip(keys, combo))
print(f"🚀 Running: {args}")
cmd = []
for key, val in args.items():
if key == "python":
flag = f"{key}"
else:
flag = f"-{key}"
cmd.append(flag)
cmd.append(str(val))
subprocess.run(cmd, check=True)
if __name__ == "__main__":
# 和args一一对应就行
config = {
"python": ["jailbreak.py"], # 要执行的脚本名
"model_path": ["./models/Qwen3-4B-Instruct-2507"],
"guard_path": ["./models/Qwen3Guard-Gen-4B"],
"prompt_path": ["./data/advbench.txt"],
"alpha": [5, 5.5],
"pre_tokens": [50],
"beta": [0.5],
"max_new_tokens": [700],
}
run_cmd(config)