| """Genericify C++ Dataset for CS7470""" |
|
|
|
|
| import json |
|
|
| import datasets |
|
|
|
|
| |
| _DESCRIPTION = """\ |
| Genericify C++ Dataset |
| """ |
|
|
|
|
| class DatasetGenericifyCpp(datasets.GeneratorBasedBuilder): |
| """Genericify C++ Dataset for CS7470""" |
|
|
| VERSION = datasets.Version("1.1.0") |
|
|
| def _info(self): |
| return datasets.DatasetInfo( |
| description=_DESCRIPTION, |
| features=datasets.Features( |
| { |
| "task_id": datasets.Value("string"), |
| "base_prompt": datasets.Value("string"), |
| "sfinae_prompt": datasets.Value("string"), |
| "concepts_prompt": datasets.Value("string"), |
| "starter_code": datasets.Value("string"), |
| "base_canonical_solution": datasets.Value("string"), |
| "sfinae_canonical_solution": datasets.Value("string"), |
| "concepts_canonical_solution": datasets.Value("string"), |
| "tests": datasets.Value("string"), |
| "invalids": datasets.Value("string"), |
| } |
| ), |
| ) |
|
|
| def _split_generators(self, dl_manager): |
| downloaded_files = dl_manager.download_and_extract( |
| "data/genericify_cpp.jsonl" |
| ) |
| return [ |
| datasets.SplitGenerator( |
| name=datasets.Split.TEST, |
| gen_kwargs={ |
| "filepath": downloaded_files, |
| }, |
| ), |
| ] |
|
|
| def _generate_examples(self, filepath): |
| with open(filepath, encoding="utf-8") as f: |
| for key, line in enumerate(f): |
| row = json.loads(line) |
| yield key, { |
| "task_id": row["task_id"], |
| "base_prompt": row["base_prompt"], |
| "sfinae_prompt": row["sfinae_prompt"], |
| "concepts_prompt": row["concepts_prompt"], |
| "starter_code": row["starter_code"], |
| "base_canonical_solution": row["base_canonical_solution"], |
| "sfinae_canonical_solution": row["sfinae_canonical_solution"], |
| "concepts_canonical_solution": row["concepts_canonical_solution"], |
| "tests": row["tests"], |
| "invalids": row["invalids"], |
| } |
|
|