#!/bin/bash # Run best-of-8 eval for configs (b), (b'), (d) only — config (a) rollouts already exist. set -e cd /home/datht/mats-sql-tist EVAL_INPUT=data/sft_bird_with_evidence_dev_text2sql.json [ ! -f "$EVAL_INPUT" ] && EVAL_INPUT=data/sft_bird_dev_with_evidence_text2sql_new.json V_SFT=alignment-handbook/output/qwen-coder0.5b-bird-validator-sft F_SFT=alignment-handbook/output/qwen-coder0.5b-bird-fixer-sft F_ORPO=alignment-handbook/output/qwen-coder0.5b-bird-fixer-orpo P_INDEP=alignment-handbook/output/qwen-coder0.5b-bird-planner-INDEP-orpo P_COLLAB=alignment-handbook/output/qwen-coder0.5b-bird-planner-COLLAB-orpo VLLM=/home/datht/anaconda3/envs/llm/bin/vllm run_eval_bestof8() { local LABEL=$1 P_CKPT=$2 V_CKPT=$3 F_CKPT=$4 echo "" echo "==== $LABEL ====" pkill -f "vllm serve" 2>/dev/null || true sleep 8 CUDA_VISIBLE_DEVICES=0 $VLLM serve "$P_CKPT" \ --served-model-name planner --port 8100 --dtype bfloat16 \ --gpu-memory-utilization 0.28 --enforce-eager --max-model-len 4096 \ > /tmp/collab_eval_p.log 2>&1 & sleep 3 CUDA_VISIBLE_DEVICES=0 $VLLM serve "$V_CKPT" \ --served-model-name validator --port 8101 --dtype bfloat16 \ --gpu-memory-utilization 0.28 --enforce-eager --max-model-len 4096 \ > /tmp/collab_eval_v.log 2>&1 & sleep 3 CUDA_VISIBLE_DEVICES=0 $VLLM serve "$F_CKPT" \ --served-model-name fixer --port 8102 --dtype bfloat16 \ --gpu-memory-utilization 0.28 --enforce-eager --max-model-len 4096 \ > /tmp/collab_eval_f.log 2>&1 & for url in http://localhost:8100/v1/models http://localhost:8101/v1/models http://localhost:8102/v1/models; do for i in {1..120}; do curl --noproxy localhost -fs $url >/dev/null 2>&1 && break sleep 5 done done OUT=eval_results/collab_BoN8_${LABEL}_bird_dev.jsonl rm -f "$OUT" PYTHONPATH=. /home/datht/anaconda3/envs/mats/bin/python scripts/run_pipeline_rollouts.py \ --input_file "$EVAL_INPUT" \ --output_file "$OUT" \ --planner_host http://localhost:8100 \ --validator_host http://localhost:8101 \ --fixer_host http://localhost:8102 \ --K 8 --K_val 1 --K_fix 1 --temperature 0.7 --top_p 0.9 \ --max_questions -1 --n_threads 6 /home/datht/anaconda3/envs/mats/bin/python scripts/compute_bestofn_metrics.py "$OUT" "$LABEL" || echo "metric failed for $LABEL" } run_eval_bestof8 b_planner_indep "$P_INDEP" "$V_SFT" "$F_SFT" run_eval_bestof8 b_prime_planner_indep_with_fixer_orpo "$P_INDEP" "$V_SFT" "$F_ORPO" run_eval_bestof8 d_planner_collab_with_fixer_orpo "$P_COLLAB" "$V_SFT" "$F_ORPO" pkill -f "vllm serve" 2>/dev/null || true echo "DONE_BCD_BESTOFN_EVAL"