#!/usr/bin/env python3 """评测问题仅投影为源路径/截止时间,Writer下游不能读取题目或答案。""" import argparse import json from pathlib import Path import sys ROOT=Path(__file__).resolve().parents[1] sys.path.insert(0,str(ROOT/'scripts')) from download_assets import atomic,sha def main(): parser=argparse.ArgumentParser();parser.add_argument('--benchmark',choices=['ovobench','streamingbench'],required=True) args=parser.parse_args();sources={} for line in (ROOT/'manifests/eval_questions.jsonl').open(): row=json.loads(line) if row['benchmark']!=args.benchmark:continue key=row['source_video'];meta=sources.setdefault(key,dict(max_query_time=0.)) meta['max_query_time']=max(meta['max_query_time'],float(row['query_time'])) inventory=json.loads((ROOT/'provenance/eval_media_inventory.json').read_text()) prefix='ovo/' if args.benchmark=='ovobench' else 'streaming/' for video,meta in sources.items(): actual=inventory[prefix+video] if not (ROOT/actual['path']).exists():raise FileNotFoundError(video) meta.update(path=actual['path'],media_sha256=actual['sha256'],storage_bytes=actual['bytes']) value=dict(frozen=True,benchmark=args.benchmark,sources=sources,QA_or_answers_in_payload=False, question_manifest_sha256=sha(ROOT/'manifests/eval_questions.jsonl'), sampling='locked_original_MEMO_full_video_sample_indices_then_causal_query_prefix') target=ROOT/'manifests'/('eval_sources.'+args.benchmark+'.json') if target.exists() and json.loads(target.read_text())!=value:raise FileExistsError('不覆盖不同来源冻结表') atomic(target,value);print(json.dumps(dict(benchmark=args.benchmark,videos=len(sources),sha256=sha(target)))) if __name__=='__main__':main()