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
b693cbf9
Unverified
Commit
b693cbf9
authored
Mar 03, 2022
by
Nicolas Patry
Committed by
GitHub
Mar 03, 2022
Browse files
The tests were not updated after the addition of `torch.diag` (#15890)
in the scoring (which is more correct)
parent
3c4fbc61
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
13 deletions
+12
-13
tests/pipelines/test_pipelines_zero_shot_image_classification.py
...ipelines/test_pipelines_zero_shot_image_classification.py
+12
-13
No files found.
tests/pipelines/test_pipelines_zero_shot_image_classification.py
View file @
b693cbf9
...
...
@@ -186,9 +186,9 @@ class ZeroShotImageClassificationPipelineTests(unittest.TestCase, metaclass=Pipe
self
.
assertEqual
(
nested_simplify
(
output
),
[
{
"score"
:
0.
94
1
,
"label"
:
"
cat
"
},
{
"score"
:
0.
05
5
,
"label"
:
"
remote
"
},
{
"score"
:
0.00
3
,
"label"
:
"plane"
},
{
"score"
:
0.
51
1
,
"label"
:
"
remote
"
},
{
"score"
:
0.
48
5
,
"label"
:
"
cat
"
},
{
"score"
:
0.00
4
,
"label"
:
"plane"
},
],
)
...
...
@@ -197,9 +197,9 @@ class ZeroShotImageClassificationPipelineTests(unittest.TestCase, metaclass=Pipe
nested_simplify
(
output
),
[
[
{
"score"
:
0.
94
1
,
"label"
:
"
cat
"
},
{
"score"
:
0.
05
5
,
"label"
:
"
remote
"
},
{
"score"
:
0.00
3
,
"label"
:
"plane"
},
{
"score"
:
0.
51
1
,
"label"
:
"
remote
"
},
{
"score"
:
0.
48
5
,
"label"
:
"
cat
"
},
{
"score"
:
0.00
4
,
"label"
:
"plane"
},
],
]
*
5
,
...
...
@@ -214,13 +214,12 @@ class ZeroShotImageClassificationPipelineTests(unittest.TestCase, metaclass=Pipe
# This is an image of 2 cats with remotes and no planes
image
=
Image
.
open
(
"./tests/fixtures/tests_samples/COCO/000000039769.png"
)
output
=
image_classifier
(
image
,
candidate_labels
=
[
"cat"
,
"plane"
,
"remote"
])
self
.
assertEqual
(
nested_simplify
(
output
),
[
{
"score"
:
0.
94
1
,
"label"
:
"
cat
"
},
{
"score"
:
0.
05
5
,
"label"
:
"
remote
"
},
{
"score"
:
0.00
3
,
"label"
:
"plane"
},
{
"score"
:
0.
51
1
,
"label"
:
"
remote
"
},
{
"score"
:
0.
48
5
,
"label"
:
"
cat
"
},
{
"score"
:
0.00
4
,
"label"
:
"plane"
},
],
)
...
...
@@ -229,9 +228,9 @@ class ZeroShotImageClassificationPipelineTests(unittest.TestCase, metaclass=Pipe
nested_simplify
(
output
),
[
[
{
"score"
:
0.
94
1
,
"label"
:
"
cat
"
},
{
"score"
:
0.
05
5
,
"label"
:
"
remote
"
},
{
"score"
:
0.00
3
,
"label"
:
"plane"
},
{
"score"
:
0.
51
1
,
"label"
:
"
remote
"
},
{
"score"
:
0.
48
5
,
"label"
:
"
cat
"
},
{
"score"
:
0.00
4
,
"label"
:
"plane"
},
],
]
*
5
,
...
...
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