Datasets:
Download make_v14.py from dotlabs/smolcua: direct link, hf CLI and curl.
- Browser
- Download file 2.79 kB
-
https://huggingface.co/datasets/dotlabs/smolcua/resolve/main/make_v14.py
- Command line
-
hf download hf://datasets/dotlabs/smolcua/make_v14.py
-
curl -L -o make_v14.py https://huggingface.co/datasets/dotlabs/smolcua/resolve/main/make_v14.py
2.79 kB
| """Build the three-pass default from v1.3 without changing retained questions.""" | |
| import hashlib | |
| import json | |
| from pathlib import Path | |
| SOURCE_SHA256 = '0e6d365ae37fafd4f7590c40eed2fb56b3f2b1db0d88e4d5052353b85c7c445a' | |
| PROTOCOL = 'smolcua-v1.4-three-passes' | |
| def prepare_subset(source, destination): | |
| source,destination=Path(source),Path(destination) | |
| manifest=json.loads((source/'manifest.json').read_text()) | |
| data=(source/'questions_all_passes.jsonl').read_bytes() | |
| if hashlib.sha256(data).hexdigest()!=SOURCE_SHA256: | |
| raise ValueError('Expected pinned SmolCUA v1.3 source') | |
| rows=[json.loads(line) for line in data.splitlines() if line.strip()] | |
| rows=[r for r in rows if r['pass'] in (1,2,3)] | |
| ids={r['id'] for r in rows} | |
| if len(ids)!=1200 or any(sum(r['pass']==p for r in rows)!=400 for p in (1,2,3)): | |
| raise ValueError('Expected 400 questions in each of three passes') | |
| destination.mkdir(parents=True,exist_ok=True) | |
| (destination/'private').mkdir(exist_ok=True) | |
| def write(path, records): | |
| payload=''.join(json.dumps(r,ensure_ascii=False,separators=(',',':'))+'\n' for r in records).encode() | |
| path.write_bytes(payload) | |
| return hashlib.sha256(payload).hexdigest() | |
| question_sha=write(destination/'questions_all_passes.jsonl',rows) | |
| for p in (1,2,3):write(destination/f'pass_{p:02d}_questions.jsonl',[r for r in rows if r['pass']==p]) | |
| scoring={} | |
| for name in ('answers_all_passes.jsonl','weights_all_passes.jsonl'): | |
| data=(source/'private'/name).read_bytes() | |
| if hashlib.sha256(data).hexdigest()!=manifest['scoring_file_sha256'][name]: | |
| raise ValueError('Scoring source integrity mismatch') | |
| records=[json.loads(line) for line in data.splitlines() if line.strip()] | |
| records=[r for r in records if r['id'] in ids] | |
| if len(records)!=1200:raise ValueError('Incomplete scoring data') | |
| scoring[name]=write(destination/'private'/name,records) | |
| manifest.update(version='1.4',edition='compact-1200-three-pass',passes=3,total_instances=1200, | |
| selection_protocol=PROTOCOL,source_version='1.3',source_question_file_sha256=SOURCE_SHA256, | |
| question_file_sha256=question_sha,scoring_file_sha256=scoring, | |
| selection='Retain passes 1, 2 and 3 of pinned v1.3; same 400 item positions, questions, answers and weights.', | |
| notes='Three-pass edition; 100 points per pass. Scores and worst-pass reliability are not interchangeable with five-pass editions.') | |
| (destination/'manifest.json').write_text(json.dumps(manifest,indent=2)+'\n') | |
| return destination | |
| if __name__=='__main__': | |
| base=Path(__file__).resolve().parent | |
| print('Built SmolCUA v1.4:',prepare_subset(base/'runs/v1_3_seed_20261023',base/'runs/v1_4_seed_20261023')) | |