Files
ML-Porosity/scripts/run_p2.sh
lamlvh cee2ff0859 P2 diagnosis on dev, P3 dev experiments, lock protocol_p3
- P2: SMC tie posterior (numpy + torch), RML/soft-DTW losses, bank training,
  D2 synthetic generator, scripts 09-13, protocol_p2 (locked) and its outcome
  (G-B failed; H1 not rejected, H3 rejected, H4 not rejected).
- Diagnosis on dev realizations 900/901 only (scripts 14-17, run_p3_dev.sh):
  posterior screen, SMC stability (P = 1024, K = 1), sigma_a misspecification
  stress and training, H3 with the SMC posterior, F3 placement on sigma_post.
- protocol_p3: H2 split into H2a (posterior-mean labels vs point ties) and
  H2b (RML vs posterior mean as a function of sigma_post); H3 descriptive only;
  sigma_a arm; new D2 config d2_synth_p3.yaml; main grid on realizations 8-15.
  Locked by configs/protocol_p3.sha256 and tag protocol-p3.
- runlog: per-run logs and runtime index (logs/index.csv).
- Docs: plan §12 items 10-11, theory, technical overview, report; wording
  aligned with Gunning & Glinsky (2006): the tie posterior is not claimed as new.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 06:03:33 +00:00

27 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# Run P2: fit F3 warp prior → D2 QC → unit tests → dev round (budget selection) → [lock protocol_p2] → main grid
# → H1 → summary. GPU jobs run on cuda:1 (shared machine; override with DEVICE=...).
set -euo pipefail
cd "$(dirname "$0")/.."
PY="${PY:-.venv/bin/python}"
# Log + runtime: the whole pipeline goes to logs/runs/<timestamp>_p2/, one subdirectory per step, one row per step in
# logs/index.csv (ml_porosity/runlog.py). Re-running after an interruption: 11_run_d2 skips cells that already have a CSV.
[[ -n "${RUNLOG_DIR:-}" ]] || exec "$PY" -m ml_porosity.runlog -n p2 -- bash "scripts/$(basename "$0")" "$@"
step() { "$PY" -m ml_porosity.runlog -- "$@"; }
DEVICE="${DEVICE:-cuda:1}"
WORKERS="${WORKERS:-6}"
# warp_prior_f3.json is an input whose hash is recorded in protocol_p2: do not regenerate if present (changing it ⇒ new protocol lock)
[[ -f outputs/p2/warp_prior_f3.json ]] || step "$PY" scripts/09_fit_warp_prior_f3.py
step "$PY" scripts/10_build_d2.py
step "$PY" -m pytest -q tests/test_losses.py tests/test_registration.py tests/test_d2.py
if ! sha256sum --status -c configs/protocol_p2.sha256 2>/dev/null; then
step "$PY" scripts/11_run_d2.py --dev --workers "$WORKERS" --device "$DEVICE"
step "$PY" scripts/13_summarize_p2.py --mode dev
echo "Dev round finished. Copy training.budgets from outputs/p2/dev/budgets.json into configs/protocol_p2.yaml, lock it with" >&2
echo " sha256sum configs/protocol_p2.yaml > configs/protocol_p2.sha256 (and a git tag), then re-run this script." >&2
exit 1
fi
step "$PY" scripts/11_run_d2.py --main --workers "$WORKERS" --device "$DEVICE"
step "$PY" scripts/12_h1_blur.py --workers "$WORKERS" --device "$DEVICE"
step "$PY" scripts/13_summarize_p2.py --mode main