From 6dfe62aa6d4d8a9a15b668be492214fb49f06f28 Mon Sep 17 00:00:00 2001 From: Nicolas Hug Date: Fri, 20 May 2022 13:23:57 +0100 Subject: [PATCH 1/3] Indicate download parameter is deprecated and will be removed --- torchvision/datasets/celeba.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/torchvision/datasets/celeba.py b/torchvision/datasets/celeba.py index 4cfbeca2890..610b073d2bd 100644 --- a/torchvision/datasets/celeba.py +++ b/torchvision/datasets/celeba.py @@ -35,11 +35,12 @@ class CelebA(VisionDataset): and returns a transformed version. E.g, ``transforms.PILToTensor`` target_transform (callable, optional): A function/transform that takes in the target and transforms it. - download (bool, optional): Unsupported. + download (bool, optional): Deprecated. .. warning:: - Downloading CelebA is not supported anymore as of 0.13. See + Downloading CelebA is not supported anymore as of 0.13 and this + parameter will be removed in 0.15. See `this issue `__ for more details. Please download the files from @@ -154,7 +155,8 @@ def download(self) -> None: return raise ValueError( - "Downloading CelebA is not supported anymore as of 0.13. See " + "Downloading CelebA is not supported anymore as of 0.13, and the " + "download parameter will be removed in 0.15. See " "https://github.com/pytorch/vision/issues/5705 for more details. " "Please download the files from " "https://mmlab.ie.cuhk.edu.hk/projects/CelebA.html and extract them " From fa11eabc988137df308f717f377d65e416d8fc16 Mon Sep 17 00:00:00 2001 From: Nicolas Hug Date: Fri, 20 May 2022 14:03:59 +0100 Subject: [PATCH 2/3] change default to None and raise warning if user isnt using default --- torchvision/datasets/celeba.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/torchvision/datasets/celeba.py b/torchvision/datasets/celeba.py index 610b073d2bd..0a8486cc407 100644 --- a/torchvision/datasets/celeba.py +++ b/torchvision/datasets/celeba.py @@ -2,6 +2,7 @@ import os from collections import namedtuple from typing import Any, Callable, List, Optional, Union, Tuple +import warnings import PIL import torch @@ -72,7 +73,7 @@ def __init__( target_type: Union[List[str], str] = "attr", transform: Optional[Callable] = None, target_transform: Optional[Callable] = None, - download: bool = False, + download: bool = None, ) -> None: super().__init__(root, transform=transform, target_transform=target_transform) self.split = split @@ -84,6 +85,15 @@ def __init__( if not self.target_type and self.target_transform is not None: raise RuntimeError("target_transform is specified but target_type is empty") + if download is not None: + warnings.warn( + "Downloading CelebA is not supported anymore as of 0.13, and the " + "download parameter will be removed in 0.15. See " + "https://github.com/pytorch/vision/issues/5705 for more details. " + "Please download the files from " + "https://mmlab.ie.cuhk.edu.hk/projects/CelebA.html and extract them " + "in ``root/celeba``." + ) if download: self.download() From dac7f4693dc7a9d1746926cd60722c7f56e7f50e Mon Sep 17 00:00:00 2001 From: Nicolas Hug Date: Fri, 20 May 2022 14:13:55 +0100 Subject: [PATCH 3/3] aonfajoajgfnjaognojag --- torchvision/datasets/celeba.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torchvision/datasets/celeba.py b/torchvision/datasets/celeba.py index 0a8486cc407..b3c5f9e9a6a 100644 --- a/torchvision/datasets/celeba.py +++ b/torchvision/datasets/celeba.py @@ -1,8 +1,8 @@ import csv import os +import warnings from collections import namedtuple from typing import Any, Callable, List, Optional, Union, Tuple -import warnings import PIL import torch