
    fThS                     0    S r SSKJr   " S S\5      rS/rg)z$
Speech processor class for Whisper
   )ProcessorMixinc                   b   ^  \ rS rSrSrSrSrU 4S jrSS jrS r	S r
S	 rSS
\4S jjrSrU =r$ )WhisperProcessor   aR  
Constructs a Whisper processor which wraps a Whisper feature extractor and a Whisper tokenizer into a single
processor.

[`WhisperProcessor`] offers all the functionalities of [`WhisperFeatureExtractor`] and [`WhisperTokenizer`]. See
the [`~WhisperProcessor.__call__`] and [`~WhisperProcessor.decode`] for more information.

Args:
    feature_extractor (`WhisperFeatureExtractor`):
        An instance of [`WhisperFeatureExtractor`]. The feature extractor is a required input.
    tokenizer (`WhisperTokenizer`):
        An instance of [`WhisperTokenizer`]. The tokenizer is a required input.
WhisperFeatureExtractorWhisperTokenizerc                 T   > [         TU ]  X5        U R                  U l        SU l        g )NF)super__init__feature_extractorcurrent_processor_in_target_context_manager)selfr   	tokenizer	__class__s      f/var/www/auris/envauris/lib/python3.13/site-packages/transformers/models/whisper/processing_whisper.pyr   WhisperProcessor.__init__(   s'    *6!%!7!7*/'    c                 6    U R                   R                  XUS9$ )N)tasklanguageno_timestamps)r   get_decoder_prompt_ids)r   r   r   r   s       r   r   'WhisperProcessor.get_decoder_prompt_ids-   s    ~~44$an4oor   c                    U R                   (       a  U R                  " U0 UD6$ UR                  SS5      nUR                  SS5      nUR                  SS5      n[        U5      S:  a
  US   nUSS nUc  Uc  [	        S5      eUb  U R
                  " U/UQ7SU0UD6nUb  U R                  " U40 UD6nUc  W$ Uc  W$ WS   WS	'   U$ )
z
Forwards the `audio` argument to WhisperFeatureExtractor's [`~WhisperFeatureExtractor.__call__`] and the `text`
argument to [`~WhisperTokenizer.__call__`]. Please refer to the docstring of the above two methods for more
information.
audioNsampling_ratetext       zAYou need to specify either an `audio` or `text` input to process.	input_idslabels)r   r   poplen
ValueErrorr   r   )r   argskwargsr   r   r   inputs	encodingss           r   __call__WhisperProcessor.__call__0   s     **))4:6::

7D)

?D9zz&$'t9q=GE8D=T\`aa++E`D``Y_`Ft6v6I<M](5F8Mr   c                 :    U R                   R                  " U0 UD6$ )z
This method forwards all its arguments to WhisperTokenizer's [`~PreTrainedTokenizer.batch_decode`]. Please
refer to the docstring of this method for more information.
)r   batch_decoder   r&   r'   s      r   r-   WhisperProcessor.batch_decodeR   s    
 ~~**D;F;;r   c                 :    U R                   R                  " U0 UD6$ )z
This method forwards all its arguments to WhisperTokenizer's [`~PreTrainedTokenizer.decode`]. Please refer to
the docstring of this method for more information.
)r   decoder.   s      r   r1   WhisperProcessor.decodeY   s    
 ~~$$d5f55r   r   c                 4    U R                   R                  XS9$ )N)return_tensors)r   get_prompt_ids)r   r   r4   s      r   r5   WhisperProcessor.get_prompt_ids`   s    ~~,,T,QQr   )r   r   )NNT)np)__name__
__module____qualname____firstlineno____doc__feature_extractor_classtokenizer_classr   r   r*   r-   r1   strr5   __static_attributes____classcell__)r   s   @r   r   r      sD     8(O0
p D<6R3 R Rr   r   N)r<   processing_utilsr   r   __all__ r   r   <module>rE      s*    /KR~ KR\ 
r   