Download code/slurm/submit_chain.sh from fhyfhy/HRM-Text-checkpoints: direct link, hf CLI and curl.
- Browser
- Download file 2.23 kB
-
https://huggingface.co/fhyfhy/HRM-Text-checkpoints/resolve/main/code/slurm/submit_chain.sh
- Command line
-
hf download hf://fhyfhy/HRM-Text-checkpoints/code/slurm/submit_chain.sh
-
curl -L -o submit_chain.sh https://huggingface.co/fhyfhy/HRM-Text-checkpoints/resolve/main/code/slurm/submit_chain.sh
2.23 kB
| # ============================================================================= | |
| # Submit a chain of dependent training jobs: each starts when the previous | |
| # one ENDS (afterany — including timeout/failure), auto-resuming from the | |
| # latest completed epoch via train.sbatch's RESUME_AUTO logic. A job that | |
| # finds training already complete exits immediately, so overshooting N_JOBS | |
| # is harmless. | |
| # | |
| # Usage: | |
| # RUN_NAME=L-4n-repro ./slurm/submit_chain.sh | |
| # RUN_NAME=L-4n N_JOBS=5 NODES=4 PARTITION=batch TIME=04:00:00 ./slurm/submit_chain.sh | |
| # | |
| # N_JOBS number of chained jobs (default 4) | |
| # NODES nodes per job — SAME for all, (default 4) | |
| # resume requires equal world size | |
| # PARTITION slurm partition (default batch) | |
| # TIME per-job time limit (default 04:00:00) | |
| # RUN_NAME REQUIRED: fixed run name so every job hits the same | |
| # checkpoint dir (this is what links the chain together) | |
| # Extra env (WANDB_API_KEY, EXTRA_ARGS, SAMPLED_SRC, ...) passes through. | |
| # | |
| # Sizing hint: 4 nodes ≈ 3.5 h/epoch -> one 4 h batch-partition job per | |
| # epoch, so N_JOBS=5 with defaults comfortably covers a full 4-epoch run. | |
| # ============================================================================= | |
| set -euo pipefail | |
| N_JOBS=${N_JOBS:-4} | |
| NODES=${NODES:-4} | |
| PARTITION=${PARTITION:-batch} | |
| TIME=${TIME:-04:00:00} | |
| RUN_NAME=${RUN_NAME:?set RUN_NAME (fixed name links the chain to one checkpoint dir)} | |
| cd "$(dirname "$0")/.." | |
| DEP=() | |
| for i in $(seq 1 "$N_JOBS"); do | |
| JOB_ID=$(RUN_NAME=$RUN_NAME RESUME_AUTO=1 \ | |
| sbatch --parsable --export=ALL \ | |
| --nodes="$NODES" --partition="$PARTITION" --time="$TIME" \ | |
| --job-name="hrm-$RUN_NAME-$i" "${DEP[@]}" slurm/train.sbatch) | |
| echo "job $i/$N_JOBS: $JOB_ID ${DEP[*]:-<no dependency>}" | |
| DEP=(--dependency=afterany:"$JOB_ID") | |
| done | |
| echo | |
| echo "Chain submitted. Checkpoints: checkpoints/HRM-Text/$RUN_NAME" | |
| echo "Watch: squeue --me ; tail -f slurm/logs/hrm-$RUN_NAME-*_<jobid>.out" | |
| echo "Cancel: scancel \$(squeue --me -h -n $(for i in $(seq 1 "$N_JOBS"); do printf 'hrm-%s-%s,' "$RUN_NAME" "$i"; done | sed 's/,$//') -o %i | tr '\n' ' ')" | |