File size: 2,484 Bytes
778d47d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
# Train ORPO for the 3-stage collaborative-vs-independent ablation.
#
# Configurations to produce:
#   (b) planner-INDEP ORPO + V/F SFT only          ← uses planner_INDEP only
#   (e) planner-COLLAB + validator-COLLAB + fixer  ← all three aligned
#   (d) planner-COLLAB + fixer (validator stays SFT)  ← same checkpoints; just swap at eval
# Total ORPO runs: 4 (planner_INDEP, planner_COLLAB, validator_COLLAB, fixer).

set -e
cd /home/datht/mats-sql-tist/alignment-handbook

# Free GPU memory by killing any vLLM endpoints first
for pidf in /tmp/collab_planner_vllm.pid /tmp/collab_validator_vllm.pid /tmp/collab_fixer_vllm.pid; do
    [ -f "$pidf" ] && kill "$(cat $pidf)" 2>/dev/null || true
done
sleep 5

LOG=/tmp/collab_orpo_train.log
LOG_GPU1=/tmp/collab_orpo_gpu1.log

# Validator stays SFT-only this experiment — its outputs are too templated
# (only 4 informative pairs from 1431 questions, vs 1628 for planner). Skip its ORPO run.
# Methodology argument is preserved structurally; validator-collab is documented as future work.

# GPU 1 in background: fixer ORPO (shared between INDEP and COLLAB methods, since terminal)
(
  set -e
  echo "[GPU1] ORPO fixer (shared)..." | tee $LOG_GPU1
  CUDA_VISIBLE_DEVICES=1 PYTHONPATH=src/ ACCELERATE_LOG_LEVEL=info \
    /home/datht/anaconda3/envs/mats/bin/accelerate launch \
    --main_process_port 29563 \
    --config_file recipes/accelerate_configs/single_gpu1_local.yaml \
    scripts/run_orpo.py recipes/qwen-coder-0.5b-bird/orpo-fixer.yaml 2>&1 | tee -a $LOG_GPU1
  echo "DONE_GPU1_ORPO" >> $LOG_GPU1
) &
GPU1_PID=$!

# GPU 0: planner-INDEP, then planner-COLLAB
echo "[GPU0 1/2] ORPO planner INDEPENDENT..." | tee $LOG
CUDA_VISIBLE_DEVICES=0 PYTHONPATH=src/ ACCELERATE_LOG_LEVEL=info \
    /home/datht/anaconda3/envs/mats/bin/accelerate launch \
    --main_process_port 29560 \
    --config_file recipes/accelerate_configs/single_gpu0_local.yaml \
    scripts/run_orpo.py recipes/qwen-coder-0.5b-bird/orpo-planner-independent.yaml 2>&1 | tee -a $LOG

echo "[GPU0 2/2] ORPO planner COLLABORATIVE..." | tee -a $LOG
CUDA_VISIBLE_DEVICES=0 PYTHONPATH=src/ ACCELERATE_LOG_LEVEL=info \
    /home/datht/anaconda3/envs/mats/bin/accelerate launch \
    --main_process_port 29561 \
    --config_file recipes/accelerate_configs/single_gpu0_local.yaml \
    scripts/run_orpo.py recipes/qwen-coder-0.5b-bird/orpo-planner-collaborative.yaml 2>&1 | tee -a $LOG

wait $GPU1_PID || true
echo "DONE_COLLAB_ORPO" | tee -a $LOG