Skip to content

ReadError: file could not be opened successfully #3

@annabechang

Description

@annabechang

Hi,
I tried to load the ImageNetV2Dataset on both linux and colab, both returned the same error:

! pip install git+https://github.com/modestyachts/ImageNetV2_pytorch

from imagenetv2_pytorch import ImageNetV2Dataset
from torch.utils.data import DataLoader

Collecting git+https://github.com/modestyachts/ImageNetV2_pytorch
Cloning https://github.com/modestyachts/ImageNetV2_pytorch to /tmp/pip-req-build-mjyllfja
Running command git clone --filter=blob:none --quiet https://github.com/modestyachts/ImageNetV2_pytorch /tmp/pip-req-build-mjyllfja
Resolved https://github.com/modestyachts/ImageNetV2_pytorch to commit 9017469
Preparing metadata (setup.py) ... done

images = ImageNetV2Dataset(transform=preprocess)

Extracting....
---------------------------------------------------------------------------
ReadError                                 Traceback (most recent call last)
Cell In[19], line 1
----> 1 images = ImageNetV2Dataset(transform=preprocess)

File ~/.conda/envs/py38/lib/python3.8/site-packages/imagenetv2_pytorch/ImageNetV2_dataset.py:82, in ImageNetV2Dataset.__init__(self, variant, transform, location)
     80         assert False, f"Downloading from {URLS[variant]} failed"
     81 print("Extracting....")
---> 82 tarfile.open(self.tar_root).extractall(f"{location}")
     83 shutil.move(f"{location}/{FNAMES[variant]}", self.dataset_root)
     84 self.fnames = list(self.dataset_root.glob("**/*.jpeg"))

File ~/.conda/envs/py38/lib/python3.8/tarfile.py:1608, in TarFile.open(cls, name, mode, fileobj, bufsize, **kwargs)
   1606                 fileobj.seek(saved_pos)
   1607             continue
-> 1608     raise ReadError("file could not be opened successfully")
   1610 elif ":" in mode:
   1611     filemode, comptype = mode.split(":", 1)

ReadError: file could not be opened successfully

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions