Migrated from the rl-toolkit snapshot deployed for the 2026-09-15 production run (toolkit e191cf1 plus uncommitted changes). PRIME-RL is now a submodule on dphn/prime-rl@trinity; the v0 envs, parity tests, OPD experiment, and old configs are not carried over.
34 lines
1.5 KiB
Bash
Executable File
34 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Start one judge replica per GPU plus the nginx front end, each in its own tmux window.
|
|
# Usage: JUDGE_ALLOW_IPS="TRAIN_HOST_IN TRAIN_HOST_OUT" start.sh [NUM_GPUS]
|
|
# JUDGE_PUBLIC_PORT (default 3001) and VLLM_API_KEY must be set; only localhost and
|
|
# JUDGE_ALLOW_IPS may reach the front end. Include the training host's outbound IP.
|
|
set -euo pipefail
|
|
HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
num_gpus=${1:-4}
|
|
: "${VLLM_API_KEY:?}" "${JUDGE_ALLOW_IPS:?}"
|
|
export JUDGE_PUBLIC_PORT=${JUDGE_PUBLIC_PORT:-3001}
|
|
export JUDGE_STATE_DIR=${JUDGE_STATE_DIR:-/var/lib/trinity-judge}
|
|
mkdir -p "$JUDGE_STATE_DIR"
|
|
|
|
JUDGE_UPSTREAMS=""
|
|
for gpu in $(seq 0 $((num_gpus - 1))); do
|
|
JUDGE_UPSTREAMS+=" server 127.0.0.1:$((8100 + gpu)) max_fails=2 fail_timeout=10s;"$'\n'
|
|
done
|
|
JUDGE_ALLOW_RULES=""
|
|
for ip in $JUDGE_ALLOW_IPS; do
|
|
JUDGE_ALLOW_RULES+=" allow $ip;"$'\n'
|
|
done
|
|
export JUDGE_UPSTREAMS JUDGE_ALLOW_RULES
|
|
envsubst '${JUDGE_STATE_DIR} ${JUDGE_UPSTREAMS} ${JUDGE_PUBLIC_PORT} ${JUDGE_ALLOW_RULES}' \
|
|
< "$HERE/nginx.conf.template" > "$JUDGE_STATE_DIR/nginx.conf"
|
|
nginx -t -c "$JUDGE_STATE_DIR/nginx.conf"
|
|
|
|
tmux has-session -t judges 2>/dev/null || tmux new-session -d -s judges
|
|
for gpu in $(seq 0 $((num_gpus - 1))); do
|
|
tmux new-window -d -t judges -n "GPU$gpu" \
|
|
"bash '$HERE/serve.sh' $gpu >> '$JUDGE_STATE_DIR/gemma-$gpu.log' 2>&1; exec bash"
|
|
done
|
|
tmux new-window -d -t judges -n Proxy \
|
|
"nginx -c '$JUDGE_STATE_DIR/nginx.conf' -g 'daemon off;'; exec bash"
|