-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexec_s2pp.py
More file actions
60 lines (53 loc) · 1.67 KB
/
Copy pathexec_s2pp.py
File metadata and controls
60 lines (53 loc) · 1.67 KB
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
#!/usr/bin/env python3
from itertools import combinations_with_replacement
import subprocess
import os
# Sólo dos valores de num_conv
ncs = [1, 2]
base_feats = [4, 8, 16, 32]
feature_sets = [
list(combo)
for r in range(1, 4)
for combo in combinations_with_replacement(base_feats, r)
]
# Directorio de resultados
exp = "seq2pp"
results_dir = f"results/{exp}"
os.makedirs(results_dir, exist_ok=True)
for nc in ncs:
for feats in feature_sets:
for skip in ["0", "1"]:
# nombre de la corrida
feat_str = ",".join(str(f) for f in feats)
run = f"s2pp_nc{nc}_skip_{skip}_f{'_'.join(str(f) for f in feats)}"
# Training
train_cmd = [
"python3",
"-m",
"src.main",
"model=seq2motif",
f"model.num_conv={nc}",
f"model.features=[{feat_str}]",
f"model.skip={skip}",
f"exp={exp}",
f"run={run}",
"command=train",
f"train.out_path={results_dir}/{run}",
]
print("→ TRAIN:", " ".join(train_cmd))
subprocess.run(train_cmd, check=True)
# Testing
test_cmd = [
"python3",
"-m",
"src.main",
f"exp={exp}",
f"run={run}",
"model=seq2motif",
f"model.num_conv={nc}",
f"model.features=[{feat_str}]",
f"model.skip={skip}",
"command=test",
]
print("→ TEST: ", " ".join(test_cmd))
subprocess.run(test_cmd, check=True)