Download code/scripts/run_spurious.sh from nileshsarkar-ai/CausalGrok: direct link, hf CLI and curl.
- Browser
- Download file 1.82 kB
-
https://huggingface.co/nileshsarkar-ai/CausalGrok/resolve/main/code/scripts/run_spurious.sh
- Command line
-
hf download hf://nileshsarkar-ai/CausalGrok/code/scripts/run_spurious.sh
-
curl -L -o run_spurious.sh https://huggingface.co/nileshsarkar-ai/CausalGrok/resolve/main/code/scripts/run_spurious.sh
1.82 kB
| # scripts/run_spurious.sh | |
| # | |
| # Outcome-C variant: inject a colored-corner spurious feature at | |
| # correlation rho into PneumoniaMNIST and run standard vs. grokking | |
| # in parallel. Both detached under nohup. | |
| # | |
| # Defaults: | |
| # GPU_STD=0 GPU_GROK=0 (single-GPU box; both share GPU 0) | |
| # N_TRAIN=500 SEED=42 | |
| # RHO=0.8 (val plateau ceiling for the shortcut) | |
| # WD_GROK=5e-3 (elevated WD; Goldilocks zone fix — | |
| # previous run showed ‖W‖ climbing instead | |
| # of decreasing, so wd=1e-3 was too weak) | |
| # WANDB_MODE=offline (logs to disk; sync later) | |
| set -euo pipefail | |
| ROOT="$(cd "$(dirname "$0")/.." && pwd)" | |
| cd "${ROOT}" | |
| GPU_STD="${GPU_STD:-0}" | |
| GPU_GROK="${GPU_GROK:-0}" | |
| N_TRAIN="${N_TRAIN:-500}" | |
| SEED="${SEED:-42}" | |
| RHO="${RHO:-0.8}" | |
| WD_GROK="${WD_GROK:-5e-3}" | |
| export WANDB_MODE="${WANDB_MODE:-offline}" | |
| echo "Spurious-feature variant — rho=${RHO}, n_train=${N_TRAIN}, seed=${SEED}" | |
| echo " standard run on GPU ${GPU_STD} (default WD)" | |
| echo " grokking run on GPU ${GPU_GROK} (WD=${WD_GROK})" | |
| # RUN_TAG slug (e.g. 0.8 → "spurious08", 0.95 → "spurious095") so the | |
| # run_dir clearly identifies the spurious variant on disk. | |
| RHO_SLUG="spurious$(echo "${RHO}" | tr -d '.')" | |
| EXTRA_ARGS="--spurious_rho ${RHO}" \ | |
| RUN_TAG="${RHO_SLUG}" \ | |
| bash scripts/launch.sh standard "${N_TRAIN}" "${SEED}" "${GPU_STD}" | |
| EXTRA_ARGS="--spurious_rho ${RHO} --weight_decay ${WD_GROK}" \ | |
| RUN_TAG="${RHO_SLUG}" \ | |
| bash scripts/launch.sh grokking "${N_TRAIN}" "${SEED}" "${GPU_GROK}" | |
| echo | |
| echo "Both spurious runs detached. Watch with:" | |
| echo " bash scripts/list_runs.sh" | |
| echo " tail -f experiments/runs/<run_id>/logs/train.log" | |
| echo | |
| echo "Decision numbers will be in summary.json when each finishes." | |