mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-03 04:40:06 +06:00
[video processor] fix slow tests (#38881)
* we need to check against mapping to be safe * need to check only when inferring from image type, otherwise messes custom code --------- Co-authored-by: Yih-Dar <2521628+ydshieh@users.noreply.github.com>
This commit is contained in:
parent
b922b22ec2
commit
ea01334873
@ -311,7 +311,12 @@ class AutoVideoProcessor:
|
||||
if video_processor_class is None and video_processor_auto_map is None:
|
||||
image_processor_class = config_dict.pop("image_processor_type", None)
|
||||
if image_processor_class is not None:
|
||||
video_processor_class = image_processor_class.replace("ImageProcessor", "VideoProcessor")
|
||||
video_processor_class_inferred = image_processor_class.replace("ImageProcessor", "VideoProcessor")
|
||||
|
||||
# Some models have different image processors, e.g. InternVL uses GotOCRImageProcessor
|
||||
# We cannot use GotOCRVideoProcessor when falling back for BC and should try to infer from config later on
|
||||
if video_processor_class_inferred in VIDEO_PROCESSOR_MAPPING_NAMES.values():
|
||||
video_processor_class = video_processor_class_inferred
|
||||
if "AutoImageProcessor" in config_dict.get("auto_map", {}):
|
||||
image_processor_auto_map = config_dict["auto_map"]["AutoImageProcessor"]
|
||||
video_processor_auto_map = image_processor_auto_map.replace("ImageProcessor", "VideoProcessor")
|
||||
|
Loading…
Reference in New Issue
Block a user