Unverified Commit 49496c4f authored by Nicolas Hug's avatar Nicolas Hug Committed by GitHub
Browse files

Indicate Celeba download parameter is deprecated and will be removed (#6059)

* Indicate download parameter is deprecated and will be removed

* change default to None and raise warning if user isnt using default

* aonfajoajgfnjaognojag
parent 60ce5bf4
import csv import csv
import os import os
import warnings
from collections import namedtuple from collections import namedtuple
from typing import Any, Callable, List, Optional, Union, Tuple from typing import Any, Callable, List, Optional, Union, Tuple
...@@ -35,11 +36,12 @@ class CelebA(VisionDataset): ...@@ -35,11 +36,12 @@ class CelebA(VisionDataset):
and returns a transformed version. E.g, ``transforms.PILToTensor`` and returns a transformed version. E.g, ``transforms.PILToTensor``
target_transform (callable, optional): A function/transform that takes in the target_transform (callable, optional): A function/transform that takes in the
target and transforms it. target and transforms it.
download (bool, optional): Unsupported. download (bool, optional): Deprecated.
.. warning:: .. 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 <https://github.com/pytorch/vision/issues/5705>`__ `this issue <https://github.com/pytorch/vision/issues/5705>`__
for more details. for more details.
Please download the files from Please download the files from
...@@ -71,7 +73,7 @@ class CelebA(VisionDataset): ...@@ -71,7 +73,7 @@ class CelebA(VisionDataset):
target_type: Union[List[str], str] = "attr", target_type: Union[List[str], str] = "attr",
transform: Optional[Callable] = None, transform: Optional[Callable] = None,
target_transform: Optional[Callable] = None, target_transform: Optional[Callable] = None,
download: bool = False, download: bool = None,
) -> None: ) -> None:
super().__init__(root, transform=transform, target_transform=target_transform) super().__init__(root, transform=transform, target_transform=target_transform)
self.split = split self.split = split
...@@ -83,6 +85,15 @@ class CelebA(VisionDataset): ...@@ -83,6 +85,15 @@ class CelebA(VisionDataset):
if not self.target_type and self.target_transform is not None: if not self.target_type and self.target_transform is not None:
raise RuntimeError("target_transform is specified but target_type is empty") 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: if download:
self.download() self.download()
...@@ -154,7 +165,8 @@ class CelebA(VisionDataset): ...@@ -154,7 +165,8 @@ class CelebA(VisionDataset):
return return
raise ValueError( 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. " "https://github.com/pytorch/vision/issues/5705 for more details. "
"Please download the files from " "Please download the files from "
"https://mmlab.ie.cuhk.edu.hk/projects/CelebA.html and extract them " "https://mmlab.ie.cuhk.edu.hk/projects/CelebA.html and extract them "
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment