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
39a72125
"docs/vscode:/vscode.git/clone" did not exist on "8fc555ad7b0537d9a85110cd8e6f1c68d49bedfc"
Unverified
Commit
39a72125
authored
Nov 28, 2022
by
Arthur
Committed by
GitHub
Nov 28, 2022
Browse files
fix both failing RoCBert tests (#20469)
parent
30163921
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
tests/models/roc_bert/test_modeling_roc_bert.py
tests/models/roc_bert/test_modeling_roc_bert.py
+1
-1
tests/models/roc_bert/test_tokenization_roc_bert.py
tests/models/roc_bert/test_tokenization_roc_bert.py
+2
-2
No files found.
tests/models/roc_bert/test_modeling_roc_bert.py
View file @
39a72125
...
...
@@ -710,4 +710,4 @@ class RoCBertModelIntegrationTest(unittest.TestCase):
# convert to tokens is: ['[CLS]', '巴', '*', '黎', '是', '法', '国', '的', '首', '都', '[SEP]']
expected_output
=
torch
.
tensor
([[
101
,
2349
,
115
,
7944
,
3221
,
3791
,
1744
,
4638
,
7674
,
6963
,
102
]])
self
.
assert
Equal
(
output_ids
,
expected_output
)
assert
torch
.
allclose
(
output_ids
,
expected_output
)
tests/models/roc_bert/test_tokenization_roc_bert.py
View file @
39a72125
...
...
@@ -299,8 +299,8 @@ class BertTokenizationTest(TokenizerTesterMixin, unittest.TestCase):
encoded_sentence
=
tokenizer
.
build_inputs_with_special_tokens
(
text
)
encoded_pair
=
tokenizer
.
build_inputs_with_special_tokens
(
text
,
text_2
)
assert
encoded_sentence
==
[
1
01
]
+
text
+
[
10
2
]
assert
encoded_pair
==
[
1
01
]
+
text
+
[
10
2
]
+
text_2
+
[
10
2
]
assert
encoded_sentence
==
[
1
]
+
text
+
[
2
]
assert
encoded_pair
==
[
1
]
+
text
+
[
2
]
+
text_2
+
[
2
]
def
test_prepare_for_model
(
self
):
tokenizers
=
self
.
get_tokenizers
(
do_lower_case
=
False
)
...
...
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