"""Publish an exact, revision-pinned copy of the official single-turn IFBench data.""" import argparse import hashlib import json from pathlib import Path from urllib.request import urlopen from datasets import Dataset, Features, Json, List, Value, load_dataset from huggingface_hub import HfApi, hf_hub_download def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--output-dataset", required=True) parser.add_argument("--source-revision", required=True) args = parser.parse_args() source = f"https://raw.githubusercontent.com/allenai/IFBench/{args.source_revision}/ifbench/data/IFBench_test.jsonl" raw = urlopen(source).read() records = [json.loads(line) for line in raw.splitlines() if line.strip()] assert len(records) == 300 and len({row['key'] for row in records}) == 300 features = Features( { "key": Value("string"), "prompt": Value("string"), "instruction_id_list": List(Value("string")), "kwargs": Json(), } ) dataset = Dataset.from_list(records, features=features) assert list(dataset) == records api = HfApi() # Never replace an existing repository or its dataset card. api.create_repo(args.output_dataset, repo_type="dataset", private=False, exist_ok=False) dataset.push_to_hub(args.output_dataset, config_name="default", split="test") generated_card = Path(hf_hub_download(args.output_dataset, "README.md", repo_type="dataset")).read_text() yaml = generated_card.split("---", 2)[1].strip() card = f"""--- license: odc-by language: - en tags: - evaluation - instruction-following {yaml} --- | subset | description | num_samples | | --- | --- | ---: | | `default` | Official single-turn IFBench test prompts, unchanged; `test` split | {len(dataset)} | # IFBench An exact mirror of the single-turn test data from [AllenAI IFBench](https://github.com/allenai/IFBench). Credit: Valentina Pyatkin, Saumya Malik, Victoria Graf, Hamish Ivison, Shengyi Huang, Pradeep Dasigi, Nathan Lambert, and Hannaneh Hajishirzi, [Generalizing Verifiable Instruction Following](https://huggingface.co/papers/2507.02833). ## Provenance and license - Source revision: `{args.source_revision}`. - Source file: [`ifbench/data/IFBench_test.jsonl`]({source}). - Original file SHA-256: `{hashlib.sha256(raw).hexdigest()}`. - No filtering, prompt changes, or row reordering. All original fields and values are preserved. - `kwargs` uses the Hugging Face Datasets JSON feature to preserve heterogeneous argument dictionaries; use `datasets>=4.7.0` to load it as a list of dictionaries. Other fields are `key`, `prompt`, and `instruction_id_list`. - The data is licensed under [ODC-BY-1.0](https://opendatacommons.org/licenses/by/1-0/), as stated in the [upstream README](https://github.com/allenai/IFBench/blob/{args.source_revision}/README.md#licensing). It is intended for research and educational use under Ai2's Responsible Use Guidelines. It includes outputs generated by third-party models, which may be subject to separate terms. - Verifier code is separately Apache-2.0 licensed; it is not part of this dataset release. ## Reproducing The builder is published at `scripts/create_dataset.py`. Exact publication invocation: ```bash python scripts/create_dataset.py --output-dataset {args.output_dataset} --source-revision {args.source_revision} ``` To reproduce independently, use an unused repository name under your own namespace. The builder refuses to overwrite an existing repository. It requires `datasets>=4.7.0` and `huggingface_hub`, and a token with write access to the destination. ## Loading ```python from datasets import load_dataset dataset = load_dataset("{args.output_dataset}", "default", split="test") ``` Pin a Hub commit revision for reproducible evaluation. This repository contains evaluation data, not training data. """ api.upload_file( path_or_fileobj=card.encode(), path_in_repo="README.md", repo_id=args.output_dataset, repo_type="dataset" ) commit = api.upload_file( path_or_fileobj=__file__, path_in_repo="scripts/create_dataset.py", repo_id=args.output_dataset, repo_type="dataset", commit_message="Publish the script that built this dataset", ) loaded = load_dataset(args.output_dataset, "default", split="test", revision=commit.oid) assert list(loaded) == records print(json.dumps({"dataset": args.output_dataset, "revision": commit.oid, "samples": len(loaded)})) if __name__ == "__main__": main()