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
d2a7c86d
Unverified
Commit
d2a7c86d
authored
Jun 22, 2020
by
Malte
Committed by
GitHub
Jun 22, 2020
Browse files
Check if `text` is set to avoid IndexError (#4209)
Fix for
https://github.com/huggingface/transformers/issues/3809
parent
90f4b245
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/transformers/tokenization_roberta.py
src/transformers/tokenization_roberta.py
+1
-1
No files found.
src/transformers/tokenization_roberta.py
View file @
d2a7c86d
...
@@ -236,7 +236,7 @@ class RobertaTokenizer(GPT2Tokenizer):
...
@@ -236,7 +236,7 @@ class RobertaTokenizer(GPT2Tokenizer):
add_prefix_space
=
kwargs
[
"add_prefix_space"
]
add_prefix_space
=
kwargs
[
"add_prefix_space"
]
else
:
else
:
add_prefix_space
=
add_special_tokens
add_prefix_space
=
add_special_tokens
if
add_prefix_space
and
not
text
[
0
].
isspace
():
if
add_prefix_space
and
len
(
text
)
>
0
and
not
text
[
0
].
isspace
():
text
=
" "
+
text
text
=
" "
+
text
return
text
return
text
...
...
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