From d037f226f12e21b34a010add7a28dbe107ef00b5 Mon Sep 17 00:00:00 2001 From: Kevin Tse Date: Wed, 5 Jan 2022 16:51:10 -0500 Subject: [PATCH] Switching to use FileOpener from FileLoader --- torchtext/experimental/datasets/sst2.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/torchtext/experimental/datasets/sst2.py b/torchtext/experimental/datasets/sst2.py index a858a841e7..ad1038172c 100644 --- a/torchtext/experimental/datasets/sst2.py +++ b/torchtext/experimental/datasets/sst2.py @@ -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 @@ -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]