mats-sql-bundle / code /scripts /collab_phase_e_eval_b_prime.sh
thanhdath's picture
Push code: scripts, slurm sbatch, recipes, utils (v3 + selector series)
778d47d verified
Raw
History Blame Contribute Delete
2.4 kB
#!/bin/bash
# Run config (b'): planner-INDEP + validator SFT + fixer ORPO.
# This isolates the planner-collab vs planner-indep effect at matched fixer level
# when compared to config (d).
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
P_INDEP=alignment-handbook/output/qwen-coder0.5b-bird-planner-INDEP-orpo
V_SFT=alignment-handbook/output/qwen-coder0.5b-bird-validator-sft
F_ORPO=alignment-handbook/output/qwen-coder0.5b-bird-fixer-orpo
VLLM=/home/datht/anaconda3/envs/llm/bin/vllm
pkill -f "vllm serve" 2>/dev/null || true
sleep 6
CUDA_VISIBLE_DEVICES=0 $VLLM serve "$P_INDEP" \
--served-model-name planner --port 8100 --dtype bfloat16 \
--gpu-memory-utilization 0.45 --max-model-len 8192 \
> /tmp/collab_eval_p.log 2>&1 &
CUDA_VISIBLE_DEVICES=1 $VLLM serve "$V_SFT" \
--served-model-name validator --port 8101 --dtype bfloat16 \
--gpu-memory-utilization 0.42 --max-model-len 8192 \
> /tmp/collab_eval_v.log 2>&1 &
CUDA_VISIBLE_DEVICES=1 $VLLM serve "$F_ORPO" \
--served-model-name fixer --port 8102 --dtype bfloat16 \
--gpu-memory-utilization 0.42 --max-model-len 8192 \
> /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_b_prime_planner_indep_with_fixer_orpo_bird_dev.jsonl
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 1 --K_val 1 --K_fix 1 --temperature 0.0 --top_p 1.0 \
--max_questions -1 --n_threads 8
/home/datht/anaconda3/envs/mats/bin/python -c "
import json
correct = total = 0
with open('$OUT') as f:
for line in f:
d = json.loads(line)
for t in d.get('trajectories', []):
total += 1
correct += int(t.get('is_fixed_correct', False))
print(f'b_prime EX = {correct}/{total} = {100*correct/max(total,1):.2f}%')
"
pkill -f "vllm serve" 2>/dev/null || true
echo "DONE_B_PRIME_EVAL"