Fixing backward compatiblity image_processor in pipeline. (#21513)

This commit is contained in:
Nicolas Patry
2023-02-08 19:36:20 +01:00
committed by GitHub
parent 8ea994d3c5
commit 06d940efc3

View File

@@ -861,6 +861,10 @@ def pipeline(
image_processor = model_name image_processor = model_name
elif isinstance(config, str): elif isinstance(config, str):
image_processor = config image_processor = config
# Backward compatibility, as `feature_extractor` used to be the name
# for `ImageProcessor`.
elif feature_extractor is not None and isinstance(feature_extractor, BaseImageProcessor):
image_processor = feature_extractor
else: else:
# Impossible to guess what is the right image_processor here # Impossible to guess what is the right image_processor here
raise Exception( raise Exception(