use torch.testing.assertclose instead to get more details about error in cis (#35659)

* use torch.testing.assertclose instead to get more details about error in cis

* fix

* style

* test_all

* revert for I bert

* fixes and updates

* more image processing fixes

* more image processors

* fix mamba and co

* style

* less strick

* ok I won't be strict

* skip and be done

* up
This commit is contained in:
Arthur
2025-01-24 16:55:28 +01:00
committed by GitHub
parent 72d1a4cd53
commit b912f5ee43
255 changed files with 1048 additions and 969 deletions

View File

@@ -231,11 +231,11 @@ class SegGptImageProcessingTest(ImageProcessingTestMixin, unittest.TestCase):
]
)
self.assertTrue(torch.allclose(inputs.pixel_values[0, :, :3, :3], expected_pixel_values, atol=1e-4))
self.assertTrue(
torch.allclose(inputs.prompt_pixel_values[0, :, :3, :3], expected_prompt_pixel_values, atol=1e-4)
torch.testing.assert_close(inputs.pixel_values[0, :, :3, :3], expected_pixel_values, rtol=1e-4, atol=1e-4)
torch.testing.assert_close(
inputs.prompt_pixel_values[0, :, :3, :3], expected_prompt_pixel_values, rtol=1e-4, atol=1e-4
)
self.assertTrue(torch.allclose(inputs.prompt_masks[0, :, :3, :3], expected_prompt_masks, atol=1e-4))
torch.testing.assert_close(inputs.prompt_masks[0, :, :3, :3], expected_prompt_masks, rtol=1e-4, atol=1e-4)
def test_prompt_mask_equivalence(self):
image_processor = self.image_processing_class(**self.image_processor_dict)

View File

@@ -313,7 +313,7 @@ class SegGptModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.TestCase):
loss_value = loss(prompt_masks, pred_masks, label, bool_masked_pos)
expected_loss_value = torch.tensor(0.3340)
self.assertTrue(torch.allclose(loss_value, expected_loss_value, atol=1e-4))
torch.testing.assert_close(loss_value, expected_loss_value, rtol=1e-4, atol=1e-4)
@slow
def test_model_from_pretrained(self):
@@ -386,7 +386,7 @@ class SegGptModelIntegrationTest(unittest.TestCase):
]
).to(torch_device)
self.assertTrue(torch.allclose(outputs.pred_masks[0, :, :3, :3], expected_slice, atol=1e-4))
torch.testing.assert_close(outputs.pred_masks[0, :, :3, :3], expected_slice, rtol=1e-4, atol=1e-4)
result = image_processor.post_process_semantic_segmentation(outputs, [input_image.size[::-1]])[0]
@@ -428,7 +428,7 @@ class SegGptModelIntegrationTest(unittest.TestCase):
).to(torch_device)
self.assertEqual(outputs.pred_masks.shape, expected_shape)
self.assertTrue(torch.allclose(outputs.pred_masks[0, :, 448:451, :3], expected_slice, atol=4e-4))
torch.testing.assert_close(outputs.pred_masks[0, :, 448:451, :3], expected_slice, rtol=4e-4, atol=4e-4)
@slow
def test_one_shot_with_label(self):
@@ -461,4 +461,4 @@ class SegGptModelIntegrationTest(unittest.TestCase):
outputs = model(**inputs, labels=labels, bool_masked_pos=bool_masked_pos)
expected_loss = torch.tensor(0.0074).to(torch_device)
self.assertTrue(torch.allclose(outputs.loss, expected_loss, atol=1e-4))
torch.testing.assert_close(outputs.loss, expected_loss, rtol=1e-4, atol=1e-4)