Remove the deprecated code in `pl.utilities.data` (#16440)

This commit is contained in:
Carlos Mocholí 2023-01-20 01:03:55 +01:00 committed by GitHub
parent 39acb81b9b
commit d3de5c64d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 44 deletions

View File

@ -314,6 +314,7 @@ utilities
:nosignatures:
argparse
data
deepspeed
distributed
finite_checks

View File

@ -77,6 +77,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Removed the deprecated code in `pl.utilities.xla_device` ([#16404](https://github.com/Lightning-AI/lightning/pull/16404))
- Removed the deprecated code in `pl.utilities.data` ([#16440](https://github.com/Lightning-AI/lightning/pull/16440))
- Removed the deprecated code in `pl.utilities.device_parser` ([#16412](https://github.com/Lightning-AI/lightning/pull/16412))
- Removed the deprecated code in `pl.utilities.optimizer` ([#16439](https://github.com/Lightning-AI/lightning/pull/16439))

View File

@ -38,7 +38,7 @@ from pytorch_lightning.trainer.supporters import CombinedLoader
from pytorch_lightning.utilities.auto_restart import CaptureIterableDataset, CaptureMapDataset, FastForwardSampler
from pytorch_lightning.utilities.enums import _FaultTolerantMode
from pytorch_lightning.utilities.exceptions import MisconfigurationException
from pytorch_lightning.utilities.rank_zero import rank_zero_deprecation, rank_zero_warn, WarningCache
from pytorch_lightning.utilities.rank_zero import rank_zero_warn, WarningCache
# might be supported in later releases, see https://github.com/python/mypy/pull/13297
BType = Union[Tensor, str, Mapping[Any, "BType"], Iterable["BType"]] # type: ignore[misc]
@ -421,19 +421,3 @@ def _is_dataloader_shuffled(dataloader: object) -> bool:
if isinstance(sampler, SequentialSampler):
return False
return isinstance(sampler, RandomSampler)
def has_iterable_dataset(*args: Any, **kwargs: Any) -> Any:
rank_zero_deprecation(
"`pytorch_lightning.utilities.data.has_iterable_dataset` has been deprecated in v1.8.0 and will be"
" removed in v2.0.0. Please use `lightning_fabric.utilities.data.has_iterable_dataset` instead."
)
return new_has_iterable_dataset(*args, **kwargs)
def has_len(*args: Any, **kwargs: Any) -> Any:
rank_zero_deprecation(
"`pytorch_lightning.utilities.data.has_len` has been deprecated in v1.8.0 and will be"
" removed in v2.0.0. Please use `lightning_fabric.utilities.data.has_len` instead."
)
return new_has_len(*args, **kwargs)

View File

@ -1,27 +0,0 @@
# Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Test deprecated functionality which will be removed in v2.0.0."""
import pytest
from torch.utils.data import DataLoader
from pytorch_lightning.demos.boring_classes import RandomDataset
from pytorch_lightning.utilities.data import has_iterable_dataset, has_len
def test_v1_10_deprecated_data_utilities():
with pytest.deprecated_call(match="data.has_iterable_dataset` has been deprecated in v1.8.0"):
has_iterable_dataset(DataLoader(RandomDataset(2, 4)))
with pytest.deprecated_call(match="data.has_len` has been deprecated in v1.8.0"):
has_len(DataLoader(RandomDataset(2, 4)))