File size: 4,124 Bytes
15689bb
 
 
 
 
 
 
 
 
5f4f5d4
15689bb
 
 
 
 
 
 
 
 
5f4f5d4
15689bb
 
 
 
 
 
 
 
 
 
5f4f5d4
15689bb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/bash
# run_frames_pixels.sh — task 11 (resolution x frame-rate sweep) on a multi-GPU machine without Slurm.
#   bash code/run_frames_pixels.sh --dry-run                 # count the work per benchmark x condition (no GPU)
#   PILOT=1 bash code/run_frames_pixels.sh                    # MVBench, LVBench, TimeScope only (report timing first)
#   bash code/run_frames_pixels.sh                            # all 84 benchmarks
#   BENCH="MVBench,LVBench" bash code/run_frames_pixels.sh    # explicit benchmark list
# One vLLM server per GPU (Qwen3-VL-8B, --max-model-len 65536, --limit-mm-per-prompt images 1024), one
# runner process that round-robins over the servers. Resumable: rows already in results/conditions_results.csv
# are skipped, so the conditions that exist on the origin cluster are never re-run.
# Env: NGPU (default all), WORKERS (default 6 per GPU), GPU_UTIL (0.85), MAX_SEQS (default 32; use 8 on 32 GB GPUs), PORT0 (8011),
#      PY (python3), VLLM (vllm), CONDS (default: the task-11 list below), TOKEN_BUDGET (58000), MAX_IMAGES (1024)
set -u
CODE=$(cd "$(dirname "$0")" && pwd); ROOT=$(cd "$CODE/.." && pwd)
export BENCH_BASE=${BENCH_BASE:-$ROOT/data}            # <root>/data/store/normalized/<hash>/..., <root>/data/logs
export P1_SAMPLES_DIR=${P1_SAMPLES_DIR:-$ROOT/items/samples}
export P1_RESULTS_ROOT=${P1_RESULTS_ROOT:-$ROOT/results}
export P1_MANIFEST=${P1_MANIFEST:-$ROOT/manifest/manifest_subset.jsonl}
mkdir -p "$BENCH_BASE/logs" "$P1_RESULTS_ROOT" "$ROOT/logs"
[ -d "$BENCH_BASE/store/normalized" ] || { echo "unpack the video shards into $BENCH_BASE/store/normalized first"; exit 2; }
PY=${PY:-python3}; VLLM=${VLLM:-vllm}; PORT0=${PORT0:-8011}; GPU_UTIL=${GPU_UTIL:-0.85}; MAX_SEQS=${MAX_SEQS:-32}
TOKEN_BUDGET=${TOKEN_BUDGET:-58000}; MAX_IMAGES=${MAX_IMAGES:-1024}
MODEL="Qwen/Qwen3-VL-8B-Instruct"; REV=0c351dd01ed87e9c1b53cbc748cba10e6187ff3b
CONDS=${CONDS:-v_blind,v_1,v_32,v_32_s448,v_32_s224,v_32_s168,v_32_s336,v_8_s224,v_128_s224,v_fps0.25_s224,v_fps0.5_s224,v_fps1_s224,v_fps2_s224}
RUNNER="$CODE/exp/pipeline/stage_p1_runner.py"
if [ "${PILOT:-0}" = "1" ]; then BENCH=${BENCH:-MVBench,LVBench,TimeScope}; fi
BENCH_ARG=(); [ -n "${BENCH:-}" ] && BENCH_ARG=(--bench "$BENCH")
if [ "${1:-}" = "--dry-run" ]; then
  "$PY" "$RUNNER" --conditions "$CONDS" --endpoints http://127.0.0.1:1/v1 --token-budget "$TOKEN_BUDGET" --max-images "$MAX_IMAGES" "${BENCH_ARG[@]}" --dry-run; exit $?
fi
NGPU=${NGPU:-$(nvidia-smi -L 2>/dev/null | wc -l)}; [ "$NGPU" -ge 1 ] || { echo "no GPU found"; exit 2; }
WORKERS=${WORKERS:-$((6 * NGPU))}
export VLLM_USE_FLASHINFER_SAMPLER=0 PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True TOKENIZERS_PARALLELISM=false
PIDS=(); EPS=""
for i in $(seq 0 $((NGPU - 1))); do
  PORT=$((PORT0 + i)); EPS="${EPS:+$EPS,}http://127.0.0.1:$PORT/v1"
  CUDA_VISIBLE_DEVICES=$i "$VLLM" serve "$MODEL" --revision "$REV" --served-model-name "$MODEL" --host 127.0.0.1 --port "$PORT" \
      --max-model-len 65536 --gpu-memory-utilization "$GPU_UTIL" --max-num-seqs "$MAX_SEQS" \
      --limit-mm-per-prompt "{\"image\": $MAX_IMAGES}" --mm-processor-cache-gb 0 \
      > "$ROOT/logs/vllm_gpu${i}.log" 2>&1 &
  PIDS+=($!)
done
trap 'for p in "${PIDS[@]}"; do kill "$p" 2>/dev/null; done' EXIT
for i in $(seq 0 $((NGPU - 1))); do
  PORT=$((PORT0 + i))
  for t in $(seq 1 180); do curl -sf "http://127.0.0.1:$PORT/v1/models" >/dev/null 2>&1 && break; kill -0 "${PIDS[$i]}" 2>/dev/null || { echo "vLLM on GPU $i died, see logs/vllm_gpu${i}.log"; exit 1; }; sleep 10; done
  echo "[frames_pixels] vLLM ready on GPU $i (:$PORT)"
done
echo "[frames_pixels] launch: --max-model-len 65536 --limit-mm-per-prompt images=$MAX_IMAGES --max-num-seqs $MAX_SEQS --gpu-memory-utilization $GPU_UTIL; runner --token-budget $TOKEN_BUDGET --max-images $MAX_IMAGES --workers $WORKERS" | tee -a "$ROOT/logs/launch_params.txt"
"$PY" "$RUNNER" --conditions "$CONDS" --endpoints "$EPS" --workers "$WORKERS" --token-budget "$TOKEN_BUDGET" --max-images "$MAX_IMAGES" "${BENCH_ARG[@]}" 2>&1 | tee -a "$ROOT/logs/runner.log"
rc=${PIPESTATUS[0]}
echo "[frames_pixels] runner finished rc=$rc"; exit $rc