From de329a3c73dc238f894cebdd41e1338fc32268e3 Mon Sep 17 00:00:00 2001 From: eustlb <94853470+eustlb@users.noreply.github.com> Date: Mon, 9 Feb 2026 15:14:17 +0100 Subject: [PATCH 1/2] call processor mixin --- .../models/whisper/processing_whisper.py | 23 +++++-------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/src/transformers/models/whisper/processing_whisper.py b/src/transformers/models/whisper/processing_whisper.py index 1d1b33f3c155..fc77817743ea 100644 --- a/src/transformers/models/whisper/processing_whisper.py +++ b/src/transformers/models/whisper/processing_whisper.py @@ -15,7 +15,7 @@ Speech processor class for Whisper """ -from ...processing_utils import ProcessorMixin +from ...processing_utils import ProcessorMixin, ProcessingKwargs from ...utils import auto_docstring @@ -30,28 +30,17 @@ def get_decoder_prompt_ids(self, task=None, language=None, no_timestamps=True): @auto_docstring def __call__(self, *args, **kwargs): audio = kwargs.pop("audio", None) - sampling_rate = kwargs.pop("sampling_rate", None) text = kwargs.pop("text", None) + + # for BC if len(args) > 0: audio = args[0] args = args[1:] - if audio is None and text is None: - raise ValueError("You need to specify either an `audio` or `text` input to process.") - - if audio is not None: - inputs = self.feature_extractor(audio, *args, sampling_rate=sampling_rate, **kwargs) + outputs = super().__call__(audio=audio, text=text, **kwargs) if text is not None: - encodings = self.tokenizer(text, **kwargs) - - if text is None: - return inputs - - elif audio is None: - return encodings - else: - inputs["labels"] = encodings["input_ids"] - return inputs + outputs["labels"] = outputs["input_ids"] + return outputs def get_prompt_ids(self, text: str, return_tensors="np"): return self.tokenizer.get_prompt_ids(text, return_tensors=return_tensors) From fc1fd0de1c3d89198986972b5a7dd55e2609bc28 Mon Sep 17 00:00:00 2001 From: eustlb <94853470+eustlb@users.noreply.github.com> Date: Mon, 9 Feb 2026 15:18:26 +0100 Subject: [PATCH 2/2] style --- src/transformers/models/whisper/processing_whisper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/transformers/models/whisper/processing_whisper.py b/src/transformers/models/whisper/processing_whisper.py index fc77817743ea..7eb97c24f7e3 100644 --- a/src/transformers/models/whisper/processing_whisper.py +++ b/src/transformers/models/whisper/processing_whisper.py @@ -15,7 +15,7 @@ Speech processor class for Whisper """ -from ...processing_utils import ProcessorMixin, ProcessingKwargs +from ...processing_utils import ProcessorMixin from ...utils import auto_docstring