Download dataset_genericify_cpp.py from red1bluelost/dataset_genericify_cpp: direct link, hf CLI and curl.
- Browser
- Download file 2.37 kB
-
https://huggingface.co/datasets/red1bluelost/dataset_genericify_cpp/resolve/d34f830b04eb81d01df30833cf7170d88ff6e6ea/dataset_genericify_cpp.py
- Command line
-
hf download hf://datasets/red1bluelost/dataset_genericify_cpp@d34f830b04eb81d01df30833cf7170d88ff6e6ea/dataset_genericify_cpp.py
-
curl -L -o dataset_genericify_cpp.py https://huggingface.co/datasets/red1bluelost/dataset_genericify_cpp/resolve/d34f830b04eb81d01df30833cf7170d88ff6e6ea/dataset_genericify_cpp.py
2.37 kB
| """Genericify C++ Dataset for CS7470""" | |
| import json | |
| import datasets | |
| # You can copy an official description | |
| _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"], | |
| } | |