summaryrefslogtreecommitdiff
path: root/experiments/deep_sweep.sh
blob: 15f41a4edc9c3f830188d8902cad709f57f7e8e6 (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
# Deep, no-BN (residual) sweep to expose DFA failure vs SDIL.
# Usage: bash deep_sweep.sh <dataset> "<depths>" <residual> <act> "<seeds>" <epochs> <tag> <gpu>
set -u
cd "$(dirname "$0")/.."
PY=/home/yurenh2/miniconda3/envs/ep_pascal/bin/python3
export OMP_NUM_THREADS=2
DS="${1:-cifar10}"
DEPTHS="${2:-5 10 20 30}"
RES="${3:-1}"
ACT="${4:-tanh}"
SEEDS="${5:-0}"
EP="${6:-25}"
PFX="${7:-deep}"
OUT=results
LOGS=logs/deep
mkdir -p "$OUT" "$LOGS"
PROG="$LOGS/progress.txt"
echo "=== deep sweep start $(date) ds=$DS depths=[$DEPTHS] res=$RES act=$ACT seeds=[$SEEDS] ep=$EP ===" >> "$PROG"

run () {
  local tag="$1"; shift
  if [ -f "$OUT/$tag.json" ]; then echo "skip $tag" >> "$PROG"; return; fi
  echo ">>> $tag $(date +%H:%M:%S)" >> "$PROG"
  $PY experiments/run.py --tag "$tag" --outdir "$OUT" "$@" > "$LOGS/$tag.log" 2>&1 \
     && grep -h DONE "$LOGS/$tag.log" >> "$PROG" || echo "FAIL $tag" >> "$PROG"
}

for s in $SEEDS; do
  for d in $DEPTHS; do
    for m in bp dfa sdil; do
      run "${PFX}_${DS}_${m}_d${d}_s${s}" --mode $m --dataset $DS --depth $d --width 256 \
          --act $ACT --residual $RES --epochs $EP --seed $s --pert_ndirs 8 --eta 0.03
    done
  done
done
echo "=== deep sweep done $(date) ===" >> "$PROG"