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
458b0cd2
Unverified
Commit
458b0cd2
authored
Aug 05, 2024
by
Sai-Suraj-27
Committed by
GitHub
Aug 05, 2024
Browse files
fix: Updated `test_embeded_special_tokens` for luke and mluke models (#32413)
Fixed tokenizertests for luke, mluke models.
parent
baf7e5c9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
6 deletions
+2
-6
tests/models/luke/test_tokenization_luke.py
tests/models/luke/test_tokenization_luke.py
+1
-3
tests/models/mluke/test_tokenization_mluke.py
tests/models/mluke/test_tokenization_mluke.py
+1
-3
No files found.
tests/models/luke/test_tokenization_luke.py
View file @
458b0cd2
...
@@ -146,11 +146,9 @@ class LukeTokenizerTest(TokenizerTesterMixin, unittest.TestCase):
...
@@ -146,11 +146,9 @@ class LukeTokenizerTest(TokenizerTesterMixin, unittest.TestCase):
# token_type_ids should put 0 everywhere
# token_type_ids should put 0 everywhere
self
.
assertEqual
(
sum
(
tokens_r
[
"token_type_ids"
]),
sum
(
tokens_p
[
"token_type_ids"
]))
self
.
assertEqual
(
sum
(
tokens_r
[
"token_type_ids"
]),
sum
(
tokens_p
[
"token_type_ids"
]))
# token_type_ids should put 0 everywhere
self
.
assertEqual
(
sum
(
tokens_r
[
"token_type_ids"
]),
sum
(
tokens_p
[
"token_type_ids"
]))
# attention_mask should put 1 everywhere, so sum over length should be 1
# attention_mask should put 1 everywhere, so sum over length should be 1
self
.
assertEqual
(
self
.
assertEqual
(
sum
(
tokens_r
[
"attention_mask"
])
/
len
(
tokens_r
[
"attention_mask"
]),
sum
(
tokens_p
[
"attention_mask"
])
/
len
(
tokens_p
[
"attention_mask"
]),
sum
(
tokens_p
[
"attention_mask"
])
/
len
(
tokens_p
[
"attention_mask"
]),
)
)
...
...
tests/models/mluke/test_tokenization_mluke.py
View file @
458b0cd2
...
@@ -109,11 +109,9 @@ class MLukeTokenizerTest(TokenizerTesterMixin, unittest.TestCase):
...
@@ -109,11 +109,9 @@ class MLukeTokenizerTest(TokenizerTesterMixin, unittest.TestCase):
# token_type_ids should put 0 everywhere
# token_type_ids should put 0 everywhere
self
.
assertEqual
(
sum
(
tokens_r
[
"token_type_ids"
]),
sum
(
tokens_p
[
"token_type_ids"
]))
self
.
assertEqual
(
sum
(
tokens_r
[
"token_type_ids"
]),
sum
(
tokens_p
[
"token_type_ids"
]))
# token_type_ids should put 0 everywhere
self
.
assertEqual
(
sum
(
tokens_r
[
"token_type_ids"
]),
sum
(
tokens_p
[
"token_type_ids"
]))
# attention_mask should put 1 everywhere, so sum over length should be 1
# attention_mask should put 1 everywhere, so sum over length should be 1
self
.
assertEqual
(
self
.
assertEqual
(
sum
(
tokens_r
[
"attention_mask"
])
/
len
(
tokens_r
[
"attention_mask"
]),
sum
(
tokens_p
[
"attention_mask"
])
/
len
(
tokens_p
[
"attention_mask"
]),
sum
(
tokens_p
[
"attention_mask"
])
/
len
(
tokens_p
[
"attention_mask"
]),
)
)
...
...
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