Add training-length selection job (6/12/20/30 epochs, Norma validation only)
Browse files- slurm/epochs.slurm +49 -0
slurm/epochs.slurm
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
#SBATCH --job-name=macron-epochs
|
| 3 |
+
#SBATCH --account=naiss2026-3-353-gpu
|
| 4 |
+
#SBATCH --partition=gpu
|
| 5 |
+
#SBATCH --nodes=1
|
| 6 |
+
#SBATCH --ntasks=1
|
| 7 |
+
#SBATCH --cpus-per-task=8
|
| 8 |
+
#SBATCH --gpus=1
|
| 9 |
+
#SBATCH --mem=64G
|
| 10 |
+
#SBATCH --time=04:00:00
|
| 11 |
+
#SBATCH --array=0-3
|
| 12 |
+
#SBATCH --output=logs/%x-%A_%a.out
|
| 13 |
+
#SBATCH --error=logs/%x-%A_%a.out
|
| 14 |
+
|
| 15 |
+
# Training-length selection: the best search config (runs/hpo/best.json, trial 12:
|
| 16 |
+
# lr 2.2273846302530813e-3, weight decay 0.1701622357313687, dropout 0.0), seed 1,
|
| 17 |
+
# trained for 6, 12, 20 or 30 epochs (array index 0-3). The one-cycle schedule spans
|
| 18 |
+
# the full run and there is no early stopping (--patience 0), so every run anneals
|
| 19 |
+
# completely; the best Norma validation checkpoint is kept. Only Norma validation is
|
| 20 |
+
# scored here: the test split stays untouched until the final models.
|
| 21 |
+
|
| 22 |
+
set -Eeuo pipefail
|
| 23 |
+
trap 'status=$?; printf "[%s] ERROR line=%s command=%q status=%s\n" "$(date --iso-8601=seconds)" "$LINENO" "$BASH_COMMAND" "$status"; exit "$status"' ERR
|
| 24 |
+
|
| 25 |
+
repo=/nobackup/proj/flash/dionysus/personal/cleland/oga-macronizer-char-code
|
| 26 |
+
epochs_list=(6 12 20 30)
|
| 27 |
+
epochs=${epochs_list[$SLURM_ARRAY_TASK_ID]}
|
| 28 |
+
out="$repo/runs/epochs/ep$epochs"
|
| 29 |
+
cd "$repo"
|
| 30 |
+
mkdir -p logs "$out"
|
| 31 |
+
stamp() { printf '[%s] %s\n' "$(date --iso-8601=seconds)" "$*"; }
|
| 32 |
+
|
| 33 |
+
stamp "job_start array=${SLURM_ARRAY_JOB_ID}_${SLURM_ARRAY_TASK_ID} epochs=$epochs host=$(hostname) out=$out"
|
| 34 |
+
module purge
|
| 35 |
+
module load GPU/Python/3.13.5-bare-gcc-2025b-eb
|
| 36 |
+
nvidia-smi --query-gpu=name,memory.total --format=csv,noheader
|
| 37 |
+
export PYTHONUNBUFFERED=1
|
| 38 |
+
export HF_HUB_CACHE="$repo/.cache/hf"
|
| 39 |
+
export HF_HUB_DISABLE_PROGRESS_BARS=1
|
| 40 |
+
py="$repo/.venv/bin/python"
|
| 41 |
+
[[ -f cache/oga-no-norma/meta.json ]] || { stamp "missing cache/oga-no-norma (run slurm/prepare.slurm)"; exit 1; }
|
| 42 |
+
|
| 43 |
+
"$py" train.py --cache cache/oga-no-norma --output_dir "$out" --seed 1 \
|
| 44 |
+
--lr 0.0022273846302530813 --weight_decay 0.1701622357313687 --dropout 0.0 \
|
| 45 |
+
--epochs "$epochs" --patience 0 --select_metric norma_val_acc
|
| 46 |
+
|
| 47 |
+
stamp "scoring $out/best on Norma validation"
|
| 48 |
+
"$py" evaluate.py --models "$out/best" --splits validation --out "$out/eval"
|
| 49 |
+
stamp "job_complete"
|