1
1
import csv
2
2
import os
3
+ import warnings
3
4
from collections import namedtuple
4
5
from typing import Any , Callable , List , Optional , Union , Tuple
5
6
@@ -35,11 +36,12 @@ class CelebA(VisionDataset):
35
36
and returns a transformed version. E.g, ``transforms.PILToTensor``
36
37
target_transform (callable, optional): A function/transform that takes in the
37
38
target and transforms it.
38
- download (bool, optional): Unsupported .
39
+ download (bool, optional): Deprecated .
39
40
40
41
.. warning::
41
42
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
43
45
`this issue <https://github.com/pytorch/vision/issues/5705>`__
44
46
for more details.
45
47
Please download the files from
@@ -71,7 +73,7 @@ def __init__(
71
73
target_type : Union [List [str ], str ] = "attr" ,
72
74
transform : Optional [Callable ] = None ,
73
75
target_transform : Optional [Callable ] = None ,
74
- download : bool = False ,
76
+ download : bool = None ,
75
77
) -> None :
76
78
super ().__init__ (root , transform = transform , target_transform = target_transform )
77
79
self .split = split
@@ -83,6 +85,15 @@ def __init__(
83
85
if not self .target_type and self .target_transform is not None :
84
86
raise RuntimeError ("target_transform is specified but target_type is empty" )
85
87
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
+ )
86
97
if download :
87
98
self .download ()
88
99
@@ -154,7 +165,8 @@ def download(self) -> None:
154
165
return
155
166
156
167
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 "
158
170
"https://github.com/pytorch/vision/issues/5705 for more details. "
159
171
"Please download the files from "
160
172
"https://mmlab.ie.cuhk.edu.hk/projects/CelebA.html and extract them "
0 commit comments