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
ac99217e
Unverified
Commit
ac99217e
authored
Jun 10, 2020
by
Sylvain Gugger
Committed by
GitHub
Jun 10, 2020
Browse files
Fix the CI (#4903)
* Fix CI
parent
0a375f5a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
tests/test_modeling_common.py
tests/test_modeling_common.py
+3
-1
No files found.
tests/test_modeling_common.py
View file @
ac99217e
...
@@ -67,6 +67,8 @@ class ModelTesterMixin:
...
@@ -67,6 +67,8 @@ class ModelTesterMixin:
if
model_class
in
MODEL_FOR_MULTIPLE_CHOICE_MAPPING
.
values
():
if
model_class
in
MODEL_FOR_MULTIPLE_CHOICE_MAPPING
.
values
():
return
{
return
{
k
:
v
.
unsqueeze
(
1
).
expand
(
-
1
,
self
.
model_tester
.
num_choices
,
-
1
).
contiguous
()
k
:
v
.
unsqueeze
(
1
).
expand
(
-
1
,
self
.
model_tester
.
num_choices
,
-
1
).
contiguous
()
if
isinstance
(
v
,
torch
.
Tensor
)
and
v
.
ndim
!=
0
else
v
for
k
,
v
in
inputs_dict
.
items
()
for
k
,
v
in
inputs_dict
.
items
()
}
}
return
inputs_dict
return
inputs_dict
...
@@ -157,7 +159,7 @@ class ModelTesterMixin:
...
@@ -157,7 +159,7 @@ class ModelTesterMixin:
model
.
to
(
torch_device
)
model
.
to
(
torch_device
)
model
.
eval
()
model
.
eval
()
with
torch
.
no_grad
():
with
torch
.
no_grad
():
outputs
=
model
(
**
inputs_dict
)
outputs
=
model
(
**
self
.
_prepare_for_class
(
inputs_dict
,
model_class
)
)
attentions
=
outputs
[
-
1
]
attentions
=
outputs
[
-
1
]
self
.
assertEqual
(
model
.
config
.
output_hidden_states
,
False
)
self
.
assertEqual
(
model
.
config
.
output_hidden_states
,
False
)
self
.
assertEqual
(
len
(
attentions
),
self
.
model_tester
.
num_hidden_layers
)
self
.
assertEqual
(
len
(
attentions
),
self
.
model_tester
.
num_hidden_layers
)
...
...
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