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
dfe012ad
"docs/source/vscode:/vscode.git/clone" did not exist on "496f653bc1129c7f3c225cd8e4c81900135c9001"
Commit
dfe012ad
authored
Jan 07, 2020
by
Lysandre
Committed by
Lysandre Debut
Jan 14, 2020
Browse files
Fix misleading RoBERTa token type ids
parent
c024ab98
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
4 deletions
+2
-4
src/transformers/tokenization_roberta.py
src/transformers/tokenization_roberta.py
+2
-4
No files found.
src/transformers/tokenization_roberta.py
View file @
dfe012ad
...
@@ -144,9 +144,7 @@ class RobertaTokenizer(GPT2Tokenizer):
...
@@ -144,9 +144,7 @@ class RobertaTokenizer(GPT2Tokenizer):
def
create_token_type_ids_from_sequences
(
self
,
token_ids_0
,
token_ids_1
=
None
):
def
create_token_type_ids_from_sequences
(
self
,
token_ids_0
,
token_ids_1
=
None
):
"""
"""
Creates a mask from the two sequences passed to be used in a sequence-pair classification task.
Creates a mask from the two sequences passed to be used in a sequence-pair classification task.
A RoBERTa sequence pair mask has the following format:
RoBERTa does not make use of token type ids, therefore a list of zeros is returned.
0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1
| first sequence | second sequence
if token_ids_1 is None, only returns the first portion of the mask (0's).
if token_ids_1 is None, only returns the first portion of the mask (0's).
"""
"""
...
@@ -155,4 +153,4 @@ class RobertaTokenizer(GPT2Tokenizer):
...
@@ -155,4 +153,4 @@ class RobertaTokenizer(GPT2Tokenizer):
if
token_ids_1
is
None
:
if
token_ids_1
is
None
:
return
len
(
cls
+
token_ids_0
+
sep
)
*
[
0
]
return
len
(
cls
+
token_ids_0
+
sep
)
*
[
0
]
return
len
(
cls
+
token_ids_0
+
sep
+
sep
)
*
[
0
]
+
len
(
token_ids_1
+
sep
)
*
[
1
]
return
len
(
cls
+
token_ids_0
+
sep
+
sep
+
token_ids_1
+
sep
)
*
[
0
]
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