Skip to content

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

@hyperkai

Description

@hyperkai

🐛 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'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions