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
b28b5371
Unverified
Commit
b28b5371
authored
Jun 23, 2020
by
Thomas Wolf
Committed by
GitHub
Jun 23, 2020
Browse files
More clear error message in the use-case of #5169 (#5184)
parent
11fdde02
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
src/transformers/tokenization_utils.py
src/transformers/tokenization_utils.py
+8
-3
No files found.
src/transformers/tokenization_utils.py
View file @
b28b5371
...
@@ -427,9 +427,14 @@ class PreTrainedTokenizer(PreTrainedTokenizerBase):
...
@@ -427,9 +427,14 @@ class PreTrainedTokenizer(PreTrainedTokenizerBase):
elif
isinstance
(
text
,
(
list
,
tuple
))
and
len
(
text
)
>
0
and
isinstance
(
text
[
0
],
int
):
elif
isinstance
(
text
,
(
list
,
tuple
))
and
len
(
text
)
>
0
and
isinstance
(
text
[
0
],
int
):
return
text
return
text
else
:
else
:
raise
ValueError
(
if
is_pretokenized
:
f
"Input
{
text
}
is not valid. Should be a string, a list/tuple of strings or a list/tuple of integers."
raise
ValueError
(
)
f
"Input
{
text
}
is not valid. Should be a string or a list/tuple of strings when `is_pretokenized=True`."
)
else
:
raise
ValueError
(
f
"Input
{
text
}
is not valid. Should be a string, a list/tuple of strings or a list/tuple of integers."
)
if
return_offsets_mapping
:
if
return_offsets_mapping
:
raise
NotImplementedError
(
raise
NotImplementedError
(
...
...
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