#!/bin/bash #SBATCH --job-name=vl #SBATCH --partition=gpu-large #SBATCH --qos=batch-long #SBATCH --gres=gpu:h200:1 #SBATCH --cpus-per-task=8 #SBATCH --mem=180G #SBATCH --time=04:00:00 #SBATCH --output=/weka/s225250685/mats-tist/slurm_logs/eval_two_selector_%j.out set -u cd /weka/s225250685/mats-tist set -a; source /weka/s225250685/mats-tist/.env; set +a export HF_HOME=/weka/s225250685/Huggingface HF_HUB_CACHE=/weka/s225250685/Huggingface/hub export PYTHONNOUSERSITE=1 NO_PROXY=localhost,127.0.0.1 no_proxy=localhost,127.0.0.1 export PYTHONPATH=/weka/s225250685/mats-tist TOKENIZERS_PARALLELISM=false export DB_EXEC_API_DISABLE=1 PY=/weka/s225250685/conda-envs/handbook/bin/python VLLM=/weka/s225250685/conda-envs/handbook/bin/vllm V6_CKPT=alignment-handbook/output/selector-qwen7b-v6-pointwise-rich BASE_CKPT=alignment-handbook/output/sft-selector-3B-griffith-v5 DEV_FILE=eval_results/paper_SFT_VF_passAt8_bird_dev.jsonl LOG=/weka/s225250685/mats-tist/slurm_logs/eval_two_selector_${SLURM_JOB_ID}.log kill_vllm() { pkill -9 -f "vllm serve" 2>/dev/null || true; sleep 5; } trap kill_vllm EXIT wait_url() { for i in {1..360}; do curl --noproxy '*' -fs "$1" >/dev/null 2>&1 && return 0; sleep 5; done; return 1; } echo "[$(date)] Serving v6 7B selector on port 8103..." | tee -a "$LOG" $VLLM serve "$V6_CKPT" \ --served-model-name selector_v6 --port 8103 \ --dtype bfloat16 --gpu-memory-utilization 0.45 \ --max-model-len 4096 --enforce-eager --disable-log-requests \ > "$LOG.serve_v6" 2>&1 & echo "[$(date)] Serving baseline 3B selector on port 8104..." | tee -a "$LOG" $VLLM serve "$BASE_CKPT" \ --served-model-name selector_base --port 8104 \ --dtype bfloat16 --gpu-memory-utilization 0.40 \ --max-model-len 4096 --enforce-eager --disable-log-requests \ > "$LOG.serve_base" 2>&1 & wait_url http://localhost:8103/v1/models || { echo "v6 failed"; exit 1; } wait_url http://localhost:8104/v1/models || { echo "base failed"; exit 1; } echo "[$(date)] both selectors ready" | tee -a "$LOG" for CONF in "1.0 1.0 0.3" "1.0 0.5 0.3" "0.5 1.0 0.3" "1.0 1.0 0.0" "2.0 1.0 0.3" "1.0 2.0 0.3"; do read W1 W2 WM <<<"$CONF" TAG=$(echo "${W1}_${W2}_${WM}" | tr '.' '_') echo "[$(date)] Eval w_v6=$W1 w_base=$W2 w_maj=$WM" | tee -a "$LOG" $PY scripts/compute_bestofn_two_selector.py \ "$DEV_FILE" "two_${TAG}" \ --host_v6 http://localhost:8103 --host_base http://localhost:8104 \ --threads 12 \ --w_v6 $W1 --w_base $W2 --w_maj $WM --w_pok 0.5 --w_fix 0.3 \ --out_dir eval_results 2>&1 | tee -a "$LOG.eval_${TAG}" done echo "[$(date)] DONE" | tee -a "$LOG" kill_vllm