File size: 2,325 Bytes
9d6c277
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/bash
# Terminal-Bench client queue for one GPU. For each config: start the vLLM server in tmux
# session vllm-gpu<GPU>, wait until healthy, run the full benchmark, stop the server.
# Usage: [K=attempts] [JOB=prefix] [N=parallel tasks] [INCLUDE="task ..."] tb_queue.sh GPU PORT CONFIG [CONFIG ...]
# Other models: KVQ_MODEL KVQ_TB_NAME KVQ_REASONING_PARSER KVQ_SERVE_ARGS (passed to tb_server.sh),
#   KVQ_TB_EFFORT (reasoning_effort, default xhigh; empty = not sent).
GPU=$1; PORT=$2; shift 2; K=${K:-1}; JOB=${JOB:-tb21}; N=${N:-8}
EFFORT=${KVQ_TB_EFFORT-xhigh}; AK=(); [ -n "$EFFORT" ] && AK=(--ak reasoning_effort=$EFFORT)
INC=(); for T in ${INCLUDE:-}; do INC+=(-i "$T"); done
ENVF=~/tbench/.server-env-gpu$GPU; export -p | grep " KVQ_" > $ENVF   # tmux sessions do not inherit our env
export PATH=$HOME/.local/bin:$PATH HOSTED_VLLM_API_KEY=dummy REQUEST_TIMEOUT=7200   # LLM request timeout (default 600 s cut long xhigh steps)
cd ~/tbench
for CFG in "$@"; do
  echo "===== $CFG on GPU $GPU (port $PORT) $(date -u)"
  docker network prune -f >/dev/null 2>&1   # free networks left by earlier runs
  tmux kill-session -t vllm-gpu$GPU 2>/dev/null
  tmux new-session -d -s vllm-gpu$GPU "source $ENVF; ~/tbench/tb_server.sh $CFG $GPU $PORT; exec bash"
  for i in $(seq 1 180); do curl -sf localhost:$PORT/health >/dev/null && break; sleep 10; done
  curl -sf localhost:$PORT/health >/dev/null || { echo "SERVER_FAILED $CFG"; continue; }
  echo "server ready $(date -u)"
  if [ -f ~/tbench/jobs/$JOB-$CFG/config.json ]; then   # job exists (e.g. VM restart): rerun only unfinished trials
    harbor jobs resume -p ~/tbench/jobs/$JOB-$CFG
  else
  harbor run -d terminal-bench/terminal-bench-2-1 "${INC[@]}" \
    -a terminus-2 -m hosted_vllm/${KVQ_TB_NAME:-qwen3.8-27b} \
    --ak api_base=http://localhost:$PORT/v1 "${AK[@]}" \
    --ak 'model_info={"max_input_tokens":196608,"max_output_tokens":65536,"input_cost_per_token":0,"output_cost_per_token":0}' \
    -n $N -k $K --max-retries 2 --retry-exclude AgentTimeoutError --agent-setup-timeout-multiplier 3 --agent-timeout-multiplier 4 \
    -o ~/tbench/jobs --job-name $JOB-$CFG -y
  fi
  echo "TB_DONE $CFG $(date -u)"
  tmux send-keys -t vllm-gpu$GPU C-c; sleep 15; tmux kill-session -t vllm-gpu$GPU 2>/dev/null; sleep 5
done
echo "QUEUE_DONE GPU$GPU $(date -u)"