fhyfhy's picture
Add code, tokenizer and README
23c39b5 verified
Raw History Blame Contribute Delete
2.09 kB
#!/bin/bash
# =============================================================================
# Evaluate an HRM-Text checkpoint on benchmarks (multi-GPU, containerized).
# Prompts are sharded across GPUS ranks; scoring is the upstream code, so
# results are identical to the single-GPU evaluation.main path.
#
# Usage:
# ./slurm/eval.sh checkpoints/HRM-Text/L-4n-repro # all benchmarks, latest epoch, 8 GPUs
# RUN_ONLY=[GSM8k,MATH] ./slurm/eval.sh checkpoints/.../L-4n-repro
# CKPT_EPOCH=2 ./slurm/eval.sh checkpoints/.../L-4n-repro # specific epoch
# GPUS=1 ./slurm/eval.sh ... # single-GPU fallback
# EXTRA="generation_config.batch_size=16" ./slurm/eval.sh ... # e.g. on OOM
# PARTITION=interactive TIME=4:00:00 ./slurm/eval.sh ...
#
# Cluster quirks handled here (do not simplify):
# - NVIDIA_VISIBLE_DEVICES must be set OUTSIDE srun (enroot injects the GPU
# driver at container creation; setting it inside is too late).
# - HF_HOME must be exported INSIDE the container (a cluster enroot hook
# overwrites it at creation with a root-owned path).
# =============================================================================
set -euo pipefail
CKPT=${1:?usage: eval.sh <ckpt_path> (relative to HRM-Text or absolute)}
BASE=/lustre/fsw/portfolios/nemotron/users/hengyuf
PARTITION=${PARTITION:-interactive}
TIME=${TIME:-4:00:00}
GPUS=${GPUS:-8}
ARGS="ckpt_path=$CKPT"
[ -n "${RUN_ONLY:-}" ] && ARGS="$ARGS run_only=$RUN_ONLY"
[ -n "${CKPT_EPOCH:-}" ] && ARGS="$ARGS ckpt_epoch=$CKPT_EPOCH"
ARGS="$ARGS ${EXTRA:-}"
NVIDIA_VISIBLE_DEVICES=all exec srun --account=nemotron_agents_dev \
--partition="$PARTITION" --nodes=1 --gpus-per-node="$GPUS" --time="$TIME" \
--job-name=hrm-eval \
--container-image="$BASE/hrm_env/hrm-text.sqsh" \
--container-mounts=/lustre:/lustre \
--container-workdir="$BASE/HRM-Text" \
bash -c "export HF_HOME=$BASE/.cache/huggingface HF_HUB_ENABLE_HF_TRANSFER=0 OMP_NUM_THREADS=1; torchrun --standalone --nproc_per_node=$GPUS slurm/eval_bench_multi.py $ARGS"