Ë
    T^(hS  ã                   ó0   — d Z ddlmZ  G d„ de«      ZdgZy)z$
Speech processor class for Whisper
é   )ÚProcessorMixinc                   óR   ‡ — e Zd ZdZdZdZˆ fd„Zdd„Zd„ Zd„ Z	d„ Z
dd	efd
„Zˆ xZS )ÚWhisperProcessoraz  
    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                 óV   •— t         ‰| �  ||«       | j                  | _        d| _        y )NF)ÚsuperÚ__init__Úfeature_extractorÚcurrent_processorÚ_in_target_context_manager)Úselfr   Ú	tokenizerÚ	__class__s      €úl/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/transformers/models/whisper/processing_whisper.pyr
   zWhisperProcessor.__init__(   s)   ø€ Ü‰ÑÐ*¨IÔ6Ø!%×!7Ñ!7ˆÔØ*/ˆÕ'ó    c                 ó>   — | j                   j                  |||¬«      S )N)ÚtaskÚlanguageÚno_timestamps)r   Úget_decoder_prompt_ids)r   r   r   r   s       r   r   z'WhisperProcessor.get_decoder_prompt_ids-   s   € Ø�~‰~×4Ñ4¸$ÈÐanÐ4ÓoÐor   c                 óz  — | j                   r | j                  |i |¤ŽS |j                  dd«      }|j                  dd«      }|j                  dd«      }t        |«      dkD  r
|d   }|dd }|€|€t	        d«      ‚|� | j
                  |g|¢­d|i|¤Ž}|� | j                  |fi |¤Ž}|€S |€S d   d	<   |S )
a
  
        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__zWhisperProcessor.__call__0   sõ   € ð ×*Ò*Ø)�4×)Ñ)¨4Ð:°6Ñ:Ð:à—
‘
˜7 DÓ)ˆØŸ
™
 ?°DÓ9ˆØ�z‰z˜& $Ó'ˆÜˆt‹9�qŠ=Ø˜‘GˆEØ˜˜�8ˆDàˆ=˜T˜\ÜÐ`ÓaÐaàÐØ+�T×+Ñ+¨EÐ`°DÒ`ÈÐ`ÐY_Ñ`ˆFØÐØ&˜Ÿ™ tÑ6¨vÑ6ˆIàˆ<ØˆMàˆ]ØÐà(¨Ñ5ˆF�8ÑØˆMr   c                 ó:   —  | j                   j                  |i |¤ŽS )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)   zWhisperProcessor.batch_decodeR   s    € ð
 +ˆt�~‰~×*Ñ*¨DÐ;°FÑ;Ð;r   c                 ó:   —  | j                   j                  |i |¤ŽS )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   r,   zWhisperProcessor.decodeY   s    € ð
 %ˆt�~‰~×$Ñ$ dÐ5¨fÑ5Ð5r   r   c                 ó<   — | j                   j                  ||¬«      S )N)Úreturn_tensors)r   Úget_prompt_ids)r   r   r.   s      r   r/   zWhisperProcessor.get_prompt_ids`   s   € Ø�~‰~×,Ñ,¨TÀ.Ð,ÓQÐQr   )NNT)Únp)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úfeature_extractor_classÚtokenizer_classr
   r   r'   r)   r,   Ústrr/   Ú__classcell__)r   s   @r   r   r      s>   ø„ ñð 8ÐØ(€Oô0ó
pò òD<ò6ñR 3÷ Rr   r   N)r4   Úprocessing_utilsr   r   Ú__all__© r   r   ú<module>r<      s*   ðñõ /ôKR�~ô KRð\ Ð
�r   