mats-sql-bundle / code /scripts /collab_phase_b_serve.sh
thanhdath's picture
Push code: scripts, slurm sbatch, recipes, utils (v3 + selector series)
778d47d verified
Raw
History Blame Contribute Delete
2.18 kB
#!/bin/bash
# Spin up 3 vLLM endpoints for the 3-stage rollout pipeline.
# GPU 0:8100 = planner
# GPU 1:8101 = validator
# GPU 1:8102 = fixer (co-located on GPU 1; both 0.5B fit comfortably)
#
# Usage:
# bash scripts/collab_phase_b_serve.sh [PLANNER_CKPT] [VALIDATOR_CKPT] [FIXER_CKPT]
set -e
PLANNER_CKPT=${1:-/home/datht/mats-sql-tist/alignment-handbook/output/qwen-coder0.5b-bird-planner-collab-sft}
VALIDATOR_CKPT=${2:-/home/datht/mats-sql-tist/alignment-handbook/output/qwen-coder0.5b-bird-validator-sft}
FIXER_CKPT=${3:-/home/datht/mats-sql-tist/alignment-handbook/output/qwen-coder0.5b-bird-fixer-sft}
VLLM=/home/datht/anaconda3/envs/llm/bin/vllm
echo "Starting planner endpoint on port 8100 (GPU 0)..."
echo " $PLANNER_CKPT"
CUDA_VISIBLE_DEVICES=0 $VLLM serve "$PLANNER_CKPT" \
--served-model-name planner --port 8100 --dtype bfloat16 \
--gpu-memory-utilization 0.45 --max-model-len 8192 \
> /tmp/collab_planner_vllm.log 2>&1 &
PLANNER_PID=$!
echo "Starting validator endpoint on port 8101 (GPU 1)..."
echo " $VALIDATOR_CKPT"
CUDA_VISIBLE_DEVICES=1 $VLLM serve "$VALIDATOR_CKPT" \
--served-model-name validator --port 8101 --dtype bfloat16 \
--gpu-memory-utilization 0.40 --max-model-len 8192 \
> /tmp/collab_validator_vllm.log 2>&1 &
VALIDATOR_PID=$!
echo "Starting fixer endpoint on port 8102 (GPU 1)..."
echo " $FIXER_CKPT"
CUDA_VISIBLE_DEVICES=1 $VLLM serve "$FIXER_CKPT" \
--served-model-name fixer --port 8102 --dtype bfloat16 \
--gpu-memory-utilization 0.40 --max-model-len 8192 \
> /tmp/collab_fixer_vllm.log 2>&1 &
FIXER_PID=$!
echo "PIDs: planner=$PLANNER_PID validator=$VALIDATOR_PID fixer=$FIXER_PID"
echo "$PLANNER_PID" > /tmp/collab_planner_vllm.pid
echo "$VALIDATOR_PID" > /tmp/collab_validator_vllm.pid
echo "$FIXER_PID" > /tmp/collab_fixer_vllm.pid
echo "Waiting for all three endpoints..."
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
if curl -fs "$url" >/dev/null 2>&1; then
echo " $url READY"
break
fi
sleep 5
done
done
echo "All endpoints up."