U
    ,-e                     @   s$   d Z ddlmZ G dd deZdS )z
Processor class for TVLT.
   )ProcessorMixinc                       sF   e Zd ZdZddgZdZdZ fddZdd
dZe	dd Z
  ZS )TvltProcessora`  
    Constructs a TVLT processor which wraps a TVLT image processor and TVLT feature extractor into a single processor.

    [`TvltProcessor`] offers all the functionalities of [`TvltImageProcessor`] and [`TvltFeatureExtractor`]. See the
    docstring of [`~TvltProcessor.__call__`] for more information.

    Args:
        image_processor (`TvltImageProcessor`):
            An instance of [`TvltImageProcessor`]. The image processor is a required input.
        feature_extractor (`TvltFeatureExtractor`):
            An instance of [`TvltFeatureExtractor`]. The feature extractor is a required input.
    image_processorfeature_extractorZTvltImageProcessorZTvltFeatureExtractorc                    s    t  j||d || _|| _d S )N)r   r   )super__init__r   r   )selfr   r   	__class__ i/var/www/html/Darija-Ai-Train/env/lib/python3.8/site-packages/transformers/models/tvlt/processing_tvlt.pyr   '   s    zTvltProcessor.__init__NFc                 O   s   |dkr|dkrt dd}	|dk	r>| j|f|d|i|}
|dk	r`| j|f|ddi|}	|dk	r| j|f|||d|}i }|dk	r|| |dk	r||
 |	dk	r||	 |S )a  
        Forwards the `images` argument to TvltImageProcessor's [`~TvltImageProcessor.preprocess`] and the `audio`
        argument to TvltFeatureExtractor's [`~TvltFeatureExtractor.__call__`]. Please refer to the docstring of the
        above two methods for more information.
        NzCYou need to specify either an `images` or `audio` input to process.
mask_pixelZis_mixedT)sampling_rate
mask_audio)
ValueErrorr   r   update)r   ZimagesZaudioZimages_mixedr   r   r   argskwargsZimages_mixed_dictZimages_dictZ
audio_dictZoutput_dictr   r   r   __call__-   s4     


zTvltProcessor.__call__c                 C   s"   | j j}| jj}tt|| S )N)r   model_input_namesr   listdictfromkeys)r   Zimage_processor_input_namesZfeature_extractor_input_namesr   r   r   r   T   s    zTvltProcessor.model_input_names)NNNNFF)__name__
__module____qualname____doc__
attributesZimage_processor_classZfeature_extractor_classr   r   propertyr   __classcell__r   r   r	   r   r      s         
'r   N)r   Zprocessing_utilsr   r   r   r   r   r   <module>   s   