o
    ZhU                     @   sj   d Z ddlmZmZ ddlmZmZmZ ddlm	Z	m
Z
mZ G dd dedd	ZG d
d deZdgZdS )z"
Processor class for BridgeTower.
    )ListUnion   )ProcessingKwargsProcessorMixinUnpack)BatchEncodingPreTokenizedInput	TextInputc                	   @   s.   e Zd ZdddddddddddddZdS )BridgeTowerProcessorKwargsTFr   )Zadd_special_tokenspaddingZstrideZreturn_overflowing_tokensZreturn_special_tokens_maskZreturn_offsets_mappingZreturn_lengthverbose)Zdo_normalizeZdo_center_crop)text_kwargsimages_kwargsN)__name__
__module____qualname__	_defaults r   r   e/var/www/auris/lib/python3.10/site-packages/transformers/models/bridgetower/processing_bridgetower.pyr      s    
r   F)totalc                       s   e Zd ZdZddgZdZdZ fddZ			dd	ee	e
ee	 ee
 f d
ee defddZdd Zdd Zedd Z  ZS )BridgeTowerProcessora  
    Constructs a BridgeTower processor which wraps a Roberta tokenizer and BridgeTower image processor into a single
    processor.

    [`BridgeTowerProcessor`] offers all the functionalities of [`BridgeTowerImageProcessor`] and
    [`RobertaTokenizerFast`]. See the docstring of [`~BridgeTowerProcessor.__call__`] and
    [`~BridgeTowerProcessor.decode`] for more information.

    Args:
        image_processor (`BridgeTowerImageProcessor`):
            An instance of [`BridgeTowerImageProcessor`]. The image processor is a required input.
        tokenizer (`RobertaTokenizerFast`):
            An instance of ['RobertaTokenizerFast`]. The tokenizer is a required input.
    image_processor	tokenizerZBridgeTowerImageProcessor)ZRobertaTokenizerZRobertaTokenizerFastc                    s   t  || d S N)super__init__)selfr   r   	__class__r   r   r   @   s   zBridgeTowerProcessor.__init__Ntextkwargsreturnc           	      K   sV   | j tfd| jji|}| jdd|i|d }| j|fi |d }|| |S )a  
        This method uses [`BridgeTowerImageProcessor.__call__`] method to prepare image(s) for the model, and
        [`RobertaTokenizerFast.__call__`] to prepare text for the model.

        Please refer to the docstring of the above two methods for more information.
        Ztokenizer_init_kwargsr    r   r   Nr   )Z_merge_kwargsr   r   Zinit_kwargsr   update)	r   Zimagesr    ZaudioZvideosr!   Zoutput_kwargsencodingZencoding_image_processorr   r   r   __call__C   s   
zBridgeTowerProcessor.__call__c                 O      | j j|i |S )z
        This method forwards all its arguments to RobertaTokenizerFast's [`~PreTrainedTokenizer.batch_decode`]. Please
        refer to the docstring of this method for more information.
        )r   batch_decoder   argsr!   r   r   r   r'   ]      z!BridgeTowerProcessor.batch_decodec                 O   r&   )z
        This method forwards all its arguments to RobertaTokenizerFast's [`~PreTrainedTokenizer.decode`]. Please refer
        to the docstring of this method for more information.
        )r   decoder(   r   r   r   r+   d   r*   zBridgeTowerProcessor.decodec                 C   s"   | j j}| jj}tt|| S r   )r   model_input_namesr   listdictfromkeys)r   Ztokenizer_input_namesZimage_processor_input_namesr   r   r   r,   k   s   z&BridgeTowerProcessor.model_input_names)NNN)r   r   r   __doc__
attributesZimage_processor_classZtokenizer_classr   r   r
   r	   r   r   r   r   r%   r'   r+   propertyr,   __classcell__r   r   r   r   r   ,   s(    
r   N)r0   typingr   r   Zprocessing_utilsr   r   r   Ztokenization_utils_baser   r	   r
   r   r   __all__r   r   r   r   <module>   s   
F