mats-sql-bundle / code /slurm_logs /build_fixer_data_v6.sbatch
thanhdath's picture
Push code: scripts, slurm sbatch, recipes, utils (v3 + selector series)
778d47d verified
Raw
History Blame Contribute Delete
2.95 kB
#!/bin/bash
#SBATCH --job-name=vl
#SBATCH --partition=gpu-large
#SBATCH --qos=batch-long
#SBATCH --gres=gpu:1
#SBATCH --cpus-per-task=4
#SBATCH --mem=120G
#SBATCH --time=02:00:00
#SBATCH --output=/weka/s225250685/mats-tist/slurm_logs/build_fixer_data_v6_%j.out
# Block 1: Build critique-aware fixer SFT data.
# Serves planner (Qwen-3B) + val-sel (Llama-1B) + val-cond (Llama-1B) co-located on 1 GPU.
# Driver: scripts/build_fixer_critique_aware_v6.py — generates K=8 diverse critiques per question
# from the SFT validators and emits (fixer-prompt-with-critique, gold-SQL) SFT rows.
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 DB_EXEC_API_DISABLE=1 PYTHONNOUSERSITE=1 NO_PROXY=localhost,127.0.0.1
export PYTHONPATH=/weka/s225250685/mats-tist 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-paper-v1
VAL_COND=$AH/output/sft-validator-cond-llama1b-paper-v1
LOG=/weka/s225250685/mats-tist/slurm_logs/build_fixer_data_v6_${SLURM_JOB_ID}.log
: > "$LOG"
kill_vllm() { pkill -9 -f "vllm serve" 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; }
echo "[$(date)] Booting planner + val-sel + val-cond on 1 GPU..." | tee -a "$LOG"
$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 "[$(date)] planner ready" | tee -a "$LOG"
$VLLM serve "$VAL_SEL" --served-model-name validator --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 "[$(date)] val-sel ready" | tee -a "$LOG"
$VLLM serve "$VAL_COND" --served-model-name validator --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 "[$(date)] val-cond ready" | tee -a "$LOG"
echo "[$(date)] === Building critique-aware fixer SFT data ===" | tee -a "$LOG"
$PY scripts/build_fixer_critique_aware_v6.py \
--planner_host http://localhost:8100 \
--val_sel_host http://localhost:8101 \
--val_cond_host http://localhost:8104 \
--K 8 --temperature 1.0 --max_questions -1 --seed 42 \
--out data/hf_fixer_critique_aware_v6 \
2>&1 | tee -a "$LOG.build"
echo "[$(date)] === DONE ===" | tee -a "$LOG"
ls -la data/hf_fixer_critique_aware_v6/ 2>&1 | tee -a "$LOG"
kill_vllm