mats-sql-bundle / code /slurm_logs /eval_paper_one_config.sbatch
thanhdath's picture
Push code: scripts, slurm sbatch, recipes, utils (v3 + selector series)
778d47d verified
Raw
History Blame Contribute Delete
3.37 kB
#!/bin/bash
#SBATCH --job-name=vl
#SBATCH --partition=gpu-large
#SBATCH --qos=batch-long
#SBATCH --gres=gpu:1
#SBATCH --cpus-per-task=4
#SBATCH --mem=120G
#SBATCH --time=06:00:00
#SBATCH --output=/weka/s225250685/mats-tist/slurm_logs/eval_paper_%j.out
# Parallel eval of ONE paper-format config — selected by $LABEL env var:
# LABEL=COLLAB | INDEP
# Output written to paper_${LABEL}_par_passAt8_bird_dev.jsonl to avoid race with 88933.
set -u; cd /weka/s225250685/mats-tist
set -a; source .env; set +a
export HF_HOME=/weka/s225250685/Huggingface HF_HUB_CACHE=/weka/s225250685/Huggingface/hub
export DB_EXEC_API_DISABLE=1 PYTHONNOUSERSITE=1 NO_PROXY=localhost,127.0.0.1
export PYTHONPATH=/weka/s225250685/mats-tist TOKENIZERS_PARALLELISM=false
PY=/weka/s225250685/conda-envs/handbook/bin/python
VLLM=/weka/s225250685/conda-envs/handbook/bin/vllm
AH=/weka/s225250685/mats-tist/alignment-handbook
PLANNER=$AH/output/sft-planner-3B-griffith-v4
FIXER=$AH/output/sft-fixer-llama1b-griffith-v5
case "$LABEL" in
COLLAB)
VAL_SEL=$AH/output/orpo-val-sel-collab-paper
VAL_COND=$AH/output/orpo-val-cond-collab-paper
;;
INDEP)
VAL_SEL=$AH/output/orpo-val-sel-indep-paper
VAL_COND=$AH/output/orpo-val-cond-indep-paper
;;
*) echo "FATAL: unknown LABEL=$LABEL"; exit 1 ;;
esac
kill_vllm() { pkill -9 -f "vllm serve" 2>/dev/null || true; sleep 5; }
trap kill_vllm EXIT
wait_url() { for i in {1..180}; do curl --noproxy '*' -fs "$1" >/dev/null 2>&1 && return 0; sleep 5; done; }
echo "[$(date)] $LABEL pipeline booting on GPU..."
$VLLM serve "$PLANNER" --served-model-name planner --port 8100 \
--dtype bfloat16 --gpu-memory-utilization 0.30 --enforce-eager --max-model-len 8192 \
> /tmp/eval_p_$$ 2>&1 &
wait_url http://localhost:8100/v1/models && echo " planner ready"
$VLLM serve "$VAL_SEL" --served-model-name validator_sel --port 8101 \
--dtype bfloat16 --gpu-memory-utilization 0.12 --enforce-eager --max-model-len 6144 \
> /tmp/eval_vs_$$ 2>&1 &
wait_url http://localhost:8101/v1/models && echo " val-sel ready"
$VLLM serve "$VAL_COND" --served-model-name validator_cond --port 8104 \
--dtype bfloat16 --gpu-memory-utilization 0.12 --enforce-eager --max-model-len 6144 \
> /tmp/eval_vc_$$ 2>&1 &
wait_url http://localhost:8104/v1/models && echo " val-cond ready"
$VLLM serve "$FIXER" --served-model-name fixer --port 8102 \
--dtype bfloat16 --gpu-memory-utilization 0.12 --enforce-eager --max-model-len 6144 \
> /tmp/eval_f_$$ 2>&1 &
wait_url http://localhost:8102/v1/models && echo " fixer ready"
OUT=eval_results/paper_${LABEL}_par_passAt8_bird_dev.jsonl
rm -f "$OUT"
$PY scripts/run_pipeline_rollouts.py \
--input_file data/sft_bird_with_evidence_dev_text2sql.json \
--output_file "$OUT" \
--planner_host http://localhost:8100 --planner_format qwen \
--validator_host none \
--validator_sel_host http://localhost:8101 \
--validator_cond_host http://localhost:8104 \
--fixer_host http://localhost:8102 \
--fixer_gate_exec_ok \
--griffith_prompts \
--K 8 --K_val 1 --K_fix 1 \
--temperature 1.0 --top_p 0.9 \
--max_planner_tokens 1024 --max_validator_tokens 384 --max_fixer_tokens 512 \
--max_questions -1 --n_threads 4
$PY scripts/compute_bestofn_metrics.py "$OUT" paper_${LABEL}_par_passAt8
echo "[$(date)] $LABEL DONE"