o
    òÜÓh  ã                   @   s$   d Z ddlmZ G dd„ deƒZdS )z
Processor class for CLVP
é   )ÚProcessorMixinc                       sH   e Zd ZdZdZdZg d¢Z‡ fdd„Zdd„ Zd	d
„ Z	dd„ Z
‡  ZS )ÚClvpProcessoras  
    Constructs a CLVP processor which wraps a CLVP Feature Extractor and a CLVP Tokenizer into a single processor.

    [`ClvpProcessor`] offers all the functionalities of [`ClvpFeatureExtractor`] and [`ClvpTokenizer`]. See the
    [`~ClvpProcessor.__call__`], [`~ClvpProcessor.decode`] and [`~ClvpProcessor.batch_decode`] for more information.

    Args:
        feature_extractor (`ClvpFeatureExtractor`):
            An instance of [`ClvpFeatureExtractor`]. The feature extractor is a required input.
        tokenizer (`ClvpTokenizer`):
            An instance of [`ClvpTokenizer`]. The tokenizer is a required input.
    ÚClvpFeatureExtractorÚClvpTokenizer)Ú	input_idsÚinput_featuresÚattention_maskc                    s   t ƒ  ||¡ d S )N)ÚsuperÚ__init__)ÚselfÚfeature_extractorÚ	tokenizer©Ú	__class__© ú^/var/www/html/ai/venv/lib/python3.10/site-packages/transformers/models/clvp/processing_clvp.pyr
   .   s   zClvpProcessor.__init__c                 O   s¨   |  dd¡}|  dd¡}|  dd¡}|du r|du rtdƒ‚|dur-| j|fd|i|¤Ž}|dur:| j|fi |¤Ž}|du r@|S |du rF|S |d |d< |d |d< |S )zÿ
        Forwards the `audio` and `sampling_rate` arguments to [`~ClvpFeatureExtractor.__call__`] and the `text`
        argument to [`~ClvpTokenizer.__call__`]. Please refer to the doctsring of the above two methods for more
        information.
        Ú
raw_speechNÚsampling_rateÚtextzFYou need to specify either an `raw_speech` or `text` input to process.r   r   )ÚpopÚ
ValueErrorr   r   )r   ÚargsÚkwargsr   r   r   ÚinputsÚ	encodingsr   r   r   Ú__call__1   s    zClvpProcessor.__call__c                 O   ó   | j j|i |¤ŽS )z½
        This method forwards all its arguments to ClvpTokenizer's [`~PreTrainedTokenizer.batch_decode`]. Please
        refer to the docstring of this method for more information.
        )r   Úbatch_decode©r   r   r   r   r   r   r   N   ó   zClvpProcessor.batch_decodec                 O   r   )z·
        This method forwards all its arguments to ClvpTokenizer's [`~PreTrainedTokenizer.decode`]. Please refer to
        the docstring of this method for more information.
        )r   Údecoder   r   r   r   r    V   r   zClvpProcessor.decode)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úfeature_extractor_classÚtokenizer_classÚmodel_input_namesr
   r   r   r    Ú__classcell__r   r   r   r   r      s    r   N)r$   Úprocessing_utilsr   r   r   r   r   r   Ú<module>   s   