o
    ei5                     @   s:   d Z ddlmZ ddlmZ eG dd deZdgZdS )z$
Speech processor class for Whisper
   )ProcessorMixin)auto_docstringc                       sB   e Zd Z fddZdddZedd Zdd
efddZ  Z	S )WhisperProcessorc                    s   t  || d S )N)super__init__)selffeature_extractor	tokenizer	__class__ l/home/ubuntu/transcripts/venv/lib/python3.10/site-packages/transformers/models/whisper/processing_whisper.pyr         zWhisperProcessor.__init__NTc                 C   s   | j j|||dS )N)tasklanguageno_timestamps)r	   get_decoder_prompt_ids)r   r   r   r   r   r   r   r      r   z'WhisperProcessor.get_decoder_prompt_idsc                 O   s   | dd }| dd }| dd }t|dkr"|d }|dd  }|d u r.|d u r.td|d ur@| j|g|R d|i|}|d urM| j|fi |}|d u rS|S |d u rY|S |d |d< |S )	Naudiosampling_ratetext       zAYou need to specify either an `audio` or `text` input to process.	input_idslabels)poplen
ValueErrorr   r	   )r   argskwargsr   r   r   inputs	encodingsr   r   r   __call__   s$   zWhisperProcessor.__call__npr   c                 C   s   | j j||dS )N)return_tensors)r	   get_prompt_ids)r   r   r#   r   r   r   r$   8   s   zWhisperProcessor.get_prompt_ids)NNT)r"   )
__name__
__module____qualname__r   r   r   r!   strr$   __classcell__r   r   r
   r   r      s    

r   N)__doc__processing_utilsr   utilsr   r   __all__r   r   r   r   <module>   s   
%