
    fTh                     t    S r SSKrSSKJrJrJr  SSKJr  SSKJ	r	J
r
JrJrJr  SSKJr   " S S	\5      rS	/rg)
z
Processor class for ViLT.
    N)ListOptionalUnion   )ProcessorMixin)BatchEncodingPaddingStrategyPreTokenizedInput	TextInputTruncationStrategy)
TensorTypec            "       B  ^  \ rS rSrSrSS/rSrSrSU 4S jjr               S S\	\
\\\
   \\   4   S	\S
\	\\\4   S\	\\\4   S\\   S\S\\   S\\   S\\   S\S\S\S\S\S\\	\\4      S\4 S jjrS rS r\S 5       r\S 5       r\S 5       rSrU =r$ )!ViltProcessor   aQ  
Constructs a ViLT processor which wraps a BERT tokenizer and ViLT image processor into a single processor.

[`ViltProcessor`] offers all the functionalities of [`ViltImageProcessor`] and [`BertTokenizerFast`]. See the
docstring of [`~ViltProcessor.__call__`] and [`~ViltProcessor.decode`] for more information.

Args:
    image_processor (`ViltImageProcessor`, *optional*):
        An instance of [`ViltImageProcessor`]. The image processor is a required input.
    tokenizer (`BertTokenizerFast`, *optional*):
        An instance of ['BertTokenizerFast`]. The tokenizer is a required input.
image_processor	tokenizerViltImageProcessor)BertTokenizerBertTokenizerFastc                    > S nSU;   a,  [         R                  " S[        5        UR                  S5      nUb  UOUnUc  [	        S5      eUc  [	        S5      e[
        TU ]  X5        U R                  U l        g )Nfeature_extractorzhThe `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor` instead.z)You need to specify an `image_processor`.z"You need to specify a `tokenizer`.)	warningswarnFutureWarningpop
ValueErrorsuper__init__r   current_processor)selfr   r   kwargsr   	__class__s        `/var/www/auris/envauris/lib/python3.13/site-packages/transformers/models/vilt/processing_vilt.pyr   ViltProcessor.__init__-   s     &(MM
 !'

+> ?-<-H/N_"HIIABB4!%!5!5    textadd_special_tokenspadding
truncation
max_lengthstridepad_to_multiple_ofreturn_token_type_idsreturn_attention_maskreturn_overflowing_tokensreturn_special_tokens_maskreturn_offsets_mappingreturn_lengthverbosereturn_tensorsreturnc                     U R                   " SUUUUUUUU	U
UUUUUUS.UD6nU R                  UUS9nUR                  U5        U$ )z
This method uses [`ViltImageProcessor.__call__`] method to prepare image(s) for the model, and
[`BertTokenizerFast.__call__`] to prepare text for the model.

Please refer to the docstring of the above two methods for more information.
)r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   )r4    )r   r   update)r    imagesr&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r!   encodingencoding_image_processors                       r#   __call__ViltProcessor.__call__@   sx    4 >> 
1!!1"7"7&?'A#9')
  !
& $(#7#7~#7#^ 01r%   c                 :    U R                   R                  " U0 UD6$ )z
This method forwards all its arguments to BertTokenizerFast's [`~PreTrainedTokenizer.batch_decode`]. Please
refer to the docstring of this method for more information.
)r   batch_decoder    argsr!   s      r#   r?   ViltProcessor.batch_decoder   s    
 ~~**D;F;;r%   c                 :    U R                   R                  " U0 UD6$ )z
This method forwards all its arguments to BertTokenizerFast's [`~PreTrainedTokenizer.decode`]. Please refer to
the docstring of this method for more information.
)r   decoder@   s      r#   rD   ViltProcessor.decodey   s    
 ~~$$d5f55r%   c                     U R                   R                  nU R                  R                  n[        [        R                  X-   5      5      $ )N)r   model_input_namesr   listdictfromkeys)r    tokenizer_input_namesimage_processor_input_namess      r#   rG   ViltProcessor.model_input_names   s<     $ @ @&*&:&:&L&L#DMM"7"UVWWr%   c                 P    [         R                  " S[        5        U R                  $ )Nzg`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead.)r   r   r   image_processor_classr    s    r#   feature_extractor_class%ViltProcessor.feature_extractor_class   s"    u	
 )))r%   c                 P    [         R                  " S[        5        U R                  $ )Nz[`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead.)r   r   r   r   rP   s    r#   r   ViltProcessor.feature_extractor   s"    i	
 ###r%   )r   )NN)NTFNNr   NNNFFFFTN)__name__
__module____qualname____firstlineno____doc__
attributesrO   tokenizer_classr   r   r   r
   r   boolstrr	   r   r   intr   r   r<   r?   rD   propertyrG   rQ   r   __static_attributes____classcell__)r"   s   @r#   r   r      s    $[1J0<O6, _c#'5:;?$(,00404*/+0',#;?#0 I0$y/4HYCZZ[0 !	0
 tS/120 $%7780 SM0 0 %SM0  (~0  (~0 $(0 %)0 !%0 0  !0" !sJ!78#0& 
'0d<6 X X
 * * $ $r%   r   )rY   r   typingr   r   r   processing_utilsr   tokenization_utils_baser   r	   r
   r   r   utilsr   r   __all__r7   r%   r#   <module>rg      s:     ( ( . w w y$N y$x 
r%   