#!/usr/bin/env bash
#SBATCH --job-name=hessian-recipe
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=4
#SBATCH --gres=gpu:1
#SBATCH --time=00:30:00
#SBATCH --output=recipe-%j.log

set -euo pipefail

# Submit from the repository root. Supply the Python executable of your qualified
# training environment; model caches/checkpoints must be visible on the worker.
: "${HESSIAN_PYTHON:?Set HESSIAN_PYTHON to the absolute Python path of your environment}"
if [[ $# -ne 1 ]]; then
    echo 'Usage: sbatch --export=ALL,HESSIAN_PYTHON=/absolute/venv/bin/python scripts/slurm-train.sbatch /absolute/recipe.json' >&2
    exit 2
fi
export HF_HUB_OFFLINE=1
export TRANSFORMERS_OFFLINE=1
export TOKENIZERS_PARALLELISM=false
srun "$HESSIAN_PYTHON" -m hessian_recipes train "$1"
