From 6081382b4b24422ad938d48ed1634c7a8b3dd404 Mon Sep 17 00:00:00 2001 From: raushan Date: Wed, 17 Dec 2025 12:01:11 +0100 Subject: [PATCH 1/2] fix --- .../convert_wav2vec2_seamless_checkpoint.py | 1 - src/transformers/pipelines/__init__.py | 13 +++++++------ .../pipelines/automatic_speech_recognition.py | 6 +----- 3 files changed, 8 insertions(+), 12 deletions(-) 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 d8ed32213309..a9252bfc3014 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 @@ -986,12 +986,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, + **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: From 0bcc52bffe01a6648e9f86f4c25bbf155ed10757 Mon Sep 17 00:00:00 2001 From: Pedro Cuenca Date: Wed, 24 Dec 2025 00:41:04 +0100 Subject: [PATCH 2/2] Update src/transformers/pipelines/__init__.py --- src/transformers/pipelines/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/transformers/pipelines/__init__.py b/src/transformers/pipelines/__init__.py index a9252bfc3014..f023aa122ad2 100755 --- a/src/transformers/pipelines/__init__.py +++ b/src/transformers/pipelines/__init__.py @@ -987,7 +987,7 @@ def pipeline( feature_extractor, _from_pipeline=task, **hub_kwargs, **model_kwargs ) config_dict, _ = FeatureExtractionMixin.get_feature_extractor_dict( - pretrained_model_name_or_path, + pretrained_model_name_or_path or model_name, **hub_kwargs, ) processor_class = config_dict.get("processor_class", None)