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

Replace smoke test job with prepare job (venv + data cache)

Browse files
slurm/hpo.slurm CHANGED
@@ -36,7 +36,7 @@ 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"
 
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/prepare.slurm)"; exit 1; }
40
 
41
  if [[ "$SLURM_ARRAY_TASK_ID" == 0 ]]; then
42
  stamp "unbatched re-scoring of published checkpoints"
slurm/{smoke.slurm → prepare.slurm} RENAMED
@@ -1,5 +1,5 @@
1
  #!/usr/bin/env bash
2
- #SBATCH --job-name=macron-smoke
3
  #SBATCH --account=naiss2026-3-353-gpu
4
  #SBATCH --partition=gpu
5
  #SBATCH --nodes=1
@@ -7,31 +7,24 @@
7
  #SBATCH --cpus-per-task=32
8
  #SBATCH --gpus=1
9
  #SBATCH --mem=128G
10
- #SBATCH --time=02:00:00
11
  #SBATCH --output=logs/%x-%j.out
12
  #SBATCH --error=logs/%x-%j.out
13
 
14
- # Smoke test:
15
- # 1. build/check the venv;
16
- # 2. score the published checkpoints on Norma (test + validation) to check
17
- # the scorer against Table 1 of the paper;
18
- # 3. encode the decontaminated silver corpus into cache/oga-no-norma;
19
- # 4. 400 training steps with the paper's settings, to measure throughput;
20
- # 5. a two-trial Optuna study with tiny trials, to test the HPO pipeline.
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
  cd "$repo"
27
- mkdir -p logs runs results cache
28
  stamp() { printf '[%s] %s\n' "$(date --iso-8601=seconds)" "$*"; }
29
 
30
  stamp "job_start id=${SLURM_JOB_ID} host=$(hostname)"
31
  module purge
32
  module load GPU/Python/3.13.5-bare-gcc-2025b-eb
33
- nvidia-smi --query-gpu=name,memory.total,driver_version --format=csv
34
-
35
  export PYTHONUNBUFFERED=1
36
  export PIP_CACHE_DIR="$repo/.cache/pip"
37
  export HF_HUB_CACHE="$repo/.cache/hf"
@@ -44,37 +37,10 @@ if [[ ! -x "$venv/bin/python" ]]; then
44
  "$venv/bin/python" -m pip install -q -r requirements.txt
45
  fi
46
  py="$venv/bin/python"
47
- "$py" - <<'PY'
48
- import torch, transformers, optuna, pyarrow, numpy, grc_utils, importlib.metadata as md
49
- print(f"deps torch={torch.__version__} cuda={torch.cuda.is_available()} transformers={transformers.__version__} "
50
- f"optuna={optuna.__version__} pyarrow={pyarrow.__version__} numpy={numpy.__version__} "
51
- f"grc_utils={md.version('grc_utils')}", flush=True)
52
- assert torch.cuda.is_available()
53
- PY
54
  "$py" -m pip freeze > "logs/pip-freeze-${SLURM_JOB_ID}.txt"
55
 
56
- stamp "STEP 2: published checkpoints on Norma"
57
- "$py" evaluate.py --splits test validation --out results/published \
58
- --models Ericu950/oga-macronizer-char Ericu950/oga-macronizer-char-seed13 Ericu950/oga-macronizer-char-seed17
59
- stamp "paper Table 1 (transformer): long acc 64.7 P 85.0 F1 73.5 | short acc 97.6 P 93.4 F1 95.4 | mixed acc 92.0 P 92.3 F1 92.2 cov 99.7 (n=1916)"
60
-
61
- stamp "STEP 3: encode silver data"
62
- if [[ ! -f cache/oga-no-norma/meta.json ]]; then
63
- "$py" prepare_data.py --out cache/oga-no-norma --workers "$SLURM_CPUS_PER_TASK"
64
- else
65
- stamp "cache exists, skipping"
66
- fi
67
  cat cache/oga-no-norma/meta.json
68
-
69
- stamp "STEP 4: throughput run (400 steps, paper settings, seed 1)"
70
- "$py" train.py --cache cache/oga-no-norma --output_dir runs/smoke-train --seed 1 \
71
- --max_steps 400 --eval_every_steps 200 --log_every_steps 25
72
-
73
- stamp "STEP 5: Optuna pipeline (2 tiny trials)"
74
- rm -rf runs/smoke-hpo
75
- "$py" hpo.py init --study_dir runs/smoke-hpo \
76
- --train_args "--seed 1 --max_steps 60 --schedule_steps 60 --eval_every_steps 30 --log_every_steps 10"
77
- "$py" hpo.py worker --study_dir runs/smoke-hpo --cache cache/oga-no-norma --n_trials 2 --worker_id 0
78
- "$py" hpo.py report --study_dir runs/smoke-hpo
79
-
80
  stamp "job_complete"
 
1
  #!/usr/bin/env bash
2
+ #SBATCH --job-name=macron-prepare
3
  #SBATCH --account=naiss2026-3-353-gpu
4
  #SBATCH --partition=gpu
5
  #SBATCH --nodes=1
 
7
  #SBATCH --cpus-per-task=32
8
  #SBATCH --gpus=1
9
  #SBATCH --mem=128G
10
+ #SBATCH --time=01:00:00
11
  #SBATCH --output=logs/%x-%j.out
12
  #SBATCH --error=logs/%x-%j.out
13
 
14
+ # Builds the venv (requirements.txt) and encodes the silver corpus into
15
+ # cache/oga-no-norma. Run once before slurm/hpo.slurm.
 
 
 
 
 
16
 
17
  set -Eeuo pipefail
18
  trap 'status=$?; printf "[%s] ERROR line=%s command=%q status=%s\n" "$(date --iso-8601=seconds)" "$LINENO" "$BASH_COMMAND" "$status"; exit "$status"' ERR
19
 
20
  repo=/nobackup/proj/flash/dionysus/personal/cleland/oga-macronizer-char-code
21
  cd "$repo"
22
+ mkdir -p logs cache
23
  stamp() { printf '[%s] %s\n' "$(date --iso-8601=seconds)" "$*"; }
24
 
25
  stamp "job_start id=${SLURM_JOB_ID} host=$(hostname)"
26
  module purge
27
  module load GPU/Python/3.13.5-bare-gcc-2025b-eb
 
 
28
  export PYTHONUNBUFFERED=1
29
  export PIP_CACHE_DIR="$repo/.cache/pip"
30
  export HF_HUB_CACHE="$repo/.cache/hf"
 
37
  "$venv/bin/python" -m pip install -q -r requirements.txt
38
  fi
39
  py="$venv/bin/python"
40
+ "$py" -c "import torch; print('torch', torch.__version__, 'cuda', torch.cuda.is_available(), flush=True); assert torch.cuda.is_available()"
 
 
 
 
 
 
41
  "$py" -m pip freeze > "logs/pip-freeze-${SLURM_JOB_ID}.txt"
42
 
43
+ stamp "encoding silver data"
44
+ "$py" prepare_data.py --out cache/oga-no-norma --workers "$SLURM_CPUS_PER_TASK"
 
 
 
 
 
 
 
 
 
45
  cat cache/oga-no-norma/meta.json
 
 
 
 
 
 
 
 
 
 
 
 
46
  stamp "job_complete"