|
63 | 63 | _hash_python_lines, |
64 | 64 | ) |
65 | 65 | from .splits import Split |
66 | | -from .tasks import TaskTemplate |
67 | 66 | from .utils.deprecation_utils import deprecated |
68 | 67 | from .utils.file_utils import ( |
69 | 68 | OfflineModeIsEnabled, |
@@ -1586,7 +1585,7 @@ def load_dataset( |
1586 | 1585 | revision: Optional[Union[str, Version]] = None, |
1587 | 1586 | token: Optional[Union[bool, str]] = None, |
1588 | 1587 | use_auth_token="deprecated", |
1589 | | - task: Optional[Union[str, TaskTemplate]] = None, |
| 1588 | + task="deprecated", |
1590 | 1589 | streaming: bool = False, |
1591 | 1590 | num_proc: Optional[int] = None, |
1592 | 1591 | storage_options: Optional[Dict] = None, |
@@ -1708,6 +1707,12 @@ def load_dataset( |
1708 | 1707 | </Deprecated> |
1709 | 1708 | task (`str`): |
1710 | 1709 | The task to prepare the dataset for during training and evaluation. Casts the dataset's [`Features`] to standardized column names and types as detailed in `datasets.tasks`. |
| 1710 | +
|
| 1711 | + <Deprecated version="2.13.0"> |
| 1712 | +
|
| 1713 | + `task` was deprecated in version 2.13.0 and will be removed in 3.0.0. |
| 1714 | +
|
| 1715 | + </Deprecated> |
1711 | 1716 | streaming (`bool`, defaults to `False`): |
1712 | 1717 | If set to `True`, don't download the data files. Instead, it streams the data progressively while |
1713 | 1718 | iterating on the dataset. An [`IterableDataset`] or [`IterableDatasetDict`] is returned instead in this case. |
@@ -1795,6 +1800,13 @@ def load_dataset( |
1795 | 1800 | f"You can remove this warning by passing 'verification_mode={verification_mode.value}' instead.", |
1796 | 1801 | FutureWarning, |
1797 | 1802 | ) |
| 1803 | + if task != "deprecated": |
| 1804 | + warnings.warn( |
| 1805 | + "'task' was deprecated in version 2.13.0 and will be removed in 3.0.0.\n", |
| 1806 | + FutureWarning, |
| 1807 | + ) |
| 1808 | + else: |
| 1809 | + task = None |
1798 | 1810 | if data_files is not None and not data_files: |
1799 | 1811 | raise ValueError(f"Empty 'data_files': '{data_files}'. It should be either non-empty or None (default).") |
1800 | 1812 | if Path(path, config.DATASET_STATE_JSON_FILENAME).exists(): |
@@ -1855,7 +1867,10 @@ def load_dataset( |
1855 | 1867 | ds = builder_instance.as_dataset(split=split, verification_mode=verification_mode, in_memory=keep_in_memory) |
1856 | 1868 | # Rename and cast features to match task schema |
1857 | 1869 | if task is not None: |
1858 | | - ds = ds.prepare_for_task(task) |
| 1870 | + # To avoid issuing the same warning twice |
| 1871 | + with warnings.catch_warnings(): |
| 1872 | + warnings.simplefilter("ignore", FutureWarning) |
| 1873 | + ds = ds.prepare_for_task(task) |
1859 | 1874 | if save_infos: |
1860 | 1875 | builder_instance._save_infos() |
1861 | 1876 |
|
|
0 commit comments