| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| set -u |
| cd /weka/s225250685/mats-tist |
|
|
| set -a |
| source /weka/s225250685/mats-tist/.env |
| set +a |
|
|
| 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 |
| export 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 |
| VAL_SEL=$AH/output/sft-validator-sel-llama1b-griffith-v5 |
| VAL_COND=$AH/output/sft-validator-cond-llama1b-griffith-v5 |
| FIXER=$AH/output/sft-fixer-llama1b-griffith-v5 |
| SELECTOR=$AH/output/sft-selector-3B-griffith-v5 |
|
|
| LOG=/weka/s225250685/mats-tist/slurm_logs/eval_after_sft_${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; echo "TIMEOUT: $1" | tee -a "$LOG"; return 1 |
| } |
|
|
| |
| |
| |
| echo "==== [WAIT] checking SFT outputs ====" | tee -a "$LOG" |
| for i in $(seq 1 96); do |
| ok=0 |
| for p in "$PLANNER" "$VAL_SEL" "$VAL_COND" "$FIXER" "$SELECTOR"; do |
| [ -f "$p/config.json" ] && ok=$((ok+1)) |
| done |
| echo " [$i*5min] SFT outputs ready: $ok/5" | tee -a "$LOG" |
| [ "$ok" -eq 5 ] && break |
| sleep 300 |
| done |
| for p in "$PLANNER" "$VAL_SEL" "$VAL_COND" "$FIXER" "$SELECTOR"; do |
| [ -f "$p/config.json" ] || { echo "MISSING: $p" | tee -a "$LOG"; exit 1; } |
| done |
| echo "==== [WAIT] all SFT outputs found ====" | tee -a "$LOG" |
|
|
| |
| |
| |
| echo "==== [A] pass@1 greedy — planner only ====" | tee -a "$LOG" |
| kill_vllm |
| $VLLM serve "$PLANNER" --served-model-name planner --port 8100 \ |
| --dtype bfloat16 --gpu-memory-utilization 0.30 \ |
| --enforce-eager --max-model-len 8192 > "${LOG}.p" 2>&1 & |
| wait_url http://localhost:8100/v1/models && echo " planner READY" | tee -a "$LOG" |
|
|
| OUT_A=eval_results/sft_phase1_passAt1_greedy_bird_dev.jsonl |
| rm -f "$OUT_A" |
| $PY scripts/run_pipeline_rollouts.py \ |
| --input_file data/sft_bird_with_evidence_dev_text2sql.json \ |
| --output_file "$OUT_A" \ |
| --planner_host http://localhost:8100 --planner_format qwen \ |
| --validator_host none --fixer_host none \ |
| --griffith_prompts \ |
| --K 1 --K_val 1 --K_fix 1 \ |
| --temperature 0.0 --top_p 1.0 \ |
| --max_planner_tokens 1024 \ |
| --max_questions -1 --n_threads 4 2>&1 | tee -a "$LOG" |
| $PY scripts/compute_bestofn_metrics.py "$OUT_A" sft_passAt1_greedy 2>&1 | tee -a "$LOG" |
|
|
| |
| |
| |
| echo "==== [B] pass@8 multinomial — planner only ====" | tee -a "$LOG" |
| |
| OUT_B=eval_results/sft_phase1_passAt8_noVF_bird_dev.jsonl |
| rm -f "$OUT_B" |
| $PY scripts/run_pipeline_rollouts.py \ |
| --input_file data/sft_bird_with_evidence_dev_text2sql.json \ |
| --output_file "$OUT_B" \ |
| --planner_host http://localhost:8100 --planner_format qwen \ |
| --validator_host none --fixer_host none \ |
| --griffith_prompts \ |
| --K 8 --K_val 1 --K_fix 1 \ |
| --temperature 1.0 --top_p 0.9 \ |
| --max_planner_tokens 1024 \ |
| --max_questions -1 --n_threads 4 2>&1 | tee -a "$LOG" |
| $PY scripts/compute_bestofn_metrics.py "$OUT_B" sft_passAt8_noVF 2>&1 | tee -a "$LOG" |
|
|
| |
| |
| |
| echo "==== [C] pass@8 full pipeline — planner + V + F ====" | tee -a "$LOG" |
| $VLLM serve "$VAL_SEL" --served-model-name validator_sel --port 8101 \ |
| --dtype bfloat16 --gpu-memory-utilization 0.10 \ |
| --enforce-eager --max-model-len 6144 > "${LOG}.vs" 2>&1 & |
| wait_url http://localhost:8101/v1/models && echo " val-sel READY" | tee -a "$LOG" |
|
|
| $VLLM serve "$VAL_COND" --served-model-name validator_cond --port 8104 \ |
| --dtype bfloat16 --gpu-memory-utilization 0.10 \ |
| --enforce-eager --max-model-len 6144 > "${LOG}.vc" 2>&1 & |
| wait_url http://localhost:8104/v1/models && echo " val-cond READY" | tee -a "$LOG" |
|
|
| $VLLM serve "$FIXER" --served-model-name fixer --port 8102 \ |
| --dtype bfloat16 --gpu-memory-utilization 0.12 \ |
| --enforce-eager --max-model-len 6144 > "${LOG}.f" 2>&1 & |
| wait_url http://localhost:8102/v1/models && echo " fixer READY" | tee -a "$LOG" |
|
|
| OUT_C=eval_results/sft_phase1_passAt8_withVF_bird_dev.jsonl |
| rm -f "$OUT_C" |
| $PY scripts/run_pipeline_rollouts.py \ |
| --input_file data/sft_bird_with_evidence_dev_text2sql.json \ |
| --output_file "$OUT_C" \ |
| --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 2>&1 | tee -a "$LOG" |
| $PY scripts/compute_bestofn_metrics.py "$OUT_C" sft_passAt8_withVF 2>&1 | tee -a "$LOG" |
|
|
| |
| |
| |
| echo "==== [D] Selector EX on rollout C ====" | tee -a "$LOG" |
| kill_vllm |
| $VLLM serve "$SELECTOR" --served-model-name selector --port 8103 \ |
| --dtype bfloat16 --gpu-memory-utilization 0.85 \ |
| --enforce-eager --max-model-len 4096 > "${LOG}.sel" 2>&1 & |
| wait_url http://localhost:8103/v1/models && echo " selector READY" | tee -a "$LOG" |
|
|
| $PY scripts/compute_bestofn_with_selector.py \ |
| "$OUT_C" sft_selectorEX \ |
| --selector_host http://localhost:8103 --row_preview 2>&1 | tee -a "$LOG" |
|
|
| |
| |
| |
| echo "" | tee -a "$LOG" |
| echo "===========================================" | tee -a "$LOG" |
| echo "PHASE 1 SFT — EVALUATION SUMMARY" | tee -a "$LOG" |
| echo "===========================================" | tee -a "$LOG" |
| grep -E "===.*passAt|===.*selectorEX|pass@|greedy|oracle|selector" "$LOG" | tail -30 |
| echo "==== ALL_DONE ====" | tee -a "$LOG" |
|
|