import json,collections,hashlib,statistics,math,random,csv,shutil from pathlib import Path import numpy as np from common import read_jsonl,write_json root=Path('/home/ach18533cl/workspace/SceneBench');out=root/'evaluation';rows=list(read_jsonl(root/'release/benchmark.jsonl'));preds={r['id']:r for r in read_jsonl(out/'predictions.jsonl')};assert all(r['id'] in preds for r in rows),'Evaluation incomplete' frozen=json.loads((root/'release/FROZEN.json').read_text());protocol=json.loads((out/'protocol.json').read_text());assert frozen['benchmark_sha256']==protocol['benchmark_sha256']==hashlib.sha256((root/'release/benchmark.jsonl').read_bytes()).hexdigest() records=[] for r in rows: p=preds[r['id']];assert p['gold']==r['answer'];prediction=p.get('prediction');text=r['options'][ord(prediction)-65] if prediction and 0<=ord(prediction)-65