progress / artifacts /scripts /read_identity.py
eyad-silx's picture
push artifacts/scripts/read_identity.py
c41f7a6 verified
Raw History Blame Contribute Delete
595 Bytes
import json
rows = [json.loads(l) for l in open("/root/measure_identity.jsonl")]
print(f"n={len(rows)}")
print(f"{'sample':<48} {'king KL':>9} {'chal KL':>9} {'same':>6}")
allsame = True
maxdiff = 0.0
for r in rows:
sid = r.get("sample_id") or r.get("id") or "?"
k = (r.get("king") or {}).get("kl")
c = (r.get("challenger") or {}).get("kl")
same = k == c
allsame &= same
if k is not None and c is not None:
maxdiff = max(maxdiff, abs(k - c))
print(f"{sid[:48]:<48} {k!s:>9} {c!s:>9} {str(same):>6}")
print("ALL IDENTICAL:", allsame, "| max |diff|:", maxdiff)