Download scripts/bench/exp0.sh from jaytonde05/kv-cache-quantization-commands: direct link, hf CLI and curl.
- Browser
- Download file 2.96 kB
-
https://huggingface.co/datasets/jaytonde05/kv-cache-quantization-commands/resolve/main/scripts/bench/exp0.sh
- Command line
-
hf download hf://datasets/jaytonde05/kv-cache-quantization-commands/scripts/bench/exp0.sh
-
curl -L -o exp0.sh https://huggingface.co/datasets/jaytonde05/kv-cache-quantization-commands/resolve/main/scripts/bench/exp0.sh
2.96 kB
| # Exp 0 feasibility gate for one config: launch vLLM, record startup facts, | |
| # run the smoke subsets through `vllm bench serve`, run a KL probe, stop. | |
| # Usage: ./exp0.sh V-BF16|V-BF16-FI|V-FP8|V-FP4 | |
| set -u | |
| CFG=$1 | |
| source ~/kvq-env/bin/activate | |
| MODEL=~/models/Qwen3.8-27B | |
| case $CFG in | |
| V-BF16) KV=bfloat16; BE=FLASH_ATTN ;; | |
| V-BF16-FI) KV=bfloat16; BE=FLASHINFER ;; | |
| V-FP8) KV=fp8_e4m3; BE=FLASH_ATTN ;; | |
| V-FP4) KV=nvfp4; BE=FLASHINFER ;; | |
| *) echo "unknown config $CFG"; exit 2 ;; | |
| esac | |
| OUT=~/bench/exp0/$CFG; mkdir -p $OUT; S=~/bench/data/smoke | |
| LOG=$OUT/server.log | |
| echo "== $CFG: kv=$KV backend=$BE $(date -u)" | |
| vllm serve $MODEL --served-model-name Qwen/Qwen3.8-27B --port 8000 --dtype bfloat16 \ | |
| --max-model-len 163840 --gpu-memory-utilization 0.90 --reasoning-parser qwen3 --seed 0 \ | |
| --kv-cache-dtype $KV --attention-backend $BE > $LOG 2>&1 & | |
| PID=$! | |
| # Wait up to 30 min for the server (first FlashInfer start JIT-compiles kernels). | |
| for i in $(seq 1 180); do | |
| if curl -sf localhost:8000/health >/dev/null; then echo "server ready after $((i*10))s"; break; fi | |
| if ! kill -0 $PID 2>/dev/null; then echo "SERVER_EXITED"; tail -40 $LOG; echo "EXP0_FAIL $CFG"; exit 1; fi | |
| sleep 10 | |
| done | |
| curl -sf localhost:8000/health >/dev/null || { echo "SERVER_TIMEOUT"; tail -40 $LOG; kill $PID; echo "EXP0_FAIL $CFG"; exit 1; } | |
| echo "== startup facts" | |
| grep -iE "kv cache|attention backend|Using .*backend|maximum concurrency|cache_dtype|kv_cache_dtype|nvfp4|fp8" $LOG \ | |
| | grep -v "Gloo\|NCCL" | tail -15 | tee $OUT/startup_facts.txt | |
| BENCH="vllm bench serve --backend openai-chat --endpoint /v1/chat/completions --base-url http://localhost:8000 \ | |
| --model Qwen/Qwen3.8-27B --tokenizer $MODEL --skip-chat-template --disable-shuffle --no-oversample \ | |
| --custom-output-len -1 --save-result --save-detailed --result-dir $OUT --num-warmups 0" | |
| run() { # name file n concurrency effort temperature [extra args] | |
| local name=$1 file=$2 n=$3 conc=$4 eff=$5 temp=$6; shift 6 | |
| echo "== bench $name" | |
| $BENCH --dataset-path $S/$file --num-prompts $n --max-concurrency $conc --temperature $temp \ | |
| --extra-body "{\"reasoning_effort\":\"$eff\"}" --result-filename $name.json "$@" 2>&1 \ | |
| | grep -E "Successful requests|Failed requests|Benchmark duration|Mean TTFT|Output token throughput|Error|Traceback" | |
| } | |
| run ruler_4k ruler_4k_26.jsonl 26 26 low 0 --dataset-name custom | |
| run ruler_128k ruler_128k_13.jsonl 13 4 low 0 --dataset-name custom | |
| run docvqa docvqa_20.jsonl 20 20 low 0 --dataset-name custom_image --custom-ensure-client-side-data --custom-output-len 16384 | |
| run gpqa gpqa_8.jsonl 8 8 xhigh 1.0 --dataset-name custom --top-p 0.95 --top-k 20 | |
| run lcb lcb_10.jsonl 10 10 xhigh 1.0 --dataset-name custom --top-p 0.95 --top-k 20 | |
| echo "== KL probe" | |
| python ~/bench/kl_probe.py --out $OUT/kl_probe.json 2>&1 | tail -3 | |
| kill $PID; wait $PID 2>/dev/null | |
| echo "EXP0_OK $CFG $(date -u)" | |