Download data.py from tasksource/data: direct link, hf CLI and curl.
- Browser
- Download file 867 Bytes
-
https://huggingface.co/datasets/tasksource/data/resolve/5fd160e8fb173d055cd960d0ba5c3a22df24dcfc/data.py
- Command line
-
hf download hf://datasets/tasksource/data@5fd160e8fb173d055cd960d0ba5c3a22df24dcfc/data.py
-
curl -L -o data.py https://huggingface.co/datasets/tasksource/data/resolve/5fd160e8fb173d055cd960d0ba5c3a22df24dcfc/data.py
867 Bytes
| import datasets | |
| import tasksource | |
| class Dataset(datasets.GeneratorBasedBuilder): | |
| builder_configs = {} | |
| def __init__(self,*args,**kwargs): | |
| self.BUILDER_CONFIG_CLASS.__post_init__=lambda x:x | |
| return super().__init__(*args,**kwargs) | |
| def _info(self): | |
| return datasets.DatasetInfo() | |
| def _split_generators(self, _): | |
| return [datasets.SplitGenerator(name=name, gen_kwargs={"split_name": name}) for name in ['train','validation','test']] | |
| def _generate_examples(self, split_name): | |
| i=0 | |
| for x in tasksource.load_task(self.config.name)[split_name]: | |
| i+=1 | |
| yield i,x | |
| def _download_and_prepare(self, dl_manager, verification_mode, **prepare_splits_kwargs): | |
| result = super()._download_and_prepare(dl_manager, "no_checks", **prepare_splits_kwargs) | |
| return result |