[processors] add tests for helper fn (#39629)
* add tests for helpers * duplicate test for each model * why llava next video has no helper * oops must have been in the commit * fix test after rebase * add copy from
This commit is contained in:
committed by
GitHub
parent
6638b3642d
commit
8b237b8639
@@ -358,3 +358,28 @@ class Idefics3ImageProcessingTest(ImageProcessingTestMixin, unittest.TestCase):
|
||||
)
|
||||
self.assertEqual(encoding_slow.rows, encoding_fast.rows)
|
||||
self.assertEqual(encoding_slow.cols, encoding_fast.cols)
|
||||
|
||||
def test_get_num_patches_without_images(self):
|
||||
for image_processing_class in self.image_processor_list:
|
||||
image_processing = image_processing_class(**self.image_processor_dict)
|
||||
num_patches_and_row_cols = image_processing.get_number_of_image_patches(
|
||||
height=100, width=100, images_kwargs={}
|
||||
)
|
||||
self.assertEqual(num_patches_and_row_cols, (5, 2, 2))
|
||||
|
||||
num_patches_and_row_cols = image_processing.get_number_of_image_patches(
|
||||
height=300, width=500, images_kwargs={"do_image_splitting": False}
|
||||
)
|
||||
self.assertEqual(num_patches_and_row_cols, (1, 1, 1))
|
||||
|
||||
num_patches_and_row_cols = image_processing.get_number_of_image_patches(
|
||||
height=300, width=500, images_kwargs={"do_image_splitting": True}
|
||||
)
|
||||
self.assertEqual(num_patches_and_row_cols, (5, 2, 2))
|
||||
|
||||
num_patches_and_row_cols = image_processing.get_number_of_image_patches(
|
||||
height=300,
|
||||
width=600,
|
||||
images_kwargs={"do_image_splitting": True, "max_image_size": {"longest_edge": 30}},
|
||||
)
|
||||
self.assertEqual(num_patches_and_row_cols, (3, 1, 2))
|
||||
|
||||
Reference in New Issue
Block a user