Skip to content

Commit 3ecdda4

Browse files
committed
fix auto video processor
1 parent de24fb6 commit 3ecdda4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/transformers/models/auto/video_processing_auto.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -306,15 +306,15 @@ def from_pretrained(cls, pretrained_model_name_or_path, *inputs, **kwargs):
306306
if "AutoVideoProcessor" in config_dict.get("auto_map", {}):
307307
video_processor_auto_map = config_dict["auto_map"]["AutoVideoProcessor"]
308308

309-
# If we still don't have the video processor class, check if we're loading from a previous feature extractor config
309+
# If we still don't have the video processor class, check if we're loading from a previous image processor config
310310
# and if so, infer the video processor class from there.
311311
if video_processor_class is None and video_processor_auto_map is None:
312-
feature_extractor_class = config_dict.pop("feature_extractor_type", None)
313-
if feature_extractor_class is not None:
314-
video_processor_class = feature_extractor_class.replace("FeatureExtractor", "VideoProcessor")
315-
if "AutoFeatureExtractor" in config_dict.get("auto_map", {}):
316-
feature_extractor_auto_map = config_dict["auto_map"]["AutoFeatureExtractor"]
317-
video_processor_auto_map = feature_extractor_auto_map.replace("FeatureExtractor", "VideoProcessor")
312+
image_processor_class = config_dict.pop("image_processor_type", None)
313+
if image_processor_class is not None:
314+
video_processor_class = image_processor_class.replace("ImageProcessor", "VideoProcessor")
315+
if "AutoImageProcessor" in config_dict.get("auto_map", {}):
316+
image_processor_auto_map = config_dict["auto_map"]["AutoImageProcessor"]
317+
video_processor_auto_map = image_processor_auto_map.replace("ImageProcessor", "VideoProcessor")
318318

319319
# If we don't find the video processor class in the video processor config, let's try the model config.
320320
if video_processor_class is None and video_processor_auto_map is None:

0 commit comments

Comments
 (0)