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

fix deprecated reference tokenizer.max_len in glue.py #10220

Merged
merged 1 commit into from Feb 24, 2021
Merged

fix deprecated reference tokenizer.max_len in glue.py #10220

merged 1 commit into from Feb 24, 2021

Conversation

poedator
Copy link
Contributor

This is to fix deprecated reference to tokenizer.max_len with tokenizer.model_max_length - similar to issue 8739 and PR 8604.
See error example in Colab here. it causes AttributeError: 'BertTokenizer' object has no attribute 'max_len'
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.

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.
Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@LysandreJik LysandreJik merged commit 5f2a3d7 into huggingface:master Feb 24, 2021
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

Successfully merging this pull request may close these issues.

None yet

2 participants