okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
db4dd65e5
main
1"""q36_cmp_gate.py A.json B.json : per prompt identical or the first differing index.""" 2import json ,sys 3a ,b = json .load (open (sys .argv [1 ]))["tokens" ],json .load (open (sys .argv [2 ]))["tokens" ] 4same = 0 5for i , (x ,y )in enumerate (zip (a ,b )): 6n = next ((k for k in range (min (len (x ),len (y )))if x [k ]!= y [k ]),None ) 7if n is None and len (x )== len (y ): 8same += 1 9"p%02d identical (%d tokens)" % (i ,len (x ))) 10else : 11"p%02d DIFFERENT at %s (len %d vs %d)" % (i ,n ,len (x ),len (y ))) 12"identical: %d of %d" % (same ,len (a ))) 13sys .exit (0 if same == len (a )else 1 )