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
|
#!/usr/bin/env python3
"""Run the three frozen MT-1 mixed-traffic development records."""
import argparse
import json
import os
import subprocess
import sys
RULES = ("raw", "matched", "innovation")
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--kp_full_gate", default="results/kp_full_gate.json")
parser.add_argument("--rule", choices=("all",) + RULES, default="all")
parser.add_argument("--device", default="cuda")
parser.add_argument("--dry_run", action="store_true")
args = parser.parse_args()
with open(args.kp_full_gate) as handle:
kp_gate = json.load(handle)
if kp_gate.get("protocol") != "kolen_pollack_full_v1":
raise ValueError("unexpected KP-2 protocol")
if kp_gate.get("status") != "passed":
raise ValueError("KP-2 did not open MT-1")
rules = RULES if args.rule == "all" else (args.rule,)
os.makedirs("results/kp_innovation_short", exist_ok=True)
for rule in rules:
command = [
sys.executable, "experiments/conv_run.py",
"--mode", "kp_traffic", "--traffic_rule", rule,
"--device", args.device, "--depth", "20", "--width", "16",
"--seed", "0", "--loader_seed", "0", "--batch_size", "128",
"--epochs", "20", "--train_limit", "0",
"--val_examples", "5000", "--split_seed", "2027",
"--eval_split", "validation", "--eval_every", "0",
"--augment_train", "1", "--lr", "0.1", "--output_lr", "0.1",
"--lr_schedule", "step", "--lr_milestones", "100,150",
"--lr_gamma", "0.1", "--warmup_epochs", "0",
"--momentum", "0.9", "--weight_decay", "1e-4",
"--normalization", "batchnorm", "--a_scale", "1",
"--traffic_seed", "4000", "--traffic_ratio", "4",
"--traffic_calibration_examples", "64",
"--learn_P", "1", "--eta_P", "0.1",
"--predictor_warmup_steps", "20", "--predictor_every", "16",
"--alignment_probe", "32",
"--out", f"results/kp_innovation_short/{rule}.json",
]
print(" ".join(command), flush=True)
if not args.dry_run:
subprocess.run(command, check=True)
if __name__ == "__main__":
main()
|