Skip to content

Raise error when download=True for LFW dataset #8888 #9040

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

Merged
merged 4 commits into from
May 29, 2025
Merged
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
22 changes: 16 additions & 6 deletions torchvision/datasets/lfw.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ def __init__(
self.data: list[Any] = []

if download:
raise ValueError(
"LFW dataset is no longer available for download."
"Please download the dataset manually and place it in the specified directory"
)
self.download()

if not self._check_integrity():
Expand Down Expand Up @@ -90,6 +94,11 @@ def __len__(self) -> int:
class LFWPeople(_LFW):
"""`LFW <http://vis-www.cs.umass.edu/lfw/>`_ Dataset.

.. warning:

The LFW dataset is no longer available for automatic download. Please
download it manually and place it in the specified directory.

Args:
root (str or ``pathlib.Path``): Root directory of dataset where directory
``lfw-py`` exists or will be saved to if download is set to True.
Expand All @@ -101,9 +110,7 @@ class LFWPeople(_LFW):
and returns a transformed version. E.g, ``transforms.RandomCrop``
target_transform (callable, optional): A function/transform that takes in the
target and transforms it.
download (bool, optional): If true, downloads the dataset from the internet and
puts it in root directory. If dataset is already downloaded, it is not
downloaded again.
download (bool, optional): NOT SUPPORTED ANYMORE, leave to False.
loader (callable, optional): A function to load an image given its path.
By default, it uses PIL as its image loader, but users could also pass in
``torchvision.io.decode_image`` for decoding image data into tensors directly.
Expand Down Expand Up @@ -175,6 +182,11 @@ def extra_repr(self) -> str:
class LFWPairs(_LFW):
"""`LFW <http://vis-www.cs.umass.edu/lfw/>`_ Dataset.

.. warning:

The LFW dataset is no longer available for automatic download. Please
download it manually and place it in the specified directory.

Args:
root (str or ``pathlib.Path``): Root directory of dataset where directory
``lfw-py`` exists or will be saved to if download is set to True.
Expand All @@ -186,9 +198,7 @@ class LFWPairs(_LFW):
and returns a transformed version. E.g, ``transforms.RandomRotation``
target_transform (callable, optional): A function/transform that takes in the
target and transforms it.
download (bool, optional): If true, downloads the dataset from the internet and
puts it in root directory. If dataset is already downloaded, it is not
downloaded again.
download (bool, optional): NOT SUPPORTED ANYMORE, leave to False.
loader (callable, optional): A function to load an image given its path.
By default, it uses PIL as its image loader, but users could also pass in
``torchvision.io.decode_image`` for decoding image data into tensors directly.
Expand Down