Delete Frontier-CS.py with huggingface_hub
Browse files- Frontier-CS.py +0 -145
Frontier-CS.py
DELETED
|
@@ -1,145 +0,0 @@
|
|
| 1 |
-
"""Frontier-CS: Evolving Challenges for Evolving Intelligence"""
|
| 2 |
-
|
| 3 |
-
import os
|
| 4 |
-
import datasets
|
| 5 |
-
|
| 6 |
-
_DESCRIPTION = """
|
| 7 |
-
Frontier-CS is an unsolved, open-ended, verifiable, and diverse benchmark
|
| 8 |
-
for evaluating AI on challenging computer science problems.
|
| 9 |
-
"""
|
| 10 |
-
|
| 11 |
-
_HOMEPAGE = "https://frontier-cs.org"
|
| 12 |
-
_LICENSE = "Apache-2.0"
|
| 13 |
-
|
| 14 |
-
class FrontierCSConfig(datasets.BuilderConfig):
|
| 15 |
-
def __init__(self, **kwargs):
|
| 16 |
-
super().__init__(**kwargs)
|
| 17 |
-
|
| 18 |
-
class FrontierCS(datasets.GeneratorBasedBuilder):
|
| 19 |
-
VERSION = datasets.Version("1.0.0")
|
| 20 |
-
|
| 21 |
-
BUILDER_CONFIGS = [
|
| 22 |
-
FrontierCSConfig(name="algorithmic", description="118 algorithmic problems"),
|
| 23 |
-
FrontierCSConfig(name="research", description="63 research problems"),
|
| 24 |
-
FrontierCSConfig(name="all", description="All problems"),
|
| 25 |
-
]
|
| 26 |
-
|
| 27 |
-
DEFAULT_CONFIG_NAME = "all"
|
| 28 |
-
|
| 29 |
-
def _info(self):
|
| 30 |
-
return datasets.DatasetInfo(
|
| 31 |
-
description=_DESCRIPTION,
|
| 32 |
-
features=datasets.Features({
|
| 33 |
-
"problem_id": datasets.Value("string"),
|
| 34 |
-
"category": datasets.Value("string"),
|
| 35 |
-
"statement": datasets.Value("string"),
|
| 36 |
-
"config": datasets.Value("string"),
|
| 37 |
-
}),
|
| 38 |
-
homepage=_HOMEPAGE,
|
| 39 |
-
license=_LICENSE,
|
| 40 |
-
)
|
| 41 |
-
|
| 42 |
-
def _split_generators(self, dl_manager):
|
| 43 |
-
return [
|
| 44 |
-
datasets.SplitGenerator(
|
| 45 |
-
name=datasets.Split.TEST,
|
| 46 |
-
gen_kwargs={"config_name": self.config.name},
|
| 47 |
-
),
|
| 48 |
-
]
|
| 49 |
-
|
| 50 |
-
def _generate_examples(self, config_name):
|
| 51 |
-
base_path = os.path.dirname(os.path.abspath(__file__))
|
| 52 |
-
idx = 0
|
| 53 |
-
|
| 54 |
-
# Algorithmic problems
|
| 55 |
-
if config_name in ["algorithmic", "all"]:
|
| 56 |
-
algo_path = os.path.join(base_path, "algorithmic", "problems")
|
| 57 |
-
if os.path.exists(algo_path):
|
| 58 |
-
for problem_id in sorted(os.listdir(algo_path)):
|
| 59 |
-
problem_dir = os.path.join(algo_path, problem_id)
|
| 60 |
-
if not os.path.isdir(problem_dir):
|
| 61 |
-
continue
|
| 62 |
-
|
| 63 |
-
statement = ""
|
| 64 |
-
config = ""
|
| 65 |
-
|
| 66 |
-
statement_file = os.path.join(problem_dir, "statement.txt")
|
| 67 |
-
if os.path.exists(statement_file):
|
| 68 |
-
with open(statement_file, "r", encoding="utf-8") as f:
|
| 69 |
-
statement = f.read()
|
| 70 |
-
|
| 71 |
-
config_file = os.path.join(problem_dir, "config.yaml")
|
| 72 |
-
if os.path.exists(config_file):
|
| 73 |
-
with open(config_file, "r", encoding="utf-8") as f:
|
| 74 |
-
config = f.read()
|
| 75 |
-
|
| 76 |
-
yield idx, {
|
| 77 |
-
"problem_id": problem_id,
|
| 78 |
-
"category": "algorithmic",
|
| 79 |
-
"statement": statement,
|
| 80 |
-
"config": config,
|
| 81 |
-
}
|
| 82 |
-
idx += 1
|
| 83 |
-
|
| 84 |
-
# Research problems
|
| 85 |
-
if config_name in ["research", "all"]:
|
| 86 |
-
research_path = os.path.join(base_path, "research", "problems")
|
| 87 |
-
if os.path.exists(research_path):
|
| 88 |
-
for category in sorted(os.listdir(research_path)):
|
| 89 |
-
category_dir = os.path.join(research_path, category)
|
| 90 |
-
if not os.path.isdir(category_dir):
|
| 91 |
-
continue
|
| 92 |
-
|
| 93 |
-
# Check if this is a problem dir or a parent dir
|
| 94 |
-
readme_file = os.path.join(category_dir, "readme")
|
| 95 |
-
config_file = os.path.join(category_dir, "config.yaml")
|
| 96 |
-
|
| 97 |
-
if os.path.exists(readme_file) or os.path.exists(config_file):
|
| 98 |
-
# This is a problem directory
|
| 99 |
-
statement = ""
|
| 100 |
-
config = ""
|
| 101 |
-
|
| 102 |
-
if os.path.exists(readme_file):
|
| 103 |
-
with open(readme_file, "r", encoding="utf-8") as f:
|
| 104 |
-
statement = f.read()
|
| 105 |
-
|
| 106 |
-
if os.path.exists(config_file):
|
| 107 |
-
with open(config_file, "r", encoding="utf-8") as f:
|
| 108 |
-
config = f.read()
|
| 109 |
-
|
| 110 |
-
yield idx, {
|
| 111 |
-
"problem_id": category,
|
| 112 |
-
"category": "research",
|
| 113 |
-
"statement": statement,
|
| 114 |
-
"config": config,
|
| 115 |
-
}
|
| 116 |
-
idx += 1
|
| 117 |
-
else:
|
| 118 |
-
# Check subdirectories
|
| 119 |
-
for subproblem in sorted(os.listdir(category_dir)):
|
| 120 |
-
subproblem_dir = os.path.join(category_dir, subproblem)
|
| 121 |
-
if not os.path.isdir(subproblem_dir):
|
| 122 |
-
continue
|
| 123 |
-
|
| 124 |
-
readme_file = os.path.join(subproblem_dir, "readme")
|
| 125 |
-
config_file = os.path.join(subproblem_dir, "config.yaml")
|
| 126 |
-
|
| 127 |
-
statement = ""
|
| 128 |
-
config = ""
|
| 129 |
-
|
| 130 |
-
if os.path.exists(readme_file):
|
| 131 |
-
with open(readme_file, "r", encoding="utf-8") as f:
|
| 132 |
-
statement = f.read()
|
| 133 |
-
|
| 134 |
-
if os.path.exists(config_file):
|
| 135 |
-
with open(config_file, "r", encoding="utf-8") as f:
|
| 136 |
-
config = f.read()
|
| 137 |
-
|
| 138 |
-
if statement or config:
|
| 139 |
-
yield idx, {
|
| 140 |
-
"problem_id": f"{category}/{subproblem}",
|
| 141 |
-
"category": "research",
|
| 142 |
-
"statement": statement,
|
| 143 |
-
"config": config,
|
| 144 |
-
}
|
| 145 |
-
idx += 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|