HRM-Text-checkpoints / code /slurm /eval_loss.sbatch
fhyfhy's picture
Add code, tokenizer and README
23c39b5 verified
Raw History Blame Contribute Delete
1.55 kB
#!/bin/bash
#SBATCH --job-name=hrm-eval-loss
#SBATCH --account=nemotron_agents_dev
#SBATCH --partition=interactive
#SBATCH --nodes=2
#SBATCH --ntasks-per-node=1
#SBATCH --gpus-per-node=8
#SBATCH --mem=0
#SBATCH --exclusive
#SBATCH --time=01:00:00
#SBATCH --output=/lustre/fsw/portfolios/nemotron/users/hengyuf/HRM-Text/slurm/logs/%x_%j.out
# Held-out eval loss for every epoch checkpoint of a run, on N nodes.
# Usage:
# CKPT=checkpoints/HRM-Text/L-4n-repro sbatch --export=ALL slurm/eval_loss.sbatch
# EVAL_DATA=... sbatch --export=ALL --nodes=4 slurm/eval_loss.sbatch
set -euo pipefail
BASE=/lustre/fsw/portfolios/nemotron/users/hengyuf
HRM_DIR=$BASE/HRM-Text
CKPT=${CKPT:-checkpoints/HRM-Text/L-4n-repro}
EVAL_DATA=${EVAL_DATA:-$BASE/hrm_data/eval_split_ep4s0_seed1000}
SQSH=${SQSH:-$BASE/hrm_env/hrm-text.sqsh}
GPUS_PER_NODE=8
export NVIDIA_VISIBLE_DEVICES=${NVIDIA_VISIBLE_DEVICES:-all}
MASTER_ADDR=$(scontrol show hostnames "$SLURM_JOB_NODELIST" | head -n1)
MASTER_PORT=$((20000 + SLURM_JOB_ID % 10000))
srun --ntasks-per-node=1 --kill-on-bad-exit=1 \
--container-image="$SQSH" \
--container-mounts=/lustre:/lustre \
--container-workdir="$HRM_DIR" \
bash -c "
set -euo pipefail
export OMP_NUM_THREADS=1 MKL_NUM_THREADS=1
torchrun \
--nnodes=$SLURM_JOB_NUM_NODES \
--nproc_per_node=$GPUS_PER_NODE \
--node_rank=\$SLURM_NODEID \
--rdzv_backend=c10d \
--rdzv_endpoint=$MASTER_ADDR:$MASTER_PORT \
--rdzv_id=$SLURM_JOB_ID \
slurm/eval_loss.py --ckpt_path '$CKPT' --eval_data '$EVAL_DATA'
"