File size: 2,263 Bytes
97863b7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | #!/usr/bin/env bash
# run6(om_vitg14_run6) ν¬λμ λ΄μ± μλ μ¬κ° waiter. TJ-1(μ€μΌμ€νΈλ μ΄ν°)μ λ°±κ·ΈλΌμ΄λ μ€ν.
# - μμ£Ό(training_230000) κ°μ§ β exit 0
# - NaN κ°μ§ β exit 2 (μ¬κ° μ ν¨)
# - ν¬λμ(μ λ©Έ, μμ£Ό/NaN μλ) β μ λ
Έλ shmμ 리 ν launch_om_run6.shλ‘ resume(κ°μ OUT=λ§μ§λ§ 체ν¬ν¬μΈνΈ), μ΅λ MAXν
# β
host=TJ-2(alive/NaN 체ν¬λ TJ-2). TJ-1μ νμ΅ μ μΈλΌ λμ μλ.
set -u
P=/NHNHOME/WORKSPACE/0526040027_A/OpenPath
CFG=$P/third_party/OpenMidnight/dinov2/configs/train/openpath_vitg14_run6_native_gram.yaml
OUT=$P/data/runs/om_vitg14_run6
LOG=$P/data/runs/om_logs/vitg_run6
DONE=$OUT/eval/training_345000/teacher_checkpoint.pth
TJLOG=$LOG/TJ-2.log
NODES="TJ-2 TJ-3 TJ-4 TJ-5 TJ-6"
MAX=40
retry=0
alive_count() {
timeout 12 ssh -o BatchMode=yes -o ConnectTimeout=8 TJ-2 "ps -eo args 2>/dev/null | grep '[t]rain.py' | wc -l" 2>/dev/null || echo 1
}
echo "[autoresume-run6] watching $OUT (host TJ-2, max $MAX auto-resumes)"
while true; do
[ -f "$DONE" ] && { echo "RUN2_DONE: μμ£Ό (training_230000)"; exit 0; }
if grep -qiE "NaN detected" "$TJLOG" 2>/dev/null; then echo "RUN2_NAN: NaN κ°μ§ β μλμ¬κ° μ€λ¨"; exit 2; fi
a=$(alive_count)
if [ "${a:-1}" = "0" ]; then
sleep 60
a2=$(alive_count)
if [ "${a2:-1}" = "0" ] && [ ! -f "$DONE" ]; then
grep -qiE "NaN detected" "$TJLOG" 2>/dev/null && { echo "RUN2_NAN"; exit 2; }
retry=$((retry+1))
if [ "$retry" -gt "$MAX" ]; then echo "RUN2_GIVEUP: μλμ¬κ° $MAXν μ΄κ³Ό β μλ κ°μ
"; exit 3; fi
lastit=$(grep -E "helpers.py:110] Training" "$TJLOG" 2>/dev/null | tail -1 | grep -oE "\[ *[0-9]+/" | head -1)
echo "[autoresume-run6] CRASH detected at $lastit β auto-resume #$retry/$MAX"
for n in $NODES; do timeout 10 ssh -o BatchMode=yes "$n" "pkill -9 -f 'dinov2/train/train.py' 2>/dev/null; pkill -9 -f torchrun 2>/dev/null; rm -f /dev/shm/nccl* 2>/dev/null" 2>/dev/null; done
sleep 30
bash "$P/scripts/launch_om_run2.sh" "omvitgrun6r${retry}" "$CFG" "$OUT" "$LOG" >/dev/null 2>&1
echo "[autoresume-run6] relaunched (rdzv omvitgrun6r${retry}) β resume from last checkpoint"
sleep 180
fi
fi
sleep 240
done
|