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
1486205d
Unverified
Commit
1486205d
authored
Feb 03, 2021
by
sandip
Committed by
GitHub
Feb 03, 2021
Browse files
TF DistilBERT integration tests (#9975)
* TF DistilBERT integration test * Update test_modeling_tf_distilbert.py
parent
f2d5c04e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
tests/test_modeling_tf_distilbert.py
tests/test_modeling_tf_distilbert.py
+23
-0
No files found.
tests/test_modeling_tf_distilbert.py
View file @
1486205d
...
@@ -221,3 +221,26 @@ class TFDistilBertModelTest(TFModelTesterMixin, unittest.TestCase):
...
@@ -221,3 +221,26 @@ class TFDistilBertModelTest(TFModelTesterMixin, unittest.TestCase):
for
model_name
in
list
(
TF_DISTILBERT_PRETRAINED_MODEL_ARCHIVE_LIST
[:
1
]):
for
model_name
in
list
(
TF_DISTILBERT_PRETRAINED_MODEL_ARCHIVE_LIST
[:
1
]):
model
=
TFDistilBertModel
.
from_pretrained
(
model_name
)
model
=
TFDistilBertModel
.
from_pretrained
(
model_name
)
self
.
assertIsNotNone
(
model
)
self
.
assertIsNotNone
(
model
)
@
require_tf
class
TFDistilBertModelIntegrationTest
(
unittest
.
TestCase
):
@
slow
def
test_inference_masked_lm
(
self
):
model
=
TFDistilBertModel
.
from_pretrained
(
"distilbert-base-uncased"
)
input_ids
=
tf
.
constant
([[
0
,
1
,
2
,
3
,
4
,
5
]])
output
=
model
(
input_ids
)[
0
]
expected_shape
=
[
1
,
6
,
768
]
self
.
assertEqual
(
output
.
shape
,
expected_shape
)
expected_slice
=
tf
.
constant
(
[
[
[
0.19261885
,
-
0.13732955
,
0.4119799
],
[
0.22150156
,
-
0.07422661
,
0.39037204
],
[
0.22756018
,
-
0.0896414
,
0.3701467
],
]
]
)
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