Fall back to slow image processor in ImageProcessingAuto when no fast processor available (#34785)

* refactor image_processing_auto logic

* fix fast image processor tests

* Fix tests fast vit image processor

* Add safeguard when use_fast True and torchvision not available

* change default use_fast back to None, add warnings

* remove debugging print

* call get_image_processor_class_from_name once
This commit is contained in:
Yoni Gozlan
2024-12-15 14:00:36 -05:00
committed by GitHub
parent ca03842cdc
commit 5615a39369
8 changed files with 72 additions and 37 deletions

View File

@@ -16,7 +16,7 @@ import unittest
import requests
from transformers.testing_utils import require_torch, require_torch_gpu, require_vision, slow
from transformers.testing_utils import require_torch, require_torch_gpu, require_torchvision, require_vision, slow
from transformers.utils import is_torch_available, is_torchvision_available, is_vision_available
from ...test_image_processing_common import ImageProcessingTestMixin, prepare_image_inputs
@@ -374,6 +374,7 @@ class RtDetrImageProcessingTest(ImageProcessingTestMixin, unittest.TestCase):
@slow
@require_torch_gpu
@require_torchvision
# Copied from tests.models.detr.test_image_processing_detr.DetrImageProcessingTest.test_fast_processor_equivalence_cpu_gpu_coco_detection_annotations
def test_fast_processor_equivalence_cpu_gpu_coco_detection_annotations(self):
# prepare image and target