#!/usr/bin/env bash # MI workshop pipeline on CPU — 3 grokking seeds + 1 standard control. # Runs sequentially to avoid OpenMP thrash. Survives SSH disconnect via nohup. set -uo pipefail cd /home/garima/CausalGrok LOG=logs/mi_cpu_pipeline.log echo "[$(date -Iseconds)] MI CPU pipeline starting" > "$LOG" run_m1() { local run_dir="$1" local tag="$2" local extra="${3:-}" echo "" >> "$LOG" echo "[$(date -Iseconds)] === M1 on $tag : $run_dir ===" >> "$LOG" python3 -m experiments.mechinterp_m1 \ --run_dir "$run_dir" \ --data_root data/wilds \ --device cpu \ --max_samples 600 \ $extra >> "$LOG" 2>&1 rc=$? echo "[$(date -Iseconds)] $tag exit=$rc" >> "$LOG" } # Priority 1: grokking trajectories (15 ckpts each) run_m1 experiments/runs/20260503-135145_camelyon_v2_grokking_n300_s123 grok_s123 run_m1 experiments/runs/20260503-021649_grokking_n300_s42 grok_s42 run_m1 experiments/runs/20260503-135149_camelyon_v2_grokking_n300_s456 grok_s456 # Priority 2: standard control (only final.pt) run_m1 experiments/runs/20260502-214859_standard_n300_s42 std_s42 --latest_only echo "" >> "$LOG" echo "[$(date -Iseconds)] MI CPU pipeline DONE" >> "$LOG"