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
34307bb3
"...git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "5b5e4ca36607a7783d3e6e7514e9dd5d8d83f16c"
Unverified
Commit
34307bb3
authored
Nov 06, 2021
by
NielsRogge
Committed by
GitHub
Nov 06, 2021
Browse files
Fix tests (#14289)
parent
24b30d4d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
tests/test_modeling_beit.py
tests/test_modeling_beit.py
+6
-2
tests/test_modeling_segformer.py
tests/test_modeling_segformer.py
+3
-1
No files found.
tests/test_modeling_beit.py
View file @
34307bb3
...
...
@@ -232,7 +232,9 @@ class BeitModelTest(ModelTesterMixin, unittest.TestCase):
# this can then be incorporated into _prepare_for_class in test_modeling_common.py
elif
model_class
.
__name__
==
"BeitForSemanticSegmentation"
:
batch_size
,
num_channels
,
height
,
width
=
inputs_dict
[
"pixel_values"
].
shape
inputs_dict
[
"labels"
]
=
torch
.
zeros
([
self
.
model_tester
.
batch_size
,
height
,
width
]).
long
()
inputs_dict
[
"labels"
]
=
torch
.
zeros
(
[
self
.
model_tester
.
batch_size
,
height
,
width
],
device
=
torch_device
).
long
()
model
=
model_class
(
config
)
model
.
to
(
torch_device
)
model
.
train
()
...
...
@@ -259,7 +261,9 @@ class BeitModelTest(ModelTesterMixin, unittest.TestCase):
# this can then be incorporated into _prepare_for_class in test_modeling_common.py
elif
model_class
.
__name__
==
"BeitForSemanticSegmentation"
:
batch_size
,
num_channels
,
height
,
width
=
inputs_dict
[
"pixel_values"
].
shape
inputs_dict
[
"labels"
]
=
torch
.
zeros
([
self
.
model_tester
.
batch_size
,
height
,
width
]).
long
()
inputs_dict
[
"labels"
]
=
torch
.
zeros
(
[
self
.
model_tester
.
batch_size
,
height
,
width
],
device
=
torch_device
).
long
()
model
=
model_class
(
config
)
model
.
to
(
torch_device
)
model
.
train
()
...
...
tests/test_modeling_segformer.py
View file @
34307bb3
...
...
@@ -318,7 +318,9 @@ class SegformerModelTest(ModelTesterMixin, unittest.TestCase):
# this can then be incorporated into _prepare_for_class in test_modeling_common.py
if
model_class
.
__name__
==
"SegformerForSemanticSegmentation"
:
batch_size
,
num_channels
,
height
,
width
=
inputs_dict
[
"pixel_values"
].
shape
inputs_dict
[
"labels"
]
=
torch
.
zeros
([
self
.
model_tester
.
batch_size
,
height
,
width
]).
long
()
inputs_dict
[
"labels"
]
=
torch
.
zeros
(
[
self
.
model_tester
.
batch_size
,
height
,
width
],
device
=
torch_device
).
long
()
model
=
model_class
(
config
)
model
.
to
(
torch_device
)
model
.
train
()
...
...
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