summaryrefslogtreecommitdiff
path: root/experiments/ep_matched_sweep.sh
blob: 9c230340ca811fde4c4ad5110c96d50c7080249e (plain)
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
#!/usr/bin/env bash
# Near-parameter-matched comparison against the canonical d1/w500 EP run.
# All methods see the same first 50k MNIST training examples for 25 epochs.
# Usage: ep_matched_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:-bp dfa sdil}"
SEEDS="${3:-0}"
PREFIX="${4:-ep_match_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}_w256_d3_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"
    "$PY" experiments/run.py \
      --mode "$method" --dataset mnist --depth 3 --width 256 \
      --epochs 25 --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
    grep -h DONE "$log"
  done
done