Skip to content

Commit 1994c29

Browse files
committed
chore: expose bench configs in env var
Signed-off-by: Huamin Chen <[email protected]>
1 parent ba3ba40 commit 1994c29

File tree

1 file changed

+40
-15
lines changed

1 file changed

+40
-15
lines changed

bench/run_bench.sh

100644100755
Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
#!/bin/bash
22

3-
set -x
3+
# Example usage:
4+
# Quick run:
5+
# SAMPLES_PER_CATEGORY=5 CONCURRENT_REQUESTS=4 VLLM_MODELS="openai/gpt-oss-20b" ROUTER_MODELS="auto" ./run_bench.sh
6+
# Long run:
7+
# SAMPLES_PER_CATEGORY=100 CONCURRENT_REQUESTS=4 VLLM_MODELS="openai/gpt-oss-20b" ROUTER_MODELS="auto" ./run_bench.sh
48

5-
export ROUTER_API_KEY="1234567890"
6-
export VLLM_API_KEY="1234567890"
7-
export ROUTER_ENDPOINT="http://localhost:8801/v1"
8-
export VLLM_ENDPOINT="http://localhost:8000/v1"
9-
export ROUTER_MODELS="auto"
10-
export VLLM_MODELS="openai/gpt-oss-20b"
9+
set -x -e
10+
11+
export ROUTER_API_KEY="${ROUTER_API_KEY:-1234567890}"
12+
export VLLM_API_KEY="${VLLM_API_KEY:-1234567890}"
13+
export ROUTER_ENDPOINT="${ROUTER_ENDPOINT:-http://localhost:8801/v1}"
14+
export VLLM_ENDPOINT="${VLLM_ENDPOINT:-http://localhost:8000/v1}"
15+
export ROUTER_MODELS="${ROUTER_MODELS:-auto}"
16+
export VLLM_MODELS="${VLLM_MODELS:-openai/gpt-oss-20b}"
17+
export SAMPLES_PER_CATEGORY="${SAMPLES_PER_CATEGORY:-5}"
18+
export CONCURRENT_REQUESTS="${CONCURRENT_REQUESTS:-4}"
1119

1220
# Run the benchmark
1321
python router_reason_bench.py \
@@ -19,16 +27,33 @@ python router_reason_bench.py \
1927
--vllm-endpoint "$VLLM_ENDPOINT" \
2028
--vllm-api-key "$VLLM_API_KEY" \
2129
--vllm-models "$VLLM_MODELS" \
22-
--samples-per-category 5 \
30+
--samples-per-category "$SAMPLES_PER_CATEGORY" \
2331
--vllm-exec-modes NR XC \
24-
--concurrent-requests 4 \
32+
--concurrent-requests "$CONCURRENT_REQUESTS" \
2533
--output-dir results/reasonbench
2634

2735
# Generate plots
28-
VLLM_MODEL_FIRST="${VLLM_MODELS%% *}"
29-
ROUTER_MODEL_FIRST="${ROUTER_MODELS%% *}"
30-
VLLM_MODELS_SAFE="${VLLM_MODEL_FIRST//\//_}"
31-
ROUTER_MODELS_SAFE="${ROUTER_MODEL_FIRST//\//_}"
36+
echo "Processing model paths..."
37+
echo "VLLM_MODELS: $VLLM_MODELS"
38+
echo "ROUTER_MODELS: $ROUTER_MODELS"
39+
40+
# Get first model name and make it path-safe
41+
VLLM_MODEL_FIRST=$(echo "$VLLM_MODELS" | cut -d' ' -f1)
42+
ROUTER_MODEL_FIRST=$(echo "$ROUTER_MODELS" | cut -d' ' -f1)
43+
echo "First models: VLLM=$VLLM_MODEL_FIRST, Router=$ROUTER_MODEL_FIRST"
44+
45+
# Replace / with _ for path safety
46+
VLLM_MODELS_SAFE=$(echo "$VLLM_MODEL_FIRST" | tr '/' '_')
47+
ROUTER_MODELS_SAFE=$(echo "$ROUTER_MODEL_FIRST" | tr '/' '_')
48+
echo "Safe paths: VLLM=$VLLM_MODELS_SAFE, Router=$ROUTER_MODELS_SAFE"
49+
50+
# Construct the full paths
51+
VLLM_SUMMARY="results/reasonbench/vllm::${VLLM_MODELS_SAFE}/summary.json"
52+
ROUTER_SUMMARY="results/reasonbench/router::${ROUTER_MODELS_SAFE}/summary.json"
53+
echo "Looking for summaries at:"
54+
echo "VLLM: $VLLM_SUMMARY"
55+
echo "Router: $ROUTER_SUMMARY"
56+
3257
python bench_plot.py \
33-
--summary "results/reasonbench/vllm::${VLLM_MODELS_SAFE}/summary.json" \
34-
--router-summary "results/reasonbench/router::${ROUTER_MODELS_SAFE}/summary.json"
58+
--summary "$VLLM_SUMMARY" \
59+
--router-summary "$ROUTER_SUMMARY"

0 commit comments

Comments
 (0)