Unverified Commit 5c7e11e0 authored by Yih-Dar's avatar Yih-Dar Committed by GitHub
Browse files

update warning for image processor loading (#28209)



* info

* update

* Update src/transformers/models/auto/image_processing_auto.py
Co-authored-by: default avataramyeroberts <22614925+amyeroberts@users.noreply.github.com>

* update

---------
Co-authored-by: default avatarydshieh <ydshieh@users.noreply.github.com>
Co-authored-by: default avataramyeroberts <22614925+amyeroberts@users.noreply.github.com>
parent 3b742ea8
...@@ -364,16 +364,20 @@ class AutoImageProcessor: ...@@ -364,16 +364,20 @@ class AutoImageProcessor:
feature_extractor_class = config_dict.pop("feature_extractor_type", None) feature_extractor_class = config_dict.pop("feature_extractor_type", None)
if feature_extractor_class is not None: if feature_extractor_class is not None:
logger.warning( logger.warning(
"Could not find image processor class in the image processor config or the model config. Loading" "Could not find image processor class in the image processor config or the model config. Loading "
" based on pattern matching with the model's feature extractor configuration." "based on pattern matching with the model's feature extractor configuration. Please open a "
"PR/issue to update `preprocessor_config.json` to use `image_processor_type` instead of "
"`feature_extractor_type`. This warning will be removed in v4.40."
) )
image_processor_class = feature_extractor_class.replace("FeatureExtractor", "ImageProcessor") image_processor_class = feature_extractor_class.replace("FeatureExtractor", "ImageProcessor")
if "AutoFeatureExtractor" in config_dict.get("auto_map", {}): if "AutoFeatureExtractor" in config_dict.get("auto_map", {}):
feature_extractor_auto_map = config_dict["auto_map"]["AutoFeatureExtractor"] feature_extractor_auto_map = config_dict["auto_map"]["AutoFeatureExtractor"]
image_processor_auto_map = feature_extractor_auto_map.replace("FeatureExtractor", "ImageProcessor") image_processor_auto_map = feature_extractor_auto_map.replace("FeatureExtractor", "ImageProcessor")
logger.warning( logger.warning(
"Could not find image processor auto map in the image processor config or the model config." "Could not find image processor auto map in the image processor config or the model config. "
" Loading based on pattern matching with the model's feature extractor configuration." "Loading based on pattern matching with the model's feature extractor configuration. Please open a "
"PR/issue to update `preprocessor_config.json` to use `AutoImageProcessor` instead of "
"`AutoFeatureExtractor`. This warning will be removed in v4.40."
) )
# If we don't find the image processor class in the image processor config, let's try the model config. # If we don't find the image processor class in the image processor config, let's try the model config.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment