a
    ½Àhú
  ã                   @   s*   d Z ddlmZ G dd„ deƒZdgZdS )z
Processor class for CLVP
é   )ÚProcessorMixinc                       s8   e Zd ZdZdZdZg d¢Z‡ f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.
    ZClvpFeatureExtractorZClvpTokenizer)Ú	input_idsZinput_featuresÚattention_maskc                    s   t ƒ  ||¡ d S )N)ÚsuperÚ__init__)ÚselfÚfeature_extractorÚ	tokenizer©Ú	__class__© úd/var/www/html/assistant/venv/lib/python3.9/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rZ| j|fd|i|¤Ž}|durt| j|fi |¤Ž}|du r€|S |du rŒ|S |d |d< |d |d< |S dS )zÿ
        Forwards the `audio` and `sampling_rate` arguments to [`~ClvpFeatureExtractor.__call__`] and the `text`
        argument to [`~ClvpTokenizer.__call__`]. Please refer to the docstring 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__0   s     zClvpProcessor.__call__)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__Zfeature_extractor_classZtokenizer_classZmodel_input_namesr   r   Ú__classcell__r   r   r   r   r      s   r   N)r   Zprocessing_utilsr   r   Ú__all__r   r   r   r   Ú<module>   s   6