-
Notifications
You must be signed in to change notification settings - Fork 28.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
AttributeError: 'BertTokenizerFast' object has no attribute 'max_len' #8739
Comments
It is actually due to #8604, where we removed several deprecated arguments. The Is it possible for you to switch to one of these newer scripts? If not, the fix is to change |
Thanks for taking a look! I will try out the new script |
The new runner is working for us on TPUs. Thanks again for the tip! |
Hello, Everything was a few days. I am getting the same error " data_args.block_size = min(data_args.block_size, tokenizer.max_len) I can't switch to a new script as you mentioned. Kindly help me with this error. I do not know how to fix it. Here is my chunk of codes.
|
The fix is mentioned above:
|
If you cannot switch scripts, I recommend pinning the library. You're having this error because you're using a legacy script with a You could pin it to v3.5.1. |
Thanks, I appreciate your response. However, I am still a basic learner. Can you please explain it a bit? how to pin it to v3.5.1.. Is it mean to use the old version of huggingface.? |
If you wish to stick to that deprecated example, yes! You can do so by checking out the tag v3.5.1:
If you have installed transformers from pypi (and not from source), you should also update your transformers version:
Please note that the script won't be in "/content/transformers/examples/contrib/legacy/run_language_modeling.py" anymore, but in "/content/transformers/examples/language-modeling/run_language_modeling.py" |
This is to fix deprecated reference to `tokenizer.max_len` with `tokenizer.model_max_length` - similar to [issue 8739](#8739) and [PR 8604](#8604). Example [here](https://colab.research.google.com/gist/poedator/f8776349e5c625ce287fc6fcd312fa1e/tokenizer-max_len-error-in-transformers_glue.ipynb). The error happens when `glue_convert_examples_to_features` is called without `max_length` parameter specified. In that case line 119 with wrong reference gets called. This simple fix should do it.
Hello, I am facing the same issue with |
Thank you! |
Change |
in which all model files should this be fixed ? |
Fix deprecated argument that was removed (see huggingface/transformers#8739).
Environment info
transformers
version: 4.0.0-rc-1Who can help
albert, bert, GPT2, XLM: @LysandreJik
Information
Model I am using (Bert, XLNet ...): bert and roberta
The problem arises when using:
The tasks I am working on is:
To reproduce
Steps to reproduce the behavior:
2 examples of failing commands:
The timing of this issue lines up with #8586
Tests started failing on the evening of Nov 17, a few hours after that PR was submitted
The text was updated successfully, but these errors were encountered: