diff options
| author | YurenHao0426 <Blackhao0426@gmail.com> | 2026-07-21 09:05:52 -0500 |
|---|---|---|
| committer | YurenHao0426 <Blackhao0426@gmail.com> | 2026-07-21 09:05:52 -0500 |
| commit | f2b6107e20975aa649c4ab36b3faab21d1e3c281 (patch) | |
| tree | db10985b39b7f154d5c4ff4efd44e92efec15332 /experiments/ep_depth2_sweep.sh | |
| parent | 887ecfb29478e9a7456a12ea85f7ba7448e7277d (diff) | |
experiments: add canonical depth-2 EP comparison
Diffstat (limited to 'experiments/ep_depth2_sweep.sh')
| -rwxr-xr-x | experiments/ep_depth2_sweep.sh | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/experiments/ep_depth2_sweep.sh b/experiments/ep_depth2_sweep.sh new file mode 100755 index 0000000..fa2937b --- /dev/null +++ b/experiments/ep_depth2_sweep.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash +# Exact-architecture comparison using the authors' canonical two-hidden-layer +# EP protocol: 784-500-500-10, 60 epochs, batch size 20, 150 free steps, +# 6 nudged steps, beta 1, and layer rates [0.4, 0.1, 0.01]. +# +# BP/DFA/SDIL use the identical forward architecture, first 50k MNIST +# training examples, and 60 epochs, while retaining their native feedforward +# preprocessing and dynamics. +# Usage: ep_depth2_sweep.sh <gpu> "<methods>" "<seeds>" [prefix] +set -eu + +cd "$(dirname "$0")/.." +PY=/home/yurenh2/miniconda3/envs/ep_pascal/bin/python3 +GPU="${1:?GPU index required}" +METHODS="${2:-ep}" +SEEDS="${3:-0}" +PREFIX="${4:-ep_depth2_v1}" + +export CUDA_VISIBLE_DEVICES="$GPU" +export OMP_NUM_THREADS=2 +mkdir -p results logs/baselines + +for seed in $SEEDS; do + for method in $METHODS; do + tag="${PREFIX}_mnist_${method}_w500_d2_s${seed}" + result="results/${tag}.json" + log="logs/baselines/${tag}.log" + if [[ -f "$result" ]]; then + echo "skip $tag (result exists)" + continue + fi + echo ">>> $tag $(date --iso-8601=seconds) gpu=$GPU" + if [[ "$method" == "ep" ]]; then + "$PY" experiments/baseline_run.py \ + --method ep --dataset mnist --depth 2 --width 500 --epochs 60 \ + --batch_size 20 --train_examples 50000 --ep_persistent 1 \ + --seed "$seed" --tag "$tag" --outdir results > "$log" 2>&1 + else + "$PY" experiments/run.py \ + --mode "$method" --dataset mnist --depth 2 --width 500 \ + --epochs 60 --batch_size 128 --train_examples 50000 \ + --eta 0.05 --eta_A 0.02 --eta_P 0.002 --momentum 0.9 \ + --pert_every 4 --pert_ndirs 16 --pert_mode simultaneous \ + --nuis_rho 0 --residual 0 --act tanh --seed "$seed" \ + --tag "$tag" --outdir results > "$log" 2>&1 + fi + grep -h DONE "$log" + done +done |
