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

@@ -140,6 +140,7 @@ class AutoImageProcessorTest(unittest.TestCase):
def test_use_fast_selection(self):
checkpoint = "hf-internal-testing/tiny-random-vit"
# TODO: @yoni, change in v4.48 (when use_fast set to True by default)
# Slow image processor is selected by default
image_processor = AutoImageProcessor.from_pretrained(checkpoint)
self.assertIsInstance(image_processor, ViTImageProcessor)