File size: 739 Bytes
c887522
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import functools

from datasets import load_dataset

class F1Data:
    def __init__(self, cp_ds_name: str, sub_ds_name: str, res_ds_name: str):
        self.cp_dataset_name = cp_ds_name
        self.submissions_dataset_name = sub_ds_name
        self.results_dataset_name = res_ds_name
        self.initialize()
    
    @functools.cached_property
    def code_problem_formulas(self) -> set[str]:
        return set(self.code_problems.keys())

    def initialize(self):
        cp_ds = load_dataset(self.cp_dataset_name, split="hard")
        self.code_problems: dict[str, str] = {r["formula_name"]: r["code_problem"]["problem_description"] for r in cp_ds}

    def add_submission(self, submitter: str, submission_path: str):
        pass