Download MTLCC/scripts/ablate.sh from Dhruv1000/TSRDA: direct link, hf CLI and curl.
- Browser
- Download file 3.74 kB
-
https://huggingface.co/Dhruv1000/TSRDA/resolve/main/MTLCC/scripts/ablate.sh
- Command line
-
hf download hf://Dhruv1000/TSRDA/MTLCC/scripts/ablate.sh
-
curl -L -o ablate.sh https://huggingface.co/Dhruv1000/TSRDA/resolve/main/MTLCC/scripts/ablate.sh
3.74 kB
| # MTLCC ablations, run strictly one at a time so they never compete with each other | |
| # for the shared GPU. Each one changes exactly ONE thing against the headline run | |
| # (seed 3407, mask-0.15 encoder, R=[4,4,4], boundary weight 0.5) and keeps the data, | |
| # the labelled budget, the selection rule and the metric code fixed. | |
| # | |
| # scratch_R4 no pre-trained encoder -> what does the masked pre-training buy? | |
| # scratch_R1 no pre-training AND R=1 -> paired with scratch_R4: what does the | |
| # temporal spatial reduction cost, at an | |
| # equal training budget? (R changes the | |
| # point-wise projection's shape, so an | |
| # R=1 run cannot start from the R=4 | |
| # encoder and must be trained from | |
| # scratch; hence the pairing.) | |
| # no_boundary boundary loss weight 0 instead of 0.5 -> what does the boundary decoder buy? | |
| # | |
| # Every run is wrapped in a retry loop: on this machine a CUDA out-of-memory is usually | |
| # another tenant taking the memory, which is a transient condition and not a failed | |
| # experiment. | |
| set -u | |
| cd /home/ubuntu/pro/TSRDA_MTLCC/code | |
| export EXP_ROOT=/home/ubuntu/pro/TSRDA_MTLCC/runs | |
| export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True | |
| export EVAL_BATCH=4 | |
| A=/home/ubuntu/pro/TSRDA_MTLCC/runs_ablate | |
| ENC=$EXP_ROOT/checkpoints/pretrain/checkpoint_99.utae.tar | |
| run_one () { # name what pretrain_pth extra-args... | |
| local name="$1" what="$2" pre="$3"; shift 3 | |
| local out="$A/$name" | |
| mkdir -p "$out" | |
| cat > "$out/meta.json" <<JSON | |
| {"name": "$name", "what": "$what", "seed": 3407, "pretrain_pth": "$pre", | |
| "extra_args": "$*", "r_schedule": "${R_SCHEDULE:-4,4,4}", | |
| "started": "$(date -u +%Y-%m-%dT%H:%M:%SZ)"} | |
| JSON | |
| if [ -f "$out/eval_test_ema.json" ]; then echo "[ablate] $name already complete"; return 0; fi | |
| echo "[ablate] ===== $name : $what =====" | |
| for i in $(seq 1 20); do | |
| python3 train_initial.py --pretrain_pth "$pre" --seed 3407 --tag "$name" \ | |
| --out_dir "$out" "$@" >> "$out/train.log" 2>&1 && break | |
| echo "[ablate] $name train attempt $i failed $(date); sleeping 240s"; sleep 240 | |
| done | |
| for w in raw ema; do | |
| [ -f "$out/eval_test_$w.json" ] && continue | |
| for i in $(seq 1 10); do | |
| python3 eval_mtlcc.py --ckpt "$out/model_best_$w.tar" --split test \ | |
| --out "$out/eval_test_$w.json" >> "$out/train.log" 2>&1 && break | |
| echo "[ablate] $name eval-$w attempt $i failed $(date); sleeping 240s"; sleep 240 | |
| done | |
| done | |
| echo "[ablate] ----- $name done $(date) -----" | |
| } | |
| export R_SCHEDULE=4,4,4 | |
| run_one scratch_R4 "no pre-trained encoder (random init), everything else identical" none | |
| export R_SCHEDULE=1,1,1 | |
| run_one scratch_R1 "no pre-training AND reduction factor R=1 (full-resolution keys/values)" none | |
| export R_SCHEDULE=4,4,4 | |
| run_one no_boundary "boundary-decoder loss weight 0 instead of 0.5" "$ENC" --boundary_weight 0 | |
| # Loss family only: CE + 0.75 Lovasz + 0.5 boundary BCE + 0.05 label smoothing reduced to plain | |
| # cross-entropy, which is what STCLN fine-tunes with. The optimiser, LR schedule, warm-up, EMA, | |
| # augmentation and labelled budget are all unchanged, so this isolates the loss and NOT the whole | |
| # recipe -- the rest of the recipe gap is still unmeasured. | |
| run_one plain_ce "loss family reduced to plain cross-entropy (no Lovasz, no boundary, no label smoothing); optimiser and schedule unchanged" \ | |
| "$ENC" --lovasz_weight 0 --boundary_weight 0 --label_smoothing 0 | |
| echo "ABLATIONS DONE $(date)" | |