Skip to content

Commit 5f2a3d7

Browse files
authored
fix deprecated ref to tokenizer.max_len (huggingface#10220)
This is to fix deprecated reference to `tokenizer.max_len` with `tokenizer.model_max_length` - similar to [issue 8739](huggingface#8739) and [PR 8604](huggingface#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.
1 parent cdcdd5f commit 5f2a3d7

File tree

1 file changed

+1
-1
lines changed
  • src/transformers/data/processors

1 file changed

+1
-1
lines changed

src/transformers/data/processors/glue.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def _glue_convert_examples_to_features(
116116
output_mode=None,
117117
):
118118
if max_length is None:
119-
max_length = tokenizer.max_len
119+
max_length = tokenizer.model_max_length
120120

121121
if task is not None:
122122
processor = glue_processors[task]()

0 commit comments

Comments
 (0)