Unverified Commit ed672864 authored by Younes Belkada's avatar Younes Belkada Committed by GitHub
Browse files

[`Blip`] Fix slow tests and doctests with correct values (#22632)

fix slow tests and doctests
parent 6a02e980
......@@ -1055,7 +1055,7 @@ class BlipForConditionalGeneration(BlipPreTrainedModel):
>>> outputs = model.generate(**inputs)
>>> print(processor.decode(outputs[0], skip_special_tokens=True))
two cats are laying on a couch
two cats sleeping on a couch
```
"""
......
......@@ -1120,7 +1120,7 @@ class BlipModelIntegrationTest(unittest.TestCase):
# Test output
self.assertEqual(
predictions[0].tolist(),
[30522, 1037, 3861, 1997, 1037, 2450, 3564, 2006, 1996, 3509, 2007, 2014, 3899, 102],
[30522, 1037, 3861, 1997, 1037, 2450, 1998, 2014, 3899, 2006, 1996, 3509, 102],
)
@require_torch_gpu
......@@ -1148,7 +1148,7 @@ class BlipModelIntegrationTest(unittest.TestCase):
# Test output
self.assertEqual(
predictions[0].tolist(),
[30522, 1037, 3861, 1997, 1037, 2450, 3564, 2006, 1996, 3509, 2007, 2014, 3899, 102],
[30522, 1037, 3861, 1997, 1037, 2450, 1998, 2014, 3899, 2006, 1996, 3509, 102],
)
def test_inference_vqa(self):
......@@ -1176,7 +1176,7 @@ class BlipModelIntegrationTest(unittest.TestCase):
out_itm = model(**inputs)
out = model(**inputs, use_itm_head=False)
expected_scores = torch.Tensor([[0.9798, 0.0202]])
expected_scores = torch.Tensor([[0.0029, 0.9971]])
self.assertTrue(torch.allclose(torch.nn.Softmax()(out_itm[0].cpu()), expected_scores, rtol=1e-3, atol=1e-3))
self.assertTrue(torch.allclose(out[0].cpu(), torch.Tensor([[0.5053]]), rtol=1e-3, atol=1e-3))
self.assertTrue(torch.allclose(out[0].cpu(), torch.Tensor([[0.5162]]), rtol=1e-3, atol=1e-3))
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