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
ce08043f
"...git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "15b498f3b89a071736466ac0bf6ac92932353fdf"
Unverified
Commit
ce08043f
authored
Feb 03, 2021
by
sandip
Committed by
GitHub
Feb 03, 2021
Browse files
Integration test for mobilebert (#9978)
parent
1486205d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
tests/test_modeling_tf_mobilebert.py
tests/test_modeling_tf_mobilebert.py
+23
-0
No files found.
tests/test_modeling_tf_mobilebert.py
View file @
ce08043f
...
...
@@ -319,3 +319,26 @@ class TFMobileBertModelTest(TFModelTesterMixin, unittest.TestCase):
for
model_name
in
[
"google/mobilebert-uncased"
]:
model
=
TFMobileBertModel
.
from_pretrained
(
model_name
)
self
.
assertIsNotNone
(
model
)
@
require_tf
class
TFMobileBertModelIntegrationTest
(
unittest
.
TestCase
):
@
slow
def
test_inference_masked_lm
(
self
):
model
=
TFMobileBertForPreTraining
.
from_pretrained
(
"google/mobilebert-uncased"
)
input_ids
=
tf
.
constant
([[
0
,
1
,
2
,
3
,
4
,
5
]])
output
=
model
(
input_ids
)[
0
]
expected_shape
=
[
1
,
6
,
30522
]
self
.
assertEqual
(
output
.
shape
,
expected_shape
)
expected_slice
=
tf
.
constant
(
[
[
[
-
4.5919547
,
-
9.248295
,
-
9.645256
],
[
-
6.7306175
,
-
6.440284
,
-
6.6052837
],
[
-
7.2743506
,
-
6.7847915
,
-
6.024673
],
]
]
)
tf
.
debugging
.
assert_near
(
output
[:,
:
3
,
:
3
],
expected_slice
,
atol
=
1e-4
)
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