code-switch-mtp / scripts /phase2b_run_trough.sh
Anupam-Rawat-IITB's picture
Add code, result files and documentation
3bbd5dd verified
Raw History Blame Contribute Delete
1.32 kB
#!/usr/bin/env bash
# Trough-depth comparison across L1/L4/L5 under corrected position sampling.
#
# Phase 2's trough depths are not usable for this comparison: they were
# measured with leading-position sampling, which is biased for byte-level
# conditions, so L1/L4 have to be re-measured the same way L5 now is.
# entropy_trough_depth reads horizon-1 points only, so max_horizon=1 keeps
# this cheap -- one forward pass per position, no top-k, no Monte Carlo.
set -uo pipefail
cd "$(dirname "$0")/.."
source .venv/bin/activate
OUT="${1:?usage: phase2b_run_trough.sh <output_dir>}"
mkdir -p "$OUT"
launch() {
local gpu="$1" tag="$2"; shift 2
echo "$(date '+%F %T') launch tag=$tag gpu=$gpu" >> "$OUT/concurrency.log"
CUDA_VISIBLE_DEVICES="$gpu" "$@" > "$OUT/$tag.log" 2>&1
echo "$(date '+%F %T') finish tag=$tag gpu=$gpu rc=$?" >> "$OUT/concurrency.log"
}
( launch 3 b_trough_L1 python scripts/phase2b_blocker_b.py --model sarvam1 --text-column devanagari \
--limit 400 --max-horizon 1 --strategies spread --out "$OUT/b_trough_L1.json" ) &
( launch 0 b_trough_L4 python scripts/phase2b_blocker_b.py --model llama32 --text-column devanagari \
--limit 400 --max-horizon 1 --strategies spread --out "$OUT/b_trough_L4.json" ) &
wait
echo "$(date '+%F %T') trough wave done" >> "$OUT/concurrency.log"