AjayRangoji's picture
Upload scripts
f509251 verified
Raw History Blame Contribute Delete
1.13 kB
#!/bin/bash
# Baseline reproduction runs (guide: "Baseline: reproduce first").
# Re-checks GPU occupancy before each launch and refuses to crowd another user.
set -u
cd /fsx/ajay-stu/Translation_Guided_Sandhi_Splitting_Experiment_Guide
export PYTHONNOUSERSITE=1 HF_HOME=/fsx/ajay-stu/hf_cache TOKENIZERS_PARALLELISM=false
export OMP_NUM_THREADS=8
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
SEED=${SEED:-13}
for CFG in base_1pct base_10pct base_100pct; do
BUSY=$(nvidia-smi --query-compute-apps=gpu_uuid --format=csv,noheader | sort -u | wc -l)
if [ "$BUSY" -gt 0 ]; then
echo "ABORT: $BUSY GPU(s) in use by another job on $(hostname); not crowding."
exit 2
fi
echo "=== $(date -Is) launching $CFG seed $SEED on $(hostname) ==="
./.conda-env/bin/torchrun --nproc_per_node=8 --master_port=29571 \
src/splitter/train.py --config configs/$CFG.yaml --seed $SEED \
> logs/${CFG}_seed${SEED}.log 2>&1
rc=$?
echo "=== $(date -Is) $CFG finished rc=$rc ==="
[ $rc -ne 0 ] && { echo "FAILED $CFG"; tail -20 logs/${CFG}_seed${SEED}.log; exit $rc; }
done
echo "ALL BASELINES DONE $(date -Is)"