Skip to content

Switching to use FileOpener from FileLoader #1483

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

Closed
wants to merge 2 commits into from
Closed
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
4 changes: 2 additions & 2 deletions torchtext/experimental/datasets/sst2.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
)

if is_module_available("torchdata"):
from torchdata.datapipes.iter import IterableWrapper, FileLoader
from torchdata.datapipes.iter import IterableWrapper, FileOpener

# we import HttpReader from _download_hooks so we can swap out public URLs
# with interal URLs when the dataset is used within Facebook
Expand Down Expand Up @@ -90,7 +90,7 @@ def _get_datapipe(self, root, split, validate_hash):
cache_dp = HttpReader(cache_dp).end_caching(mode="wb", same_filepath_fn=True)

# Load from cached file
cache_dp = FileLoader(cache_dp, mode="rb")
cache_dp = FileOpener(cache_dp, mode="rb")
# extract data from zip
extracted_files = cache_dp.read_from_zip().filter(
lambda x: f"{split}.tsv" in x[0]
Expand Down