okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
b0fc432ed
main
1"""q36_solo_gate.py --exe E --args "..." --out F.json [--n 128] [--prompts F] [--keys K] : greedy tokens of the 10 parity 2prompts, one request each through the serve protocol; the JSON is what two builds are compared on (cmp_gate.py).""" 3from pathlib import Path 4import argparse ,json ,shlex ,sys 5sys .path .insert (0 ,__file__ .rsplit ("/" ,1 )[0 ]if "/" in __file__ else "." ) 6from q36_harness import Eng ,load_prompts 7 8ap = argparse .ArgumentParser () 9ap .add_argument ("--exe" ,required = True ) 10ap .add_argument ("--args" ,default = "" ) 11ap .add_argument ("--out" ,required = True ) 12ap .add_argument ("--n" ,type = int ,default = 128 ) 13ap .add_argument ("--prompts" ,default = str (Path (__file__ ).resolve ().parent / "parity_prompts.ids" )) 14ap .add_argument ("--keys" ,default = "" ) 15ap .add_argument ("--log" ,default = None ) 16a = ap .parse_args () 17eng = Eng (a .exe ,shlex .split (a .args ),log = a .log ) 18"ready" ,eng .ready ,"info" ,eng .info ,"load %.1fs" % eng .load_s ,flush = True ) 19res = [] 20for i ,ids in enumerate (load_prompts (a .prompts )): 21toks ,done ,ttft ,wall = eng .solo (ids ,a .n ,a .keys ) 22dec = done .split () 23"p%02d %d tok %.1f tok/s %s" % (i ,len (toks ),len (toks )/ max (1e-9 ,wall - (ttft or 0 )),done [:70 ]),flush = True ) 24res .append (toks ) 25json .dump ({"args" :a .args ,"tokens" :res },open (a .out ,"w" )) 26eng .close ()