Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecating DataPipes #909

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 3 additions & 15 deletions torchdata/datapipes/iter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,25 +115,16 @@
from torchdata.datapipes.iter.util.samplemultiplexer import SampleMultiplexerDataPipe as SampleMultiplexer
from torchdata.datapipes.iter.util.saver import SaverIterDataPipe as Saver
from torchdata.datapipes.iter.util.shardexpander import ShardExpanderIterDataPipe as ShardExpander
from torchdata.datapipes.iter.util.tararchiveloader import (
TarArchiveLoaderIterDataPipe as TarArchiveLoader,
TarArchiveReaderIterDataPipe as TarArchiveReader,
)
from torchdata.datapipes.iter.util.tararchiveloader import TarArchiveLoaderIterDataPipe as TarArchiveLoader
from torchdata.datapipes.iter.util.tfrecordloader import (
TFRecordExample,
TFRecordExampleSpec,
TFRecordLoaderIterDataPipe as TFRecordLoader,
)
from torchdata.datapipes.iter.util.webdataset import WebDatasetIterDataPipe as WebDataset
from torchdata.datapipes.iter.util.xzfileloader import (
XzFileLoaderIterDataPipe as XzFileLoader,
XzFileReaderIterDataPipe as XzFileReader,
)
from torchdata.datapipes.iter.util.xzfileloader import XzFileLoaderIterDataPipe as XzFileLoader
from torchdata.datapipes.iter.util.zip_longest import ZipperLongestIterDataPipe as ZipperLongest
from torchdata.datapipes.iter.util.ziparchiveloader import (
ZipArchiveLoaderIterDataPipe as ZipArchiveLoader,
ZipArchiveReaderIterDataPipe as ZipArchiveReader,
)
from torchdata.datapipes.iter.util.ziparchiveloader import ZipArchiveLoaderIterDataPipe as ZipArchiveLoader
from torchdata.datapipes.map.util.converter import MapToIterConverterIterDataPipe as MapToIterConverter

__all__ = [
Expand Down Expand Up @@ -212,14 +203,11 @@
"StreamReader",
"TFRecordLoader",
"TarArchiveLoader",
"TarArchiveReader",
"UnBatcher",
"UnZipper",
"WebDataset",
"XzFileLoader",
"XzFileReader",
"ZipArchiveLoader",
"ZipArchiveReader",
"Zipper",
"ZipperLongest",
]
Expand Down
20 changes: 0 additions & 20 deletions torchdata/datapipes/iter/util/tararchiveloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
from io import BufferedIOBase
from typing import cast, IO, Iterable, Iterator, Optional, Tuple

from torch.utils.data.datapipes.utils.common import _deprecation_warning

from torchdata.datapipes import functional_datapipe
from torchdata.datapipes.iter import IterDataPipe

Expand Down Expand Up @@ -87,21 +85,3 @@ def __len__(self) -> int:
if self.length == -1:
raise TypeError(f"{type(self).__name__} instance doesn't have valid length")
return self.length


@functional_datapipe("read_from_tar")
class TarArchiveReaderIterDataPipe(IterDataPipe[Tuple[str, BufferedIOBase]]):
r"""
Please use ``TarArchiveLoader`` or ``.load_from_tar`` instead.
"""

def __new__(cls, datapipe: Iterable[Tuple[str, BufferedIOBase]], mode: str = "r:*", length: int = -1):
_deprecation_warning(
cls.__name__,
deprecation_version="0.4",
removal_version="0.6",
old_functional_name="read_from_tar",
new_class_name="TarArchiveLoader",
new_functional_name="load_from_tar",
)
return TarArchiveLoaderIterDataPipe(datapipe, mode, length)
20 changes: 0 additions & 20 deletions torchdata/datapipes/iter/util/xzfileloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
from io import BufferedIOBase
from typing import Iterable, Iterator, Tuple

from torch.utils.data.datapipes.utils.common import _deprecation_warning

from torchdata.datapipes import functional_datapipe
from torchdata.datapipes.iter import IterDataPipe

Expand Down Expand Up @@ -68,21 +66,3 @@ def __len__(self) -> int:
if self.length == -1:
raise TypeError(f"{type(self).__name__} instance doesn't have valid length")
return self.length


@functional_datapipe("read_from_xz")
class XzFileReaderIterDataPipe(IterDataPipe[Tuple[str, BufferedIOBase]]):
r"""
Please use ``XzFileLoader`` or ``.load_from_xz`` instead.
"""

def __new__(cls, datapipe: Iterable[Tuple[str, BufferedIOBase]], length: int = -1):
_deprecation_warning(
cls.__name__,
deprecation_version="0.4",
removal_version="0.6",
old_functional_name="read_from_xz",
new_class_name="XzFileLoader",
new_functional_name="load_from_xz",
)
return XzFileLoaderIterDataPipe(datapipe, length)
20 changes: 0 additions & 20 deletions torchdata/datapipes/iter/util/ziparchiveloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
from io import BufferedIOBase
from typing import cast, IO, Iterable, Iterator, Tuple

from torch.utils.data.datapipes.utils.common import _deprecation_warning

from torchdata.datapipes import functional_datapipe
from torchdata.datapipes.iter import IterDataPipe

Expand Down Expand Up @@ -80,21 +78,3 @@ def __len__(self) -> int:
if self.length == -1:
raise TypeError(f"{type(self).__name__} instance doesn't have valid length")
return self.length


@functional_datapipe("read_from_zip")
class ZipArchiveReaderIterDataPipe(IterDataPipe[Tuple[str, BufferedIOBase]]):
r"""
Please use ``ZipArchiveLoader`` or ``.load_from_zip`` instead.
"""

def __new__(cls, datapipe: Iterable[Tuple[str, BufferedIOBase]], length: int = -1):
_deprecation_warning(
cls.__name__,
deprecation_version="0.4",
removal_version="0.6",
old_functional_name="read_from_zip",
new_class_name="ZipArchiveLoader",
new_functional_name="load_from_zip",
)
return ZipArchiveLoaderIterDataPipe(datapipe, length)