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
3cc23eee
Unverified
Commit
3cc23eee
authored
Jul 09, 2020
by
Lysandre Debut
Committed by
GitHub
Jul 09, 2020
Browse files
More explicit error when failing to tensorize overflowing tokens (#5633)
parent
b9d8af07
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
src/transformers/tokenization_utils_base.py
src/transformers/tokenization_utils_base.py
+5
-0
No files found.
src/transformers/tokenization_utils_base.py
View file @
3cc23eee
...
...
@@ -511,6 +511,11 @@ class BatchEncoding(UserDict):
self
[
key
]
=
tensor
except
:
# noqa E722
if
key
==
"overflowing_tokens"
:
raise
ValueError
(
"Unable to create tensor returning overflowing tokens of different lengths. "
"Please see if a fast version of this tokenizer is available to have this feature available."
)
raise
ValueError
(
"Unable to create tensor, you should probably activate truncation and/or padding "
"with 'padding=True' 'truncation=True' to have batched tensors with the same length."
...
...
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