Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
2189a7f5
Unverified
Commit
2189a7f5
authored
Aug 23, 2023
by
Yih-Dar
Committed by
GitHub
Aug 23, 2023
Browse files
Fix `pad_token` check condition (#25685)
fix Co-authored-by:
ydshieh
<
ydshieh@users.noreply.github.com
>
parent
8657ec68
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/transformers/tokenization_utils_base.py
src/transformers/tokenization_utils_base.py
+1
-1
No files found.
src/transformers/tokenization_utils_base.py
View file @
2189a7f5
...
@@ -2503,7 +2503,7 @@ class PreTrainedTokenizerBase(SpecialTokensMixin, PushToHubMixin):
...
@@ -2503,7 +2503,7 @@ class PreTrainedTokenizerBase(SpecialTokensMixin, PushToHubMixin):
max_length
=
self
.
model_max_length
max_length
=
self
.
model_max_length
# Test if we have a padding token
# Test if we have a padding token
if
padding_strategy
!=
PaddingStrategy
.
DO_NOT_PAD
and
(
not
self
.
pad_token
or
self
.
pad_token_id
<
0
):
if
padding_strategy
!=
PaddingStrategy
.
DO_NOT_PAD
and
(
self
.
pad_token
is
None
or
self
.
pad_token_id
<
0
):
raise
ValueError
(
raise
ValueError
(
"Asking to pad but the tokenizer does not have a padding token. "
"Asking to pad but the tokenizer does not have a padding token. "
"Please select a token to use as `pad_token` `(tokenizer.pad_token = tokenizer.eos_token e.g.)` "
"Please select a token to use as `pad_token` `(tokenizer.pad_token = tokenizer.eos_token e.g.)` "
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment