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
3d3c7d42
Unverified
Commit
3d3c7d42
authored
May 17, 2023
by
Younes Belkada
Committed by
GitHub
May 17, 2023
Browse files
[`SAM`] fix sam slow test (#23376)
* fix sam slow test * oops * fix error message
parent
22a07699
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
src/transformers/models/sam/processing_sam.py
src/transformers/models/sam/processing_sam.py
+2
-2
tests/models/sam/test_modeling_sam.py
tests/models/sam/test_modeling_sam.py
+2
-2
No files found.
src/transformers/models/sam/processing_sam.py
View file @
3d3c7d42
...
...
@@ -208,7 +208,7 @@ class SamProcessor(ProcessorMixin):
input_points
=
input_points
.
numpy
().
tolist
()
if
not
isinstance
(
input_points
,
list
)
or
not
isinstance
(
input_points
[
0
],
list
):
raise
ValueError
(
"Input points must be a list of list of floating int
eger
s."
)
raise
ValueError
(
"Input points must be a list of list of floating
po
ints."
)
input_points
=
[
np
.
array
(
input_point
)
for
input_point
in
input_points
]
else
:
input_points
=
None
...
...
@@ -232,7 +232,7 @@ class SamProcessor(ProcessorMixin):
or
not
isinstance
(
input_boxes
[
0
],
list
)
or
not
isinstance
(
input_boxes
[
0
][
0
],
list
)
):
raise
ValueError
(
"Input boxes must be a list of list of list of floating int
eger
s."
)
raise
ValueError
(
"Input boxes must be a list of list of list of floating
po
ints."
)
input_boxes
=
[
np
.
array
(
box
).
astype
(
np
.
float32
)
for
box
in
input_boxes
]
else
:
input_boxes
=
None
...
...
tests/models/sam/test_modeling_sam.py
View file @
3d3c7d42
...
...
@@ -481,7 +481,7 @@ class SamModelIntegrationTest(unittest.TestCase):
model
.
eval
()
raw_image
=
prepare_image
()
input_boxes
=
[[
650
,
900
,
1000
,
1250
]]
input_boxes
=
[[
[
650
,
900
,
1000
,
1250
]]
]
input_points
=
[[[
820
,
1080
]]]
inputs
=
processor
(
...
...
@@ -541,7 +541,7 @@ class SamModelIntegrationTest(unittest.TestCase):
model
.
eval
()
raw_image
=
prepare_image
()
input_boxes
=
[[
620
,
900
,
1000
,
1255
]]
input_boxes
=
[[
[
620
,
900
,
1000
,
1255
]]
]
input_points
=
[[[
820
,
1080
]]]
labels
=
[[
0
]]
...
...
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