add Qwen2-VL image processor fast (#35733)
* add qwen2_vl image processor fast * add device to ImagesKwargs * remove automatic fix copies * fix fast_is_faster_than_slow * remove unnecessary import
This commit is contained in:
@@ -181,7 +181,10 @@ class ImageProcessingTestMixin:
|
||||
encoding_slow = image_processor_slow(dummy_image, return_tensors="pt")
|
||||
encoding_fast = image_processor_fast(dummy_image, return_tensors="pt")
|
||||
|
||||
self.assertTrue(torch.allclose(encoding_slow.pixel_values, encoding_fast.pixel_values, atol=1e-2))
|
||||
self.assertTrue(torch.allclose(encoding_slow.pixel_values, encoding_fast.pixel_values, atol=1e-1))
|
||||
self.assertLessEqual(
|
||||
torch.mean(torch.abs(encoding_slow.pixel_values - encoding_fast.pixel_values)).item(), 1e-3
|
||||
)
|
||||
|
||||
@require_vision
|
||||
@require_torch
|
||||
@@ -193,6 +196,8 @@ class ImageProcessingTestMixin:
|
||||
self.skipTest(reason="Skipping speed test as one of the image processors is not defined")
|
||||
|
||||
def measure_time(image_processor, image):
|
||||
# Warmup
|
||||
_ = image_processor(image, return_tensors="pt")
|
||||
start = time.time()
|
||||
_ = image_processor(image, return_tensors="pt")
|
||||
return time.time() - start
|
||||
|
||||
Reference in New Issue
Block a user