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

load_dataset from local squad.py, raise error: TypeError: 'NoneType' object is not callable #664

Closed
xixiaoyao opened this issue Sep 23, 2020 · 4 comments

Comments

@xixiaoyao
Copy link

xixiaoyao commented Sep 23, 2020

version: 1.0.2

train_dataset  = datasets.load_dataset('squad') 

The above code can works. However, when I download the squad.py from your server, and saved as my_squad.py to local. I run followings raise errors.

train_dataset  = datasets.load_dataset('./my_squad.py')                                                                                                

TypeError Traceback (most recent call last)
in
----> 1 train_dataset = nlp.load_dataset('./my_squad.py')

/opt/conda/lib/python3.7/site-packages/datasets/load.py in load_dataset(path, name, data_dir, data_files, split, cache_dir, features, download_config, download_mode, ignore_verifications, save_infos, script_version, **config_kwargs)
602 hash=hash,
603 features=features,
--> 604 **config_kwargs,
605 )
606

TypeError: 'NoneType' object is not callable

@lhoestq
Copy link
Member

lhoestq commented Sep 23, 2020

Hi !
Thanks for reporting.
It looks like no object inherits from datasets.GeneratorBasedBuilder (or more generally from datasets.DatasetBuilder) in your script.

Could you check that there exist at least one dataset builder class ?

@lhoestq
Copy link
Member

lhoestq commented Oct 5, 2020

Hi @xixiaoyao did you manage to fix your issue ?

@lhoestq
Copy link
Member

lhoestq commented Oct 20, 2020

No activity, closing

@lhoestq lhoestq closed this as completed Oct 20, 2020
@ailian8025
Copy link

It happened when try to change the old project which use 'nlp' to new project which use 'datasets'. You should check you old 'my_squad.py' file, change the inherit class from nlp.xxx to datasets.xxx. Otherwise datasets - load.py - import_main_class() if inspect.isclass(obj) and issubclass(obj, main_cls_type): can not find the main_cls.

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

3 participants