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
637e8175
Unverified
Commit
637e8175
authored
Jan 25, 2022
by
NielsRogge
Committed by
GitHub
Jan 25, 2022
Browse files
[Tests] Fix test (#15324)
* Fix Swin device * Remove print statement
parent
e6954707
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
5 deletions
+5
-5
src/transformers/models/swin/modeling_swin.py
src/transformers/models/swin/modeling_swin.py
+3
-0
tests/test_modeling_vilt.py
tests/test_modeling_vilt.py
+2
-2
tests/test_modeling_vit_mae.py
tests/test_modeling_vit_mae.py
+0
-3
No files found.
src/transformers/models/swin/modeling_swin.py
View file @
637e8175
...
@@ -437,6 +437,9 @@ class SwinBlock(nn.Module):
...
@@ -437,6 +437,9 @@ class SwinBlock(nn.Module):
hidden_states_windows
=
window_partition
(
shifted_hidden_states
,
self
.
window_size
)
hidden_states_windows
=
window_partition
(
shifted_hidden_states
,
self
.
window_size
)
hidden_states_windows
=
hidden_states_windows
.
view
(
-
1
,
self
.
window_size
*
self
.
window_size
,
channels
)
hidden_states_windows
=
hidden_states_windows
.
view
(
-
1
,
self
.
window_size
*
self
.
window_size
,
channels
)
if
self
.
attn_mask
is
not
None
:
self
.
attn_mask
=
self
.
attn_mask
.
to
(
hidden_states_windows
.
device
)
self_attention_outputs
=
self
.
attention
(
self_attention_outputs
=
self
.
attention
(
hidden_states_windows
,
hidden_states_windows
,
self
.
attn_mask
,
self
.
attn_mask
,
...
...
tests/test_modeling_vilt.py
View file @
637e8175
...
@@ -595,8 +595,8 @@ class ViltModelIntegrationTest(unittest.TestCase):
...
@@ -595,8 +595,8 @@ class ViltModelIntegrationTest(unittest.TestCase):
# forward pass
# forward pass
outputs
=
model
(
outputs
=
model
(
input_ids
=
encoding_1
.
input_ids
,
input_ids
=
encoding_1
.
input_ids
.
to
(
torch_device
)
,
pixel_values
=
pixel_values
,
pixel_values
=
pixel_values
.
to
(
torch_device
)
,
)
)
# verify the logits
# verify the logits
...
...
tests/test_modeling_vit_mae.py
View file @
637e8175
...
@@ -327,9 +327,6 @@ class ViTMAEModelTest(ModelTesterMixin, unittest.TestCase):
...
@@ -327,9 +327,6 @@ class ViTMAEModelTest(ModelTesterMixin, unittest.TestCase):
config
,
inputs_dict
=
self
.
model_tester
.
prepare_config_and_inputs_for_common
()
config
,
inputs_dict
=
self
.
model_tester
.
prepare_config_and_inputs_for_common
()
for
model_class
in
self
.
all_model_classes
:
for
model_class
in
self
.
all_model_classes
:
print
(
"Model class:"
,
model_class
)
model
=
model_class
(
config
)
model
=
model_class
(
config
)
model
.
to
(
torch_device
)
model
.
to
(
torch_device
)
model
.
eval
()
model
.
eval
()
...
...
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