okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
6e1085c1d
main
1"""Use remaining authorized reserve for IQ3 260K recall at two extra positions.""" 2import json 3from pathlib import Path 4import socket 5import subprocess 6import sys 7import time 8 9from strata_bench_continue import Continuation ,b 10 11 12def main (): 13with socket .socket ()as sock : 14if sock .connect_ex (("127.0.0.1" ,b .PORT ))== 0 : 15raise RuntimeError ("Benchmark service is occupied; it was preserved" ) 16runner = Continuation (["iq3_xxs" ,"iq3_s" ]) 17 (b .OUT / "supplement.pid" ).write_text (str (b .os .getpid ())) 18supervisor = subprocess .Popen ([sys .executable ,str (b .SCRIPT ),"--watchdog" ,str (b .os .getpid ()), 19str (runner .clock ["measurement_stop_epoch" ]+ 300 )],stdout = subprocess .DEVNULL , 20stderr = subprocess .DEVNULL ,creationflags = b .FLAGS ) 21try : 22runner .budget ("reserve_iq3_recall" ,max (0 ,runner .hard - time .monotonic ())) 23runner .init_tokenizer () 24runner .inventory () 25for model in ("iq3_xxs" ,"iq3_s" ): 26eligible = [r for r in runner .rows if r ["model" ]== model and r ["group" ]== "speed" 27and r .get ("target" )== 260000 and r .get ("ok" )and r .get ("token_count_matches" ) 28and r .get ("engine_environment" , {}).get ("STRATA_UNBUFFERED_LOAD" )== "1" ] 29estimate = max ((r ["client_elapsed_s" ]for r in eligible ),default = 900 )* 2 + 120 30if not eligible or runner .left ()< estimate : 31runner .event ("supplement_skipped" ,requested_model = model , 32reason = "no successful main 260K trial or insufficient reserve for both positions" , 33estimated_seconds = estimate ,remaining_seconds = runner .left ()) 34continue 35def run (): 36runner .start (model ,262144 ) 37for depth in (10 ,90 ): 38label = f"recall-260000-d { depth } " 39if any (r ["model" ]== model and r ["label" ]== label and r .get ("ok" ) 40and r .get ("engine_environment" , {}).get ("STRATA_UNBUFFERED_LOAD" )== "1" for r in runner .rows ): 41continue 42runner .perform (label ,runner .make (260000 ,"code" ,9 ,depth ),260000 , 43group = "recall" ,max_tokens = 40 ,expected = f"amber-quartz-260000-9- { depth } " ) 44runner .safe_block (run ) 45runner .stop () 46runner .event ("supplement_finished" ) 47finally : 48if runner .active_worker and runner .active_worker .poll ()is None : 49b .kill_tree (runner .active_worker ) 50for job in runner .child_jobs : 51b .kill_tree (job ) 52runner .stop () 53runner .monitor .done .set () 54if supervisor .poll ()is None : 55supervisor .terminate () 56 57 58if __name__ == "__main__" : 59main ()