Download eval/make_subset.py from RightNowAI/RightNow-Mini: direct link, hf CLI and curl.
- Browser
- Download file 1.4 kB
-
https://huggingface.co/RightNowAI/RightNow-Mini/resolve/main/eval/make_subset.py
- Command line
-
hf download hf://RightNowAI/RightNow-Mini/eval/make_subset.py
-
curl -L -o make_subset.py https://huggingface.co/RightNowAI/RightNow-Mini/resolve/main/eval/make_subset.py
1.4 kB
| """The evaluation subset: 100 instances of SWE-bench Verified, drawn once with a fixed seed. | |
| python eval/make_subset.py # writes eval/subset.json | |
| The file also lists every repository of SWE-bench Verified: training data must share none of them. | |
| """ | |
| import json | |
| import random | |
| import sys | |
| from pathlib import Path | |
| from datasets import load_dataset | |
| DATASET, SPLIT, SEED, N = "princeton-nlp/SWE-bench_Verified", "test", 20261201, 100 | |
| def main(): | |
| out = Path(sys.argv[1] if len(sys.argv) > 1 else Path(__file__).parent / "subset.json") | |
| ds = load_dataset(DATASET, split=SPLIT) | |
| repo_of = dict(zip(ds["instance_id"], ds["repo"])) | |
| ids = sorted(repo_of) | |
| pick = sorted(random.Random(SEED).sample(ids, N)) | |
| per_repo = {} | |
| for i in pick: | |
| per_repo[repo_of[i]] = per_repo.get(repo_of[i], 0) + 1 | |
| out.write_text(json.dumps({ | |
| "dataset": DATASET, "split": SPLIT, "dataset_fingerprint": ds._fingerprint, "total_instances": len(ids), | |
| "seed": SEED, "n": N, "method": "random.Random(seed).sample(sorted(instance_ids), n)", | |
| "instance_ids": pick, "instances_per_repo": dict(sorted(per_repo.items())), | |
| "all_repos_of_the_benchmark": sorted(set(repo_of.values())), | |
| }, indent=1) + "\n", encoding="utf-8") | |
| print(f"{out}: {len(pick)} of {len(ids)} instances, {len(per_repo)} repositories") | |
| if __name__ == "__main__": | |
| main() | |