mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-24 14:58:56 +06:00
provide trust_remote_code for search feat extractor in model config (#34036)
This commit is contained in:
parent
8363fd8346
commit
211f1d93db
@ -351,7 +351,9 @@ class AutoFeatureExtractor:
|
||||
# If we don't find the feature extractor class in the feature extractor config, let's try the model config.
|
||||
if feature_extractor_class is None and feature_extractor_auto_map is None:
|
||||
if not isinstance(config, PretrainedConfig):
|
||||
config = AutoConfig.from_pretrained(pretrained_model_name_or_path, **kwargs)
|
||||
config = AutoConfig.from_pretrained(
|
||||
pretrained_model_name_or_path, trust_remote_code=trust_remote_code, **kwargs
|
||||
)
|
||||
# It could be in `config.feature_extractor_type``
|
||||
feature_extractor_class = getattr(config, "feature_extractor_type", None)
|
||||
if hasattr(config, "auto_map") and "AutoFeatureExtractor" in config.auto_map:
|
||||
|
@ -431,7 +431,9 @@ class AutoImageProcessor:
|
||||
# If we don't find the image processor class in the image processor config, let's try the model config.
|
||||
if image_processor_class is None and image_processor_auto_map is None:
|
||||
if not isinstance(config, PretrainedConfig):
|
||||
config = AutoConfig.from_pretrained(pretrained_model_name_or_path, **kwargs)
|
||||
config = AutoConfig.from_pretrained(
|
||||
pretrained_model_name_or_path, trust_remote_code=trust_remote_code, **kwargs
|
||||
)
|
||||
# It could be in `config.image_processor_type``
|
||||
image_processor_class = getattr(config, "image_processor_type", None)
|
||||
if hasattr(config, "auto_map") and "AutoImageProcessor" in config.auto_map:
|
||||
|
Loading…
Reference in New Issue
Block a user