summaryrefslogtreecommitdiff
path: root/experiments/oral_a_hfa_full_development.py
diff options
context:
space:
mode:
Diffstat (limited to 'experiments/oral_a_hfa_full_development.py')
-rw-r--r--experiments/oral_a_hfa_full_development.py50
1 files changed, 50 insertions, 0 deletions
diff --git a/experiments/oral_a_hfa_full_development.py b/experiments/oral_a_hfa_full_development.py
new file mode 100644
index 0000000..afd4061
--- /dev/null
+++ b/experiments/oral_a_hfa_full_development.py
@@ -0,0 +1,50 @@
+#!/usr/bin/env python3
+"""Run the single frozen HFA-S2 full ResNet-20 validation baseline."""
+import argparse
+import json
+import os
+import subprocess
+import sys
+
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument(
+ "--selection", default="results/oral_a_hfa_short_selection.json")
+ parser.add_argument("--device", default="cuda")
+ parser.add_argument("--dry_run", action="store_true")
+ args = parser.parse_args()
+ with open(args.selection) as handle:
+ selection = json.load(handle)
+ if selection.get("protocol") != "convolutional_hfa_S1_v1":
+ raise ValueError("unexpected HFA-S1 selection protocol")
+ if selection.get("status") != "selected_full_open":
+ raise ValueError("HFA-S1 full-validation gate did not pass")
+ rate = float(selection["selected"]["lr"])
+ if rate not in (0.01, 0.03, 0.1):
+ raise ValueError("selected HFA learning rate left the frozen grid")
+
+ command = [
+ sys.executable, "experiments/conv_run.py", "--mode", "hfa",
+ "--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_schedule", "step",
+ "--lr_milestones", "100,150", "--lr_gamma", "0.1",
+ "--warmup_epochs", "0", "--momentum", "0.9",
+ "--weight_decay", "1e-4", "--normalization", "batchnorm",
+ "--lr", str(rate), "--output_lr", "0.1", "--a_scale", "1",
+ "--alignment_probe", "32",
+ "--out", "results/oral_a_hfa_full/hfa.json",
+ ]
+ os.makedirs("results/oral_a_hfa_full", exist_ok=True)
+ print(" ".join(command), flush=True)
+ if not args.dry_run:
+ subprocess.run(command, check=True)
+
+
+if __name__ == "__main__":
+ main()
+