import hashlib import json from common import ROOT, rows, save_json from code_sandbox import check_code directory = ROOT/'data/coding' records = rows(directory/'all_tasks.jsonl') accepted, outcomes = [], [] for i,row in enumerate(records): result = check_code(row['reference_code'],row['entry_point'],row['test_code']) outcomes.append({'id':row['id'],**result}) if result['passed']: accepted.append(row) if i%50==0: print('Canonical task checks',i+1,'accepted',len(accepted),flush=True) save_json(directory/'canonical_validation.json',outcomes) groups = {'discovery':[],'validation':[],'confirmation':[]} for source in ['humaneval','mbpp']: pool = sorted([r for r in accepted if r['source']==source],key=lambda r:hashlib.sha256(('wspforge-code-v1:'+r['id']).encode()).hexdigest()) for split,start,count in [('discovery',0,12),('validation',12,12),('confirmation',24,24)]: if len(pool)