26
26
)
27
27
from transformers .utils import is_tf_available , is_torch_available , is_vision_available
28
28
29
- from ...test_processing_common import ProcessorTesterMixin
29
+ from ...test_processing_common import ProcessorTesterMixin , prepare_image_inputs
30
30
31
31
32
32
if is_vision_available ():
@@ -164,9 +164,7 @@ def test_post_process_masks(self):
164
164
165
165
@require_vision
166
166
@require_tf
167
- class TFSamProcessorTest (ProcessorTesterMixin , unittest .TestCase ):
168
- processor_class = SamProcessor
169
-
167
+ class TFSamProcessorTest (unittest .TestCase ):
170
168
def setUp (self ):
171
169
self .tmpdirname = tempfile .mkdtemp ()
172
170
image_processor = SamImageProcessor ()
@@ -179,20 +177,10 @@ def get_image_processor(self, **kwargs):
179
177
def tearDown (self ):
180
178
shutil .rmtree (self .tmpdirname )
181
179
182
- def test_chat_template_save_loading (self ):
183
- self .skipTest ("SamProcessor does not have a tokenizer" )
184
-
185
- def test_image_processor_defaults_preserved_by_image_kwargs (self ):
186
- self .skipTest ("SamProcessor does not have a tokenizer" )
187
-
188
- def test_kwargs_overrides_default_image_processor_kwargs (self ):
189
- self .skipTest ("SamProcessor does not have a tokenizer" )
190
-
191
- def test_kwargs_overrides_default_tokenizer_kwargs (self ):
192
- self .skipTest ("SamProcessor does not have a tokenizer" )
193
-
194
- def test_tokenizer_defaults_preserved_by_kwargs (self ):
195
- self .skipTest ("SamProcessor does not have a tokenizer" )
180
+ # This is to avoid repeating the skipping of the common tests
181
+ def prepare_image_inputs (self ):
182
+ """This function prepares a list of PIL images."""
183
+ return prepare_image_inputs ()
196
184
197
185
def test_save_load_pretrained_additional_features (self ):
198
186
processor = SamProcessor (image_processor = self .get_image_processor ())
@@ -259,9 +247,7 @@ def test_post_process_masks(self):
259
247
260
248
@require_vision
261
249
@require_torchvision
262
- class SamProcessorEquivalenceTest (ProcessorTesterMixin , unittest .TestCase ):
263
- processor_class = SamProcessor
264
-
250
+ class SamProcessorEquivalenceTest (unittest .TestCase ):
265
251
def setUp (self ):
266
252
self .tmpdirname = tempfile .mkdtemp ()
267
253
image_processor = SamImageProcessor ()
@@ -274,20 +260,10 @@ def get_image_processor(self, **kwargs):
274
260
def tearDown (self ):
275
261
shutil .rmtree (self .tmpdirname )
276
262
277
- def test_chat_template_save_loading (self ):
278
- self .skipTest ("SamProcessor does not have a tokenizer" )
279
-
280
- def test_image_processor_defaults_preserved_by_image_kwargs (self ):
281
- self .skipTest ("SamProcessor does not have a tokenizer" )
282
-
283
- def test_kwargs_overrides_default_image_processor_kwargs (self ):
284
- self .skipTest ("SamProcessor does not have a tokenizer" )
285
-
286
- def test_kwargs_overrides_default_tokenizer_kwargs (self ):
287
- self .skipTest ("SamProcessor does not have a tokenizer" )
288
-
289
- def test_tokenizer_defaults_preserved_by_kwargs (self ):
290
- self .skipTest ("SamProcessor does not have a tokenizer" )
263
+ # This is to avoid repeating the skipping of the common tests
264
+ def prepare_image_inputs (self ):
265
+ """This function prepares a list of PIL images."""
266
+ return prepare_image_inputs ()
291
267
292
268
@is_pt_tf_cross_test
293
269
def test_post_process_masks_equivalence (self ):
0 commit comments