Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
zhusg
transformers-new
Commits
2f06f2bc
Unverified
Commit
2f06f2bc
authored
4 years ago
by
sandip
Committed by
GitHub
4 years ago
Browse files
Options
Download
Patches
Plain Diff
Alber model integration testing added (#9980)
parent
75fd00fb
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_modeling_albert.py
+16
-0
tests/test_modeling_albert.py
with
16 additions
and
0 deletions
+16
-0
tests/test_modeling_albert.py
+
16
−
0
View file @
2f06f2bc
...
...
@@ -285,3 +285,19 @@ class AlbertModelTest(ModelTesterMixin, unittest.TestCase):
for
model_name
in
ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST
[:
1
]:
model
=
AlbertModel
.
from_pretrained
(
model_name
)
self
.
assertIsNotNone
(
model
)
@require_torch
class
AlbertModelIntegrationTest
(
unittest
.
TestCase
):
@slow
def
test_inference_no_head_absolute_embedding
(
self
):
model
=
AlbertForPreTraining
.
from_pretrained
(
"albert-base-v2"
)
input_ids
=
torch
.
tensor
([[
0
,
345
,
232
,
328
,
740
,
140
,
1695
,
69
,
6078
,
1588
,
2
]])
output
=
model
(
input_ids
)[
0
]
expected_shape
=
torch
.
Size
((
1
,
11
,
30000
))
self
.
assertEqual
(
output
.
shape
,
expected_shape
)
expected_slice
=
torch
.
tensor
(
[[[
4.6061
,
0.7321
,
-
1.7725
],
[
4.6061
,
0.7323
,
-
1.7727
],
[
4.6061
,
0.7323
,
-
1.7727
]]]
)
self
.
assertTrue
(
torch
.
allclose
(
output
[:,
:
3
,
:
3
],
expected_slice
,
atol
=
1e-4
))
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets