Remove differences between init and preprocess kwargs for fast image processors (#36186)

* Remove differences between init and preprocess kwargs in fast image processors

* make modifs got_ocr2

* update gemma3
This commit is contained in:
Yoni Gozlan
2025-03-12 19:44:05 -04:00
committed by GitHub
parent cc3a361b46
commit ea219ed164
15 changed files with 136 additions and 198 deletions

View File

@@ -311,8 +311,10 @@ class ImageProcessingTestMixin:
}
dict_slow_0 = {key: dict_slow_0[key] for key in set(dict_slow_0) & set(dict_slow_1)}
dict_slow_1 = {key: dict_slow_1[key] for key in set(dict_slow_0) & set(dict_slow_1)}
# check that all additional keys are None, except for `default_to_square` which is only set in fast processors
self.assertTrue(all(value is None for key, value in difference.items() if key not in ["default_to_square"]))
# check that all additional keys are None, except for `default_to_square` and `data_format` which are only set in fast processors
self.assertTrue(
all(value is None for key, value in difference.items() if key not in ["default_to_square", "data_format"])
)
# check that the remaining keys are the same
self.assertEqual(dict_slow_0, dict_slow_1)
@@ -324,8 +326,10 @@ class ImageProcessingTestMixin:
}
dict_fast_0 = {key: dict_fast_0[key] for key in set(dict_fast_0) & set(dict_fast_1)}
dict_fast_1 = {key: dict_fast_1[key] for key in set(dict_fast_0) & set(dict_fast_1)}
# check that all additional keys are None, except for `default_to_square` which is only set in fast processors
self.assertTrue(all(value is None for key, value in difference.items() if key not in ["default_to_square"]))
# check that all additional keys are None, except for `default_to_square` and `data_format` which are only set in fast processors
self.assertTrue(
all(value is None for key, value in difference.items() if key not in ["default_to_square", "data_format"])
)
# check that the remaining keys are the same
self.assertEqual(dict_fast_0, dict_fast_1)
@@ -357,8 +361,10 @@ class ImageProcessingTestMixin:
}
dict_slow_0 = {key: dict_slow_0[key] for key in set(dict_slow_0) & set(dict_slow_1)}
dict_slow_1 = {key: dict_slow_1[key] for key in set(dict_slow_0) & set(dict_slow_1)}
# check that all additional keys are None, except for `default_to_square` which is only set in fast processors
self.assertTrue(all(value is None for key, value in difference.items() if key not in ["default_to_square"]))
# check that all additional keys are None, except for `default_to_square` and `data_format` which are only set in fast processors
self.assertTrue(
all(value is None for key, value in difference.items() if key not in ["default_to_square", "data_format"])
)
# check that the remaining keys are the same
self.assertEqual(dict_slow_0, dict_slow_1)
@@ -370,8 +376,10 @@ class ImageProcessingTestMixin:
}
dict_fast_0 = {key: dict_fast_0[key] for key in set(dict_fast_0) & set(dict_fast_1)}
dict_fast_1 = {key: dict_fast_1[key] for key in set(dict_fast_0) & set(dict_fast_1)}
# check that all additional keys are None, except for `default_to_square` which is only set in fast processors
self.assertTrue(all(value is None for key, value in difference.items() if key not in ["default_to_square"]))
# check that all additional keys are None, except for `default_to_square` and `data_format` which are only set in fast processors
self.assertTrue(
all(value is None for key, value in difference.items() if key not in ["default_to_square", "data_format"])
)
# check that the remaining keys are the same
self.assertEqual(dict_fast_0, dict_fast_1)