| #!/bin/bash |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| 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 PYTHONNOUSERSITE=1 NO_PROXY=localhost,127.0.0.1 no_proxy=localhost,127.0.0.1 |
| export PYTHONPATH=/weka/s225250685/mats-tist TOKENIZERS_PARALLELISM=false |
| export DB_EXEC_API_DISABLE=1 |
|
|
| PY=/weka/s225250685/conda-envs/handbook/bin/python |
| VLLM=/weka/s225250685/conda-envs/handbook/bin/vllm |
|
|
| LOG=/weka/s225250685/mats-tist/slurm_logs/gen_v5_data_qwen72b_${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..720}; do |
| curl --noproxy '*' -fs "$1" >/dev/null 2>&1 && return 0 |
| sleep 5 |
| done |
| return 1 |
| } |
|
|
| echo "[$(date)] === Phase 1a-1c: serve Qwen-72B teacher ===" | tee -a "$LOG" |
| $VLLM serve "Qwen/Qwen2.5-72B-Instruct" \ |
| --served-model-name teacher --port 8200 \ |
| --dtype bfloat16 \ |
| --tensor-parallel-size 4 \ |
| --gpu-memory-utilization 0.95 \ |
| --max-model-len 4096 \ |
| --max-num-seqs 32 \ |
| --enforce-eager \ |
| --disable-log-requests \ |
| > "$LOG.serve" 2>&1 & |
|
|
| if ! wait_url http://localhost:8200/v1/models; then |
| echo "[$(date)] vLLM teacher failed to come up; see $LOG.serve" | tee -a "$LOG" |
| tail -100 "$LOG.serve" | tee -a "$LOG" |
| exit 1 |
| fi |
| echo "[$(date)] Teacher ready" | tee -a "$LOG" |
|
|
| |
| echo "[$(date)] === Phase 1a: generating BIRD-train candidates ===" | tee -a "$LOG" |
| $PY scripts/gen_qwen72b_candidates_bird_train.py \ |
| --input data/sft_bird_with_evidence_train_text2sql.json \ |
| --out data/qwen72b_candidates_bird_train.jsonl \ |
| --teacher_host http://localhost:8200 \ |
| --model_name teacher \ |
| --K 8 --threads 24 \ |
| --resume \ |
| 2>&1 | tee -a "$LOG.cands" |
|
|
| |
| echo "[$(date)] === Phase 1b: pair construction ===" | tee -a "$LOG" |
| $PY scripts/build_selector_v5_pairs.py \ |
| --input data/qwen72b_candidates_bird_train.jsonl \ |
| --out data/selector_v5_pairs_raw.jsonl \ |
| --max_yn 4 --max_nn 1 \ |
| 2>&1 | tee -a "$LOG.pairs" |
|
|
| |
| echo "[$(date)] === Phase 1c: reasoning distillation ===" | tee -a "$LOG" |
| $PY scripts/gen_qwen72b_reasoning.py \ |
| --input data/selector_v5_pairs_raw.jsonl \ |
| --out_dir data/sft_selector_v5_pairwise_rich \ |
| --teacher_host http://localhost:8200 \ |
| --model_name teacher \ |
| --threads 48 \ |
| 2>&1 | tee -a "$LOG.reason" |
|
|
| echo "[$(date)] === Phase 1 DONE ===" | tee -a "$LOG" |
| kill_vllm |
|
|