File size: 1,793 Bytes
7b0b089
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"""Download locked public benchmark sources; no model calls or Hub writes."""
import concurrent.futures
import hashlib
import json
from pathlib import Path

import httpx

ROOT=Path(__file__).resolve().parents[1]
DEST=ROOT/'.private/dynamic_board_research/expanded_20261031'
LOCKS={
    'typed': {'repo':'LocalLLaMA/typed-decisions','revision':'1c9479de422cc0117abcddfadc3afe2cd8383e40',
              'files':['all/test-00000-of-00001.parquet','bench/score_with_jobs.py',
                       'bench/submit_results.py','README.md','eval.yaml']},
    'safe': {'repo':'harness-hub/safeagents-judge-bench','revision':'5671a11198785784d72822b8df1bce2238f726a4',
             'files':['data/test-00000-of-00001.parquet','bench/common.py','bench/decide.py',
                      'bench/run.py','bench/leaderboard.py','bench/submit_results.py','README.md','eval.yaml']},
}


def download(suite):
    spec=LOCKS[suite]
    with httpx.Client(follow_redirects=True,timeout=90) as client:
        meta=client.get('https://huggingface.co/api/datasets/'+spec['repo']+'/revision/'+spec['revision'])
        meta.raise_for_status();d=meta.json();assert d['sha']==spec['revision']
        p=DEST/(suite+'_meta.txt');p.parent.mkdir(parents=True,exist_ok=True);p.write_text(json.dumps(d))
        for name in spec['files']:
            url=f'https://huggingface.co/datasets/{spec["repo"]}/resolve/{spec["revision"]}/{name}'
            response=client.get(url);response.raise_for_status()
            p=DEST/suite/name;p.parent.mkdir(parents=True,exist_ok=True);p.write_bytes(response.content)
            print(suite,name,hashlib.sha256(response.content).hexdigest(),flush=True)


if __name__=='__main__':
    with concurrent.futures.ThreadPoolExecutor(max_workers=2) as pool:list(pool.map(download,LOCKS))