:param data_dir: str Use this to specify the path to manually downloaded JSON test data. This also needs to include the split key and text key for the data in the following format: ``` split:text:/absolute/path/to/data.json
(self, data_dir=None, cache_dir=None, download_mode=None)
| 10 | DATASET_NAME = "json" |
| 11 | |
| 12 | def __init__(self, data_dir=None, cache_dir=None, download_mode=None): |
| 13 | """ |
| 14 | :param data_dir: str |
| 15 | Use this to specify the path to manually downloaded JSON test data. |
| 16 | This also needs to include the split key and text key for the data |
| 17 | in the following format: |
| 18 | ``` |
| 19 | split:text:/absolute/path/to/data.json |
| 20 | ``` |
| 21 | |
| 22 | If you do not have splits inside the JSON file, it should be "train". |
| 23 | Colons in the split or text key can be escaped by backslashes. |
| 24 | :param cache_dir: str |
| 25 | The directory to read/write the `Task` dataset. This follows the |
| 26 | HuggingFace `datasets` API with the default cache directory located at: |
| 27 | `~/.cache/huggingface/datasets` |
| 28 | NOTE: You can change the cache location globally for a given process |
| 29 | by setting the shell environment variable, `HF_DATASETS_CACHE`, |
| 30 | to another directory: |
| 31 | `export HF_DATASETS_CACHE="/path/to/another/directory"` |
| 32 | :param download_mode: datasets.DownloadMode |
| 33 | How to treat pre-existing `Task` downloads and data. |
| 34 | - `datasets.DownloadMode.REUSE_DATASET_IF_EXISTS` |
| 35 | Reuse download and reuse dataset. |
| 36 | - `datasets.DownloadMode.REUSE_CACHE_IF_EXISTS` |
| 37 | Reuse download with fresh dataset. |
| 38 | - `datasets.DownloadMode.FORCE_REDOWNLOAD` |
| 39 | Fresh download and fresh dataset. |
| 40 | """ |
| 41 | self._split, self._key, data_file = escaped_split(data_dir, ":", 2) |
| 42 | self.load(data_file) |
| 43 | self._training_docs = None |
| 44 | self._fewshot_docs = None |
| 45 | |
| 46 | def download(self, data_dir=None, cache_dir=None, download_mode=None): |
| 47 | raise TypeError("cannot download an arbitrary JSON dataset") |
nothing calls this directly
no test coverage detected