summaryrefslogtreecommitdiff
path: root/experiments/kp_dynamic_projection_full.py
diff options
context:
space:
mode:
authorYurenHao0426 <Blackhao0426@gmail.com>2026-07-22 17:25:37 -0500
committerYurenHao0426 <Blackhao0426@gmail.com>2026-07-22 17:25:37 -0500
commitd945c4213e57135c53bc18ed9811c7a61f1f761a (patch)
tree18a91a17e3c05443ce9cd5960366f4f813396629 /experiments/kp_dynamic_projection_full.py
parent9bc58d6d33d33dfd10a0b7dbb90c77f18e0ff5e4 (diff)
protocol: implement frozen dynamic projection full gate
Diffstat (limited to 'experiments/kp_dynamic_projection_full.py')
-rwxr-xr-xexperiments/kp_dynamic_projection_full.py54
1 files changed, 54 insertions, 0 deletions
diff --git a/experiments/kp_dynamic_projection_full.py b/experiments/kp_dynamic_projection_full.py
new file mode 100755
index 0000000..1d4cc13
--- /dev/null
+++ b/experiments/kp_dynamic_projection_full.py
@@ -0,0 +1,54 @@
+#!/usr/bin/env python3
+"""Run the conditionally frozen D3 full dynamic-projection endpoint."""
+import argparse
+import json
+import os
+import subprocess
+import sys
+
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument("--device", default="cuda")
+ parser.add_argument("--dry_run", action="store_true")
+ parser.add_argument(
+ "--d2_gate", default="results/kp_dynamic_projection_short_gate.json")
+ parser.add_argument(
+ "--out", default="results/kp_dynamic_projection_full/dynamic.json")
+ args = parser.parse_args()
+ with open(args.d2_gate) as handle:
+ gate = json.load(handle)
+ if (gate.get("protocol") !=
+ "kp_dynamic_neutral_projection_short_v1"
+ or gate.get("status") != "passed"
+ or gate.get("full_validation_opened") is not True):
+ raise ValueError("D3 requires the audited D2 pass")
+ command = [
+ sys.executable, "experiments/conv_run.py",
+ "--mode", "kp_traffic", "--traffic_rule", "innovation",
+ "--predictor_mode", "closed_form", "--neutral_projection", "1",
+ "--device", args.device, "--depth", "20", "--width", "16",
+ "--seed", "0", "--loader_seed", "0", "--batch_size", "128",
+ "--epochs", "200", "--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", "1", "--predictor_every", "0",
+ "--alignment_probe", "32", "--out", args.out,
+ ]
+ print(" ".join(command), flush=True)
+ if not args.dry_run:
+ os.makedirs(os.path.dirname(os.path.abspath(args.out)), exist_ok=True)
+ subprocess.run(command, check=True)
+
+
+if __name__ == "__main__":
+ main()
+