okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
e79156ae2
main
1"""q36_vram_refusal.py --exe E --model M : an engine start that does not fit the card says so with the numbers. 2 3Starts the engine (--serve) with demanding configurations (many slots, a long context, every expert asked for as a slot) and 4checks that each start either reaches READY or exits 1 with one of the engine's own refusals ("not enough VRAM for N slots ...", 5"not enough VRAM left for the hybrid experts' buffers and slots ...") - never a bare cudaMalloc failure. On a card that holds 6every configuration the check only reports that they started. The engine is stopped right after READY. 7 8python q36_vram_refusal.py --exe build/strata-q36 --model Qwen3.6-35B-A3B-UD-Q4_K_XL.gguf 9""" 10import argparse ,subprocess ,sys ,threading ,time 11 12CONFIGS = [ 13 ["--max-context" ,"8192" ,"--batch" ,"8" ,"--expert-slots" ,"256" ], 14 ["--max-context" ,"32768" ,"--batch" ,"8" ,"--expert-slots" ,"256" ], 15 ["--max-context" ,"8192" ,"--batch" ,"8" ], 16 ["--max-context" ,"32768" ,"--batch" ,"8" ], 17 ["--max-context" ,"131072" ,"--batch" ,"8" ], 18] 19CLEAR = ("not enough VRAM for" ,"not enough VRAM left for the hybrid experts" ) 20RAW = ("cudaMalloc" ,"hipMalloc" ,"out of memory" ) 21 22 23def run (exe ,model ,extra ,timeout ): 24p = subprocess .Popen ([exe ,"--serve" ,"--model" ,model ,* extra ],stdin = subprocess .PIPE ,stdout = subprocess .PIPE , 25stderr = subprocess .PIPE ,text = True ,bufsize = 1 ) 26err = [] 27t = threading .Thread (target = lambda :err .extend (p .stderr ),daemon = True ) 28t .start () 29ready = False 30try : 31for line in p .stdout : 32if line .startswith ("READY" ): 33ready = True 34p .stdin .write ("STOP\n" ) 35p .stdin .flush () 36break 37p .wait (timeout = timeout ) 38except subprocess .TimeoutExpired : 39p .kill () 40t .join (5 ) 41return ready ,p .returncode ,"" .join (err ) 42 43 44def main (): 45ap = argparse .ArgumentParser () 46ap .add_argument ("--exe" ,required = True ) 47ap .add_argument ("--model" ,required = True ) 48ap .add_argument ("--timeout" ,type = int ,default = 900 ) 49a = ap .parse_args () 50ok = True 51for extra in CONFIGS : 52time .sleep (5 )# the previous engine's VRAM is back 53ready ,rc ,err = run (a .exe ,a .model ,extra ,a .timeout ) 54if ready : 55"START %-62s ready" % " " .join (extra )) 56continue 57clear = [l for l in err .splitlines ()if any (c in l for c in CLEAR )] 58raw = [l for l in err .splitlines ()if any (r in l for r in RAW )] 59good = bool (clear )and not raw and rc == 1 60ok &= good 61if not good : 62for l in err .splitlines ()[- 6 :]: 63" | " + l [:240 ]) 64"%s %-62s exit %s: %s" % ("REFUSE" if good else "FAIL " ," " .join (extra ),rc , 65 (clear or raw or err .splitlines ()[- 1 :]or ["(no output)" ])[0 ][:260 ])) 66"GATE" ,"PASS" if ok else "FAIL" ) 67return 0 if ok else 1 68 69 70if __name__ == "__main__" : 71sys .exit (main ())