File size: 1,547 Bytes
23c39b5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/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'
"