okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
7b52a0b62
main
1#!/usr/bin/env bash 2# One arm of the community quants report: 3 fresh bench runs of one quant, then one 3# 32k needle pass. The engine restarts before every run, because bench_prefill.py 4# refuses a fresh prompt that reused cached tokens. Only the quant differs between 5# the cfg-*.json files; every other setting is identical. 6# 7# ./run-one-quant.sh coder-iq1_m | iq2_xs | iq3_xxs 8# 9# ROOT is this machine's Strata checkout; change it, and the absolute paths inside 10# ../data/cfg-*.json, before running this elsewhere. 11set -u 12ROOT =/home/jason/Projects/Strata 13HERE =$( cd " $( dirname " $ 0" ) " && pwd ) 14Q =$ 1 15OUT =${ OUT :- $ HERE /out} 16CFG =$ HERE /../data/cfg-$ Q.json 17LOG =$ OUT /$ Q.engine.log 18PY =$ ROOT /.venv/bin/python 19. " $ HOME /.local/opt/strata-env.sh" 20 21MODEL =$( " $ PY " -c 'import json,sys; print(json.load(open(sys.argv[1]))["model_name"])' " $ CFG " ) 22 23stop_server () { 24pkill -f "[s]erve/server.py" 2 > /dev/null 25pkill -f "[e]ngine/strata --serve" 2 > /dev/null 26sleep 5 27} 28 29wait_loaded () { 30 locali =0 31while [$ i -lt 900 ];do 32curl -s http://127.0.0.1:8080/health| grep -q '"loaded": true' && return 0 33i =$((i + 2)) 34sleep 2 35done 36return 1 37} 38 39mkdir -p " $ OUT " 40[ -f" $ CFG " ] || {echo "no config $ CFG " ;exit 1; } 41rm -f " $ OUT / $ Q -stop" 42: > " $ LOG " 43 44for run in 1 2 3;do 45stop_server 46: > " $ OUT / $ Q -server-run $ run .out" 47nohup " $ PY " " $ ROOT /serve/server.py" --engine strata--config " $ CFG " --port 8080 \ 48> " $ OUT / $ Q -server-run $ run .out" 2 >&1 & 49if !wait_loaded ;then 50echo " $ Q run $ run : server never reported loaded" 51tail -20 " $ OUT / $ Q -server-run $ run .out" 52exit 1 53fi 54echo " $ Q run $ run : loaded, benching" 55" $ PY " " $ HERE /sample_mem.py" --out " $ OUT / $ Q -mem-run $ run .csv" --seconds 600--stop-file " $ OUT / $ Q -stop" & 56sampler =$ ! 57" $ PY " " $ ROOT /tools/hip/bench_prefill.py" --model " $ MODEL " \ 58--url http://127.0.0.1:8080--engine-log " $ LOG " --label " $ Q -run $ run " \ 59--output " $ OUT / $ Q -run $ run .json" | tail -1 > /dev/null ||echo " $ Q run $ run : BENCH FAILED" 60touch " $ OUT / $ Q -stop" 61wait $ sampler 2 > /dev/null 62rm -f " $ OUT / $ Q -stop" 63done 64 65echo " $ Q : needle pass on the run-3 server" 66" $ PY " " $ HERE /sample_mem.py" --out " $ OUT / $ Q -mem-needle.csv" --seconds 900--stop-file " $ OUT / $ Q -stop" & 67sampler =$ ! 68" $ PY " " $ ROOT /tools/needle_bench.py" --url http://127.0.0.1:8080 \ 69--lengths 32k--depths 10,50,90--out " $ OUT / $ Q -needles.json" ||echo " $ Q : NEEDLE FAILED" 70touch " $ OUT / $ Q -stop" 71wait $ sampler 2 > /dev/null 72rm -f " $ OUT / $ Q -stop" 73 74stop_server 75echo " $ Q : done"