Downloads and returns the task dataset. Override this method to download the dataset from a custom API. :param data_dir: str Stores the path to a local folder containing the `Task`'s data files. Use this to specify the path to manually downloaded data (usuall
(self, data_dir=None, cache_dir=None, download_mode=None)
| 512 | self._fewshot_docs = None |
| 513 | |
| 514 | def download(self, data_dir=None, cache_dir=None, download_mode=None): |
| 515 | """Downloads and returns the task dataset. |
| 516 | Override this method to download the dataset from a custom API. |
| 517 | |
| 518 | :param data_dir: str |
| 519 | Stores the path to a local folder containing the `Task`'s data files. |
| 520 | Use this to specify the path to manually downloaded data (usually when |
| 521 | the dataset is not publicly accessible). |
| 522 | :param cache_dir: str |
| 523 | The directory to read/write the `Task` dataset. This follows the |
| 524 | HuggingFace `datasets` API with the default cache directory located at: |
| 525 | `~/.cache/huggingface/datasets` |
| 526 | NOTE: You can change the cache location globally for a given process |
| 527 | by setting the shell environment variable, `HF_DATASETS_CACHE`, |
| 528 | to another directory: |
| 529 | `export HF_DATASETS_CACHE="/path/to/another/directory"` |
| 530 | :param download_mode: datasets.DownloadMode |
| 531 | How to treat pre-existing `Task` downloads and data. |
| 532 | - `datasets.DownloadMode.REUSE_DATASET_IF_EXISTS` |
| 533 | Reuse download and reuse dataset. |
| 534 | - `datasets.DownloadMode.REUSE_CACHE_IF_EXISTS` |
| 535 | Reuse download with fresh dataset. |
| 536 | - `datasets.DownloadMode.FORCE_REDOWNLOAD` |
| 537 | Fresh download and fresh dataset. |
| 538 | """ |
| 539 | self.dataset = datasets.load_dataset( |
| 540 | path=self.DATASET_PATH, |
| 541 | name=self.DATASET_NAME, |
| 542 | data_dir=data_dir, |
| 543 | cache_dir=cache_dir, |
| 544 | download_mode=download_mode, |
| 545 | ) |
| 546 | |
| 547 | def should_decontaminate(self): |
| 548 | """Whether this task supports decontamination against model training set.""" |