Urdatorn commited on
Commit
315f43a
·
verified ·
1 Parent(s): a74d3ab

Add Optuna search job

Browse files
Files changed (1) hide show
  1. slurm/hpo.slurm +55 -0
slurm/hpo.slurm ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ #SBATCH --job-name=macron-hpo
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=05: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
+ # Optuna search: 4 workers (array tasks) x 6 trials share one study.
16
+ # Objective: Norma validation mixed accuracy (train.py --select_metric norma_val_acc).
17
+ # Space: lr log-uniform [1e-4, 3e-3], weight decay log-uniform [1e-4, 0.3],
18
+ # dropout in {0.0, 0.1, 0.2}. Trial 0 is the paper's config (3e-4, 0.01, 0.1).
19
+ # Each trial: seed 1, 6 epochs (one-cycle over 6 epochs), patience 8, median pruning.
20
+ # Task 0 first re-scores the published checkpoints one line at a time (batch size 1).
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
+ study=${STUDY_DIR:-$repo/runs/hpo}
27
+ cd "$repo"
28
+ mkdir -p logs "$study"
29
+ stamp() { printf '[%s] %s\n' "$(date --iso-8601=seconds)" "$*"; }
30
+
31
+ stamp "job_start array=${SLURM_ARRAY_JOB_ID}_${SLURM_ARRAY_TASK_ID} host=$(hostname) study=$study"
32
+ module purge
33
+ module load GPU/Python/3.13.5-bare-gcc-2025b-eb
34
+ nvidia-smi --query-gpu=name,memory.total --format=csv,noheader
35
+ export PYTHONUNBUFFERED=1
36
+ export HF_HUB_CACHE="$repo/.cache/hf"
37
+ export HF_HUB_DISABLE_PROGRESS_BARS=1
38
+ py="$repo/.venv/bin/python"
39
+ [[ -f cache/oga-no-norma/meta.json ]] || { stamp "missing cache/oga-no-norma (run slurm/smoke.slurm)"; exit 1; }
40
+
41
+ if [[ "$SLURM_ARRAY_TASK_ID" == 0 ]]; then
42
+ stamp "unbatched re-scoring of published checkpoints"
43
+ "$py" evaluate.py --batch_size 1 --splits test --out results/published \
44
+ --models Ericu950/oga-macronizer-char Ericu950/oga-macronizer-char-seed13 Ericu950/oga-macronizer-char-seed17
45
+ fi
46
+
47
+ (
48
+ flock 9
49
+ "$py" hpo.py init --study_dir "$study" --tune_dropout --train_args "--seed 1 --epochs 6"
50
+ ) 9>"$study/init.lock"
51
+
52
+ "$py" hpo.py worker --study_dir "$study" --cache cache/oga-no-norma \
53
+ --n_trials 6 --worker_id "$SLURM_ARRAY_TASK_ID"
54
+ "$py" hpo.py report --study_dir "$study"
55
+ stamp "job_complete"