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
fb393ad9
"docs/vscode:/vscode.git/clone" did not exist on "7291ea0bff57a017e71b1ea8ec01ff19da298bf0"
Commit
fb393ad9
authored
Dec 20, 2019
by
Lysandre
Browse files
Added test for all special tokens
parent
90debb9f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
transformers/tests/tokenization_tests_commons.py
transformers/tests/tokenization_tests_commons.py
+8
-0
No files found.
transformers/tests/tokenization_tests_commons.py
View file @
fb393ad9
...
...
@@ -133,6 +133,14 @@ class CommonTestCases:
self
.
assertNotEqual
(
len
(
toks
),
len
(
toks0
))
# toks0 should be longer
self
.
assertListEqual
(
toks
,
toks2
)
# Check that none of the special tokens are lowercased
sequence_with_special_tokens
=
"A "
+
" yEs "
.
join
(
tokenizer
.
all_special_tokens
)
+
" B"
tokenized_sequence
=
tokenizer
.
tokenize
(
sequence_with_special_tokens
)
for
special_token
in
tokenizer
.
all_special_tokens
:
print
(
special_token
,
special_token
in
tokenized_sequence
)
assert
special_token
in
tokenized_sequence
tokenizer
=
self
.
get_tokenizer
(
do_lower_case
=
False
)
added
=
tokenizer
.
add_tokens
(
new_toks
)
...
...
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