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
92a9976e
"git@developer.sourcefind.cn:change/sglang.git" did not exist on "eb4b015f1219e9b27c9ab5766ff24056a2227a68"
Commit
92a9976e
authored
Sep 06, 2019
by
LysandreJik
Browse files
Distilbert sequence builder w/ mask
parent
59057abe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
pytorch_transformers/tokenization_distilbert.py
pytorch_transformers/tokenization_distilbert.py
+13
-0
No files found.
pytorch_transformers/tokenization_distilbert.py
View file @
92a9976e
...
...
@@ -60,3 +60,16 @@ class DistilBertTokenizer(BertTokenizer):
vocab_files_names
=
VOCAB_FILES_NAMES
pretrained_vocab_files_map
=
PRETRAINED_VOCAB_FILES_MAP
max_model_input_sizes
=
PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
def
add_special_tokens_single_sentence
(
self
,
token_ids
):
return
token_ids
def
add_special_tokens_sentences_pair
(
self
,
token_ids_0
,
token_ids_1
,
output_mask
=
False
):
sep
=
[
self
.
sep_token_id
]
if
output_mask
:
return
(
token_ids_0
+
sep
+
token_ids_1
,
[
0
]
*
len
(
token_ids_0
+
sep
)
+
[
1
]
*
len
(
token_ids_1
)
)
else
:
return
token_ids_0
+
sep
+
token_ids_1
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