Skip to content

Commit 6b708e1

Browse files
YosuaMichaelfacebook-github-bot
authored andcommitted
[fbsync] Indicate Celeba download parameter is deprecated and will be removed (#6059)
Summary: * Indicate download parameter is deprecated and will be removed * change default to None and raise warning if user isnt using default * aonfajoajgfnjaognojag Reviewed By: NicolasHug Differential Revision: D36760925 fbshipit-source-id: 2bb90f85a296830fe825ad29efc4c94858d0ed47
1 parent e261ab6 commit 6b708e1

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

torchvision/datasets/celeba.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import csv
22
import os
3+
import warnings
34
from collections import namedtuple
45
from typing import Any, Callable, List, Optional, Union, Tuple
56

@@ -35,11 +36,12 @@ class CelebA(VisionDataset):
3536
and returns a transformed version. E.g, ``transforms.PILToTensor``
3637
target_transform (callable, optional): A function/transform that takes in the
3738
target and transforms it.
38-
download (bool, optional): Unsupported.
39+
download (bool, optional): Deprecated.
3940
4041
.. warning::
4142
42-
Downloading CelebA is not supported anymore as of 0.13. See
43+
Downloading CelebA is not supported anymore as of 0.13 and this
44+
parameter will be removed in 0.15. See
4345
`this issue <https://github.com/pytorch/vision/issues/5705>`__
4446
for more details.
4547
Please download the files from
@@ -71,7 +73,7 @@ def __init__(
7173
target_type: Union[List[str], str] = "attr",
7274
transform: Optional[Callable] = None,
7375
target_transform: Optional[Callable] = None,
74-
download: bool = False,
76+
download: bool = None,
7577
) -> None:
7678
super().__init__(root, transform=transform, target_transform=target_transform)
7779
self.split = split
@@ -83,6 +85,15 @@ def __init__(
8385
if not self.target_type and self.target_transform is not None:
8486
raise RuntimeError("target_transform is specified but target_type is empty")
8587

88+
if download is not None:
89+
warnings.warn(
90+
"Downloading CelebA is not supported anymore as of 0.13, and the "
91+
"download parameter will be removed in 0.15. See "
92+
"https://github.com/pytorch/vision/issues/5705 for more details. "
93+
"Please download the files from "
94+
"https://mmlab.ie.cuhk.edu.hk/projects/CelebA.html and extract them "
95+
"in ``root/celeba``."
96+
)
8697
if download:
8798
self.download()
8899

@@ -154,7 +165,8 @@ def download(self) -> None:
154165
return
155166

156167
raise ValueError(
157-
"Downloading CelebA is not supported anymore as of 0.13. See "
168+
"Downloading CelebA is not supported anymore as of 0.13, and the "
169+
"download parameter will be removed in 0.15. See "
158170
"https://github.com/pytorch/vision/issues/5705 for more details. "
159171
"Please download the files from "
160172
"https://mmlab.ie.cuhk.edu.hk/projects/CelebA.html and extract them "

0 commit comments

Comments
 (0)