-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Error iterating over Dataset with DataLoader #1765
Comments
Instead of: dataloader = torch.utils.data.DataLoader(encoded_dataset, batch_sampler=32) It should be: dataloader = torch.utils.data.DataLoader(encoded_dataset, batch_size=32)
|
@mariosasko I thought that would fix it, but now I'm getting a different error:
Any thoughts what this means?I Do I need padding? |
Yes, padding is an answer. This can be solved easily by passing a callable to the collate_fn arg of DataLoader that adds padding. |
Padding was the fix, thanks! |
dataloader = torch.utils.data.DataLoader(encoded_dataset, batch_size=4) getting I had put padding as 2048 for encoded_dataset |
data_loader_val = torch.utils.data.DataLoader(val_dataset, batch_size=32, shuffle=True, drop_last=False, num_workers=0) getting -> TypeError: 'list' object is not callable Cannot iterate through the data. Kindly suggest. |
I have a Dataset that I've mapped a tokenizer over:
When I try to iterate as in the docs, I get errors:
The text was updated successfully, but these errors were encountered: