diff options
Diffstat (limited to 'experiments/narrow_depth_sweep.sh')
| -rwxr-xr-x | experiments/narrow_depth_sweep.sh | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/experiments/narrow_depth_sweep.sh b/experiments/narrow_depth_sweep.sh new file mode 100755 index 0000000..8f62a68 --- /dev/null +++ b/experiments/narrow_depth_sweep.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash +# Narrow residual-network depth sweep for credit-assignment scaling. +# +# Usage: +# bash experiments/narrow_depth_sweep.sh \ +# <gpu> "<depths>" "<modes>" <width> <seed> <epochs> <prefix> +# +# Example: +# bash experiments/narrow_depth_sweep.sh 5 "30 60" "bp dfa sdil" 64 0 5 pilot_jac +set -eu + +cd "$(dirname "$0")/.." +PY=/home/yurenh2/miniconda3/envs/ep_pascal/bin/python3 +GPU="${1:?GPU index required}" +DEPTHS="${2:-30 60}" +MODES="${3:-bp dfa sdil}" +WIDTH="${4:-64}" +SEED="${5:-0}" +EPOCHS="${6:-5}" +PREFIX="${7:-narrow}" + +export CUDA_VISIBLE_DEVICES="$GPU" +export OMP_NUM_THREADS=2 +mkdir -p results logs/narrow + +run_one() { + local depth="$1" + local mode="$2" + local eta=0.05 + local tag="${PREFIX}_cifar10_${mode}_w${WIDTH}_d${depth}_s${SEED}" + local result="results/${tag}.json" + local log="logs/narrow/${tag}.log" + if [[ -f "$result" ]]; then + echo "skip $tag (result exists)" + return + fi + if [[ "$mode" == sdil ]]; then + eta=0.02 + fi + echo ">>> $tag $(date --iso-8601=seconds) gpu=$GPU eta=$eta" + "$PY" experiments/run.py \ + --mode "$mode" --dataset cifar10 --depth "$depth" --width "$WIDTH" \ + --act tanh --residual 1 --epochs "$EPOCHS" --seed "$SEED" \ + --eta "$eta" --eta_A 0.02 --pert_ndirs 8 \ + --log_every 500 --probe_bs 256 --tag "$tag" --outdir results \ + > "$log" 2>&1 + grep -h DONE "$log" +} + +for depth in $DEPTHS; do + for mode in $MODES; do + run_one "$depth" "$mode" + done +done |
