okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
2b36e8a02
main
1#!/usr/bin/env python3 2"""The 24-prompt identity gate against a RECORDED set of answers: start the server of CONFIG, send the 24 greedy prompts of 3research/tools/dgx-spark-2026-10/dgx_quality24.py, and compare every answer byte for byte with the answers in REFERENCE.json (a file research/tools/dgx-spark-2026-10/dgx_quality24.py wrote: 4its rows hold "a" and "b"; --side picks which one is the reference, "a" by default). 5 6python research/tools/dgx-spark-2026-10/dgx_gate_ref.py CONFIG REFERENCE.json OUT.json [--side a|b] [--port 8091] 7 8Exit code 0 = every answer identical. This is the gate a build on a DGX Spark has to pass against the answers the 2026-10-26 handover 9recorded (bench/quality24-fork.json for IQ3_S, bench/quality24-nvfp4-fork.json for NVFP4). 10""" 11from __future__import annotations 12 13import argparse 14import json 15import sys 16from pathlib import Path 17 18sys .path .insert (0 ,str (Path (__file__ ).resolve ().parent )) 19import dgx_quality24 as q # noqa: E402 20 21 22def main ()-> int : 23ap = argparse .ArgumentParser () 24ap .add_argument ("config" ) 25ap .add_argument ("reference" ) 26ap .add_argument ("out" ) 27ap .add_argument ("--side" ,choices = ("a" ,"b" ),default = "a" ) 28ap .add_argument ("--port" ,type = int ,default = 8091 ) 29a = ap .parse_args () 30ref = json .loads (Path (a .reference ).read_text (encoding = "utf-8" )) 31rows = ref ["rows" ] 32if [r ["prompt" ]for r in rows ]!= q .PROMPTS : 33"the reference was made with other prompts than research/tools/dgx-spark-2026-10/dgx_quality24.py has now; the gate is not comparable" ,file = sys .stderr ) 34return 2 35mine = q .run_config (a .config ,a .port ,"ref" ) 36out = [{"prompt" :r ["prompt" ],"reference" :r [a .side ],"answer" :m ,"identical" :r [a .side ]== m }for r ,m in zip (rows ,mine )] 37same = sum (1 for r in out if r ["identical" ]) 38Path (a .out ).write_text (json .dumps ({"identical" :same ,"total" :len (out ),"reference" :a .reference ,"side" :a .side ,"rows" :out },indent = 1 ), 39encoding = "utf-8" ) 40f" { same } of { len ( out ) } answers identical to { Path ( a . reference ). name } (side { a . side } )" ) 41for i ,r in enumerate (out ): 42if not r ["identical" ]: 43f" differs at prompt { i } : { r [ 'prompt' ][: 60 ]!r } " ) 44f" reference: { r [ 'reference' ][: 90 ]!r } " ) 45f" this run : { r [ 'answer' ][: 90 ]!r } " ) 46return 0 if same == len (out )else 1 47 48 49if __name__ == "__main__" : 50sys .exit (main ())