Skip to content

Commit c5f210f

Browse files
joaclaude
andcommitted
vastai: The agent replay on a rented card
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013RsvdtnrmKHFtgKKXaXTjJ
1 parent 989309d commit c5f210f

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

‎scripts/vastai/agent.sh‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
# The Benchmarks page's agent replay on one rented card: Phobos built from REF
3+
# and llama.cpp each serve Qwen3.6-35B-A3B-UD-Q4_K_M while scripts/agent_bench.py
4+
# replays the recorded requests in /root/traces, at a context of CTX tokens.
5+
# llama.cpp fits its expert split to the card itself. Wants /root/build.sh
6+
# beside it and the devel image, with disk for the 22 GB model. Run it under
7+
# nohup; /root/results/STAGE says which stage runs.
8+
#
9+
# bash agent.sh REF [CTX] [AGENT_BENCH_ARGS]
10+
set -uo pipefail
11+
REF="${1:?usage: agent.sh REF [CTX] [AGENT_BENCH_ARGS]}"
12+
CTX="${2:-32768}"
13+
shift; [ $# -gt 0 ] && shift
14+
OUT=/root/results; W=/root/bench; LLAMA="${LLAMA:-b11681}"
15+
M=Qwen3.6-35B-A3B-UD-Q4_K_M.gguf
16+
mkdir -p "$OUT" "$W/models"
17+
stage() { echo "$1 $(date +%T)" | tee -a "$OUT/STAGE"; }
18+
fetch() {
19+
cd "$W"
20+
base=https://github.com/ggml-org/llama.cpp/releases/download/$LLAMA
21+
curl -sSfL "$base/llama-$LLAMA-bin-ubuntu-cuda-12.8-x64.tar.gz" | tar -xz && mv "llama-$LLAMA" llama
22+
curl -sSfL "$base/cudart-llama-$LLAMA-bin-ubuntu-cuda-12.8-x64.tar.gz" | tar -xz --strip-components=1 -C llama
23+
until curl -sSfL -C - -o "models/$M.part" "https://huggingface.co/unsloth/Qwen3.6-35B-A3B-GGUF/resolve/main/$M"; do sleep 2; done
24+
mv "models/$M.part" "models/$M"; sha256sum "models/$M"
25+
}
26+
stage apt
27+
apt-get update -qq && apt-get install -y -qq python3 curl ca-certificates libgomp1 build-essential git pkg-config libclang-dev libzstd-dev zlib1g-dev > "$OUT/apt.log" 2>&1 || { stage APT-FAILED; exit 1; }
28+
stage fetch+build
29+
fetch > "$OUT/fetch.log" 2>&1 &
30+
FETCH=$!
31+
bash /root/build.sh "$REF" > "$OUT/build.log" 2>&1 || { stage BUILD-FAILED; exit 1; }
32+
wait $FETCH || { stage FETCH-FAILED; exit 1; }
33+
nvidia-smi --query-gpu=name,driver_version,power.limit,clocks.max.sm,memory.total --format=csv > "$OUT/card.txt"
34+
free -g > "$OUT/host.txt"; nproc >> "$OUT/host.txt"
35+
stage agent
36+
cd /root/src && python3 -u scripts/agent_bench.py --no-build --replay /root/traces/*.requests.jsonl -r 1 --ctx "$CTX" \
37+
-m "$W/models/$M" --llama-server "$W/llama/llama-server" --max-idle-power 200 --out "$OUT/agent" "$@" \
38+
> "$OUT/agent.log" 2>&1 || stage AGENT-FAILED
39+
nvidia-smi -q -d PERFORMANCE > "$OUT/perf-after.txt"
40+
stage DONE

0 commit comments

Comments
 (0)