"git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "2b23e0801a42dd1bb0c1095178003461d5ace6e2"
Unverified Commit b693cbf9 authored by Nicolas Patry's avatar Nicolas Patry Committed by GitHub
Browse files

The tests were not updated after the addition of `torch.diag` (#15890)

in the scoring (which is more correct)
parent 3c4fbc61
......@@ -186,9 +186,9 @@ class ZeroShotImageClassificationPipelineTests(unittest.TestCase, metaclass=Pipe
self.assertEqual(
nested_simplify(output),
[
{"score": 0.941, "label": "cat"},
{"score": 0.055, "label": "remote"},
{"score": 0.003, "label": "plane"},
{"score": 0.511, "label": "remote"},
{"score": 0.485, "label": "cat"},
{"score": 0.004, "label": "plane"},
],
)
......@@ -197,9 +197,9 @@ class ZeroShotImageClassificationPipelineTests(unittest.TestCase, metaclass=Pipe
nested_simplify(output),
[
[
{"score": 0.941, "label": "cat"},
{"score": 0.055, "label": "remote"},
{"score": 0.003, "label": "plane"},
{"score": 0.511, "label": "remote"},
{"score": 0.485, "label": "cat"},
{"score": 0.004, "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.941, "label": "cat"},
{"score": 0.055, "label": "remote"},
{"score": 0.003, "label": "plane"},
{"score": 0.511, "label": "remote"},
{"score": 0.485, "label": "cat"},
{"score": 0.004, "label": "plane"},
],
)
......@@ -229,9 +228,9 @@ class ZeroShotImageClassificationPipelineTests(unittest.TestCase, metaclass=Pipe
nested_simplify(output),
[
[
{"score": 0.941, "label": "cat"},
{"score": 0.055, "label": "remote"},
{"score": 0.003, "label": "plane"},
{"score": 0.511, "label": "remote"},
{"score": 0.485, "label": "cat"},
{"score": 0.004, "label": "plane"},
],
]
* 5,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment