FWeindel's picture
Complete FACET v2 pass@4 results: 780 solved tasks and 23,700 traces
2fcca1f verified
Raw History Blame
1.79 kB
"""Reproduce complete FACET v2 membership; preserves source task payloads.
Run: python patch.py --out reproduced
Writes kept, newly archived, prior archived and pending payloads separately.
Reproduces membership and payloads, not evaluation columns or image manifests.
Requires huggingface_hub and pyarrow; metadata/selection.json beside this file.
"""
from pathlib import Path
import argparse,json
import pyarrow as pa,pyarrow.parquet as pq
from huggingface_hub import hf_hub_download
def main():
ap=argparse.ArgumentParser();ap.add_argument('--out',type=Path,required=True);a=ap.parse_args()
selection=json.loads((Path(__file__).parent/'metadata/selection.json').read_text())
a.out.mkdir(parents=True,exist_ok=True)
source=pq.read_table(hf_hub_download('FWeindel/validated-tasks','facet_v1/tasks.parquet',repo_type='dataset',revision=selection['base_revision']))
groups={'tasks.parquet':[],'archive-new.parquet':[],'pending.parquet':[]}
for i,r in enumerate(source.select(['path','content_sha256']).to_pylist()):
info=selection['tasks'].get(r['path'])
if info:assert info['content_sha256']==r['content_sha256']
name='pending.parquet' if info is None else 'tasks.parquet' if info['kept'] else 'archive-new.parquet'
if info is None:assert r['path'] in selection['pending_task_ids']
groups[name].append(i)
for name,indices in groups.items():pq.write_table(source.take(pa.array(indices, type=pa.int64())),a.out/name,compression='zstd')
prior=pq.read_table(hf_hub_download('FWeindel/validated-tasks','facet_v1/archive.parquet',repo_type='dataset',revision=selection['base_revision']))
pq.write_table(prior,a.out/'archive-prior.parquet',compression='zstd')
print({**{k:len(v) for k,v in groups.items()},'archive-prior.parquet':prior.num_rows})
if __name__=='__main__':main()