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

DataLoader() takes no arguments #13

Open
AkshitaB opened this issue Jul 8, 2020 · 4 comments
Open

DataLoader() takes no arguments #13

AkshitaB opened this issue Jul 8, 2020 · 4 comments

Comments

@AkshitaB
Copy link

AkshitaB commented Jul 8, 2020

I encounter the following error when running the quick_start/evaluate.py demo evaluation on my machine.

Traceback (most recent call last):
  File "quick_start/evaluate.py", line 181, in <module>
    model, dataset_reader = run_training_loop()
  File "quick_start/evaluate.py", line 162, in run_training_loop
    train_loader, dev_loader = build_data_loaders(train_data, dev_data)
  File "quick_start/evaluate.py", line 116, in build_data_loaders
    train_loader = DataLoader(train_data, batch_size=8, shuffle=True)
TypeError: DataLoader() takes no arguments

I believe this is due to generalizing the DataLoader. Possibly PyTorchDataLoader should be used instead. Similar code also exists in quick_start/train.py and quick_start/predict.py.

@matt-gardner
Copy link
Contributor

Yes, you're right, this needs to be updated when we update to 1.1. Maybe we should pin the requirements in this repo to be v1.0?

@idjotherwise
Copy link

I had the same problem when running the scripts locally - downgrading from v1.1 to v1.0 fixed it.

@YYGe01
Copy link

YYGe01 commented Nov 24, 2020

it work:

from allennlp.data import PyTorchDataLoader

train_loader = PyTorchDataLoader(train_data, batch_size=8, shuffle=True)
dev_loader = PyTorchDataLoader(dev_data, batch_size=8, shuffle=False)

@AslanDevbrat
Copy link

AslanDevbrat commented Dec 12, 2020

it work:

from allennlp.data import PyTorchDataLoader

train_loader = PyTorchDataLoader(train_data, batch_size=8, shuffle=True)
dev_loader = PyTorchDataLoader(dev_data, batch_size=8, shuffle=False)

This code really worked for me, Just replace every DataLoader with PyTorchDataloaderLoader, and its done!
Mine AllenNLP version is 1.2.2

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

5 participants