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
Unable to use custom dataset: AttributeError: 'list' object has no attribute 'keys' #11455
Comments
This is really weird. Could you print a few items of your Dataset? The error means that they are not dictionaries containing Also note that since you already have applied padding in your preprocessing, you can use the |
Yeah, I did try commenting the line about the data_collator as well, but I got the same error.
For instance,
Input texts are emails in italian. (the issue appears also with transformers 4.5.1) |
I am unable to reproduce your bug. Are you sure your data frames don't contain a list of text in one of the line instead of just texts? |
I found the mistake! I was doing something slightly different from what I wrote, namely
The difference is in line 3 and 4, and consequently last two lines. The mistake is the comma at the end of line 3. My bad I did not run the example code I published in the question exactly as it was. I am so sorry, and so upset to have spent a week for a stupid comma. |
Oh that's a nasty little bug indeed! Glad you found the problem! |
What am I doing wrong?
I encode data with
Then I create my datasets with
So I have
Then I initiate my Trainer with
and finally I train
Here is the error I get
What I am doing wrong?
I also tried using
getting the same error.
Using:
torch == 1.7.1
transformers == 4.4.2
Thank you!
@sgugger
The text was updated successfully, but these errors were encountered: