Skip to content
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

Setting 3.14 or ["train"] to split argument of CelebA() gets the indirect error message #8805

Open
hyperkai opened this issue Dec 12, 2024 · 1 comment

Comments

@hyperkai
Copy link

hyperkai commented Dec 12, 2024

🐛 Describe the bug

Setting "hello" instead of "train", "valid", "test" or "all" to split argument of CelebA() gets the direct error message as shown below:

from torchvision.datasets import CelebA

my_data = CelebA(
    root="data",
    split="hallo" # Here
) # Error

ValueError: Unknown value 'hallo' for argument split. Valid values are {'train', 'valid', 'test', 'all'}.

But setting 3.14 or ["train"] to split argument of CelebA() gets the indirect error message as shown below:

from torchvision.datasets import CelebA

my_data = CelebA(
    root="data",
    split=3.14
) # Error

AttributeError: 'float' object has no attribute 'lower'

from torchvision.datasets import CelebA

my_data = CelebA(
    root="data",
    split=["train"] # Here
) # Error

AttributeError: 'list' object has no attribute 'lower'

So, they should return the direct error messages as shown below:

ValueError: Unknown value 3.14 for argument split. Valid values are {'train', 'valid', 'test', 'all'}.

ValueError: Unknown value ["train"] for argument split. Valid values are {'train', 'valid', 'test', 'all'}.

Versions

import torchvision

torchvision.__version__ # '0.20.1'
@NicolasHug
Copy link
Member

Thanks @hyperkai , please feel free to submit a PR for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants