TorchStudio / torchstudio

IDE for PyTorch and its ecosystem
https://torchstudio.ai
MIT License
378 stars 27 forks source link

Error on dataset load if local Python environment is used #39

Open kolabit opened 2 years ago

kolabit commented 2 years ago

I am getting error on MNIST loading, if local Python environment is used (3.8, in ~/anaconda3 folder): "NameError: name 'NoneType' is not defined" During the installation, this environment was validated by TorchStudio installer. It works OK, if I use Python from ~/TorchStudio/python

Below is the console output: 16:42:47.613 INFO starting TorchStudio 0.9.9 on "Ubuntu 20.04.4 LTS" 16:42:48.222 INFO python check: "Checking Python version...\n\nChecking required packages...\n\nLoading PyTorch...\n\nListing devices...\n\n" "Functional (Linux-5.15.0-46-generic-x86_64-with-glibc2.10, Python 3.8, PyTorch 1.12, Devices: CPU (cpu), NVIDIA GeForce RTX 2060 (cuda:0))\n" 16:42:48.877 INFO checking notifications... 16:42:48.881 INFO inference: "Loading PyTorch...\n\n" "" 16:42:49.392 INFO inference: "Training script connected\n\n" "" 16:42:49.392 INFO inference: "Setting device...\n\n" "" 16:42:49.651 INFO dataset modules scan error: "Error parsing module: File , line 950, in _sanity_check\n\nValueError: Empty module name \n\n" 16:42:49.720 INFO modeltab modules scan error: "Error parsing module: File , line 950, in _sanity_check\n\nValueError: Empty module name \n\n" 16:42:52.649 INFO datasetload: "Loading PyTorch...\n\n" "" 16:42:53.214 INFO datasetload: "Dataset script connected\n\n" "" 16:42:53.215 INFO datasetload: "Loading dataset...\n\n" "" 16:42:53.215 INFO datasetload: "dataset definition, line 27, in MNIST\n\nNameError: name 'NoneType' is not defined\n" ""

divideconcept commented 2 years ago

Could you provide a screenshot of TorchStudio (the entire UI) when the error happens?

kolabit commented 2 years ago

Screenshot from 2022-08-20 11-05-52

divideconcept commented 2 years ago

Thanks. Can you check "Code" at the top, and copy/paste here the source code that will be displayed ? In particular line 27 of the source code.

kolabit commented 2 years ago

In "non-working" version : def __init__(self, root: str, train: bool = True, transform: typing.Union[typing.Callable, NoneType] = None, target_transform: typing.Union[typing.Callable, NoneType] = None, download: bool = False):

in "working" def __init__(self, root: str, train: bool = True, transform: typing.Optional[typing.Callable] = None, target_transform: typing.Optional[typing.Callable] = None, download: bool = False):

So, if I remove NoneType from the both places in "non-working" version, it works OK