diff --git a/src/transformers/models/wav2vec2_bert/convert_wav2vec2_seamless_checkpoint.py b/src/transformers/models/wav2vec2_bert/convert_wav2vec2_seamless_checkpoint.py index fc6daaeee71d..3fb124c3dda6 100644 --- a/src/transformers/models/wav2vec2_bert/convert_wav2vec2_seamless_checkpoint.py +++ b/src/transformers/models/wav2vec2_bert/convert_wav2vec2_seamless_checkpoint.py @@ -150,7 +150,6 @@ def convert_wav2vec2_bert_checkpoint( # save feature extractor fe = SeamlessM4TFeatureExtractor(padding_value=1) - fe._processor_class = "Wav2Vec2BertProcessor" fe.save_pretrained(pytorch_dump_folder_path) if repo_id: diff --git a/src/transformers/pipelines/__init__.py b/src/transformers/pipelines/__init__.py index 34d6222d7165..567d0150d2f6 100755 --- a/src/transformers/pipelines/__init__.py +++ b/src/transformers/pipelines/__init__.py @@ -22,7 +22,7 @@ from ..configuration_utils import PreTrainedConfig from ..dynamic_module_utils import get_class_from_dynamic_module -from ..feature_extraction_utils import PreTrainedFeatureExtractor +from ..feature_extraction_utils import FeatureExtractionMixin, PreTrainedFeatureExtractor from ..image_processing_utils import BaseImageProcessor from ..models.auto.configuration_auto import AutoConfig from ..models.auto.feature_extraction_auto import FEATURE_EXTRACTOR_MAPPING, AutoFeatureExtractor @@ -988,12 +988,13 @@ def pipeline( feature_extractor = AutoFeatureExtractor.from_pretrained( feature_extractor, _from_pipeline=task, **hub_kwargs, **model_kwargs ) + config_dict, _ = FeatureExtractionMixin.get_feature_extractor_dict( + pretrained_model_name_or_path or model_name, + **hub_kwargs, + ) + processor_class = config_dict.get("processor_class", None) - if ( - feature_extractor._processor_class - and feature_extractor._processor_class.endswith("WithLM") - and isinstance(model_name, str) - ): + if processor_class is not None and processor_class.endswith("WithLM") and isinstance(model_name, str): try: import kenlm # to trigger `ImportError` if not installed from pyctcdecode import BeamSearchDecoderCTC diff --git a/src/transformers/pipelines/automatic_speech_recognition.py b/src/transformers/pipelines/automatic_speech_recognition.py index 8e6f8b5cafcd..60cc3cd4a430 100644 --- a/src/transformers/pipelines/automatic_speech_recognition.py +++ b/src/transformers/pipelines/automatic_speech_recognition.py @@ -198,11 +198,7 @@ def __init__( self.type = "seq2seq_whisper" elif model.__class__.__name__ in MODEL_FOR_SPEECH_SEQ_2_SEQ_MAPPING_NAMES.values(): self.type = "seq2seq" - elif ( - feature_extractor._processor_class - and feature_extractor._processor_class.endswith("WithLM") - and decoder is not None - ): + elif decoder is not None: self.decoder = decoder self.type = "ctc_with_lm" else: