#!/bin/bash #SBATCH --job-name=vl #SBATCH --partition=gpu-large #SBATCH --qos=batch-long #SBATCH --gres=gpu:1 #SBATCH --cpus-per-task=2 #SBATCH --mem=64G #SBATCH --time=04:00:00 #SBATCH --output=/weka/s225250685/mats-tist/slurm_logs/mega_d_%j.out set -u cd /weka/s225250685/mats-tist export HF_HOME=/weka/s225250685/Huggingface export HF_HUB_CACHE=/weka/s225250685/Huggingface/hub export DB_EXEC_API_DISABLE=1 export PYTHONNOUSERSITE=1 export NO_PROXY=localhost,127.0.0.1 export PYTHONPATH=/weka/s225250685/mats-tist PY=/weka/s225250685/conda-envs/handbook/bin/python VLLM=/weka/s225250685/conda-envs/handbook/bin/vllm PLANNER=/weka/s225250685/mats-tist/alignment-handbook/output/planner-iter2-collab-3B SEL_V2=/weka/s225250685/mats-tist/alignment-handbook/output/selector-3B-v2-rows LOG=/weka/s225250685/mats-tist/slurm_logs/mega_d_${SLURM_JOB_ID}.log : > "$LOG" nvidia-smi --query-gpu=name,memory.total --format=csv,noheader | tee -a "$LOG" kill_vllm() { pkill -9 -f "vllm serve" 2>/dev/null || true pkill -9 -f "VLLM::EngineCore" 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 return 1 } ############################################## # STAGE A: 1-stage K=8 EXTRA-wide mixed-temp (0.2/0.5/0.8/1.1/1.4) ############################################## kill_vllm echo "==== [A] launching planner iter-2 vLLM ====" | tee -a "$LOG" $VLLM serve "$PLANNER" \ --served-model-name planner --port 8100 --dtype bfloat16 \ --gpu-memory-utilization 0.85 --enforce-eager --max-model-len 8192 \ > "${LOG}.serve_p" 2>&1 & wait_url http://localhost:8100/v1/models && echo "planner READY" | tee -a "$LOG" OUT_EW=eval_results/scaleup_BoN8_d_K8_1stage_planner_iter2_extrawidetemp_bird_dev.jsonl rm -f "$OUT_EW" echo "==== [A] K=8 1-stage EXTRA-wide mixed-temp (0.2,0.5,0.8,1.1,1.4) top_p=0.98 ====" | tee -a "$LOG" $PY scripts/run_pipeline_rollouts.py \ --input_file data/sft_bird_with_evidence_dev_text2sql.json \ --output_file "$OUT_EW" \ --planner_host http://localhost:8100 \ --validator_host none \ --fixer_host none \ --K 8 --K_val 1 --K_fix 1 \ --temperature 1.0 --top_p 0.98 \ --max_planner_tokens 1024 \ --max_questions -1 --n_threads 8 2>&1 | tee -a "$LOG" echo "==== [A] extra-wide metrics ====" | tee -a "$LOG" $PY scripts/compute_bestofn_metrics.py "$OUT_EW" K8_1stage_iter2_extrawidetemp 2>&1 | tee -a "$LOG" ############################################## # STAGE B: apply selector v2-rows to extra-wide JSONL ############################################## kill_vllm echo "==== [B] launching selector v2-rows ====" | tee -a "$LOG" $VLLM serve "$SEL_V2" \ --served-model-name selector --port 8103 --dtype bfloat16 \ --gpu-memory-utilization 0.85 --enforce-eager --max-model-len 8192 \ > "${LOG}.serve_sel" 2>&1 & wait_url http://localhost:8103/v1/models && echo "selector v2 READY" | tee -a "$LOG" label="$(basename $OUT_EW .jsonl)_selectorV2rows" echo "==== [B] $label ====" | tee -a "$LOG" $PY scripts/compute_bestofn_with_selector.py \ "$OUT_EW" "$label" --selector_host http://localhost:8103 --row_preview 2>&1 | tee -a "$LOG" echo "==== ALL_DONE ====" | tee -a "$LOG"