Ë
    S^(hÏ  ã                   ó€   — d Z ddlZddlmZmZmZ ddlmZ ddlm	Z	 ddl
mZmZmZmZmZ ddlmZ  G d	„ d
e	«      Zd
gZy)z&
Image/Text processor class for FLAVA
é    N)ÚListÚOptionalÚUnioné   )Ú
ImageInput)ÚProcessorMixin)ÚBatchEncodingÚPaddingStrategyÚPreTokenizedInputÚ	TextInputÚTruncationStrategy)Ú
TensorTypec            (       óX  ‡ — e Zd ZdZddgZdZdZdˆ fd„	Z	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d dee	   dee
eeee   ee   f      d	ed
e
eeef   de
eeef   dee   dedee   dee   dee   dee   dee   dedededededee
eef      f$d„Zd„ Zd„ Zed„ «       Zed„ «       Zed„ «       Zˆ xZS )!ÚFlavaProcessora  
    Constructs a FLAVA processor which wraps a FLAVA image processor and a FLAVA tokenizer into a single processor.

    [`FlavaProcessor`] offers all the functionalities of [`FlavaImageProcessor`] and [`BertTokenizerFast`]. See the
    [`~FlavaProcessor.__call__`] and [`~FlavaProcessor.decode`] for more information.

    Args:
        image_processor ([`FlavaImageProcessor`], *optional*): The image processor is a required input.
        tokenizer ([`BertTokenizerFast`], *optional*): The tokenizer is a required input.
    Úimage_processorÚ	tokenizerÚFlavaImageProcessor)ÚBertTokenizerÚBertTokenizerFastc                 óê   •— d }d|v r+t        j                  dt        «       |j                  d«      }|�|n|}|€t	        d«      ‚|€t	        d«      ‚t
        ‰| �  ||«       | j                  | _        y )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        €úh/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/transformers/models/flava/processing_flava.pyr   zFlavaProcessor.__init__,   s…   ø€ Ø ÐØ &Ñ(Ü�M‰Mðäôð
 !'§
¡
Ð+>Ó ?Ðà-<Ð-H™/ÐN_ˆØÐ"ÜÐHÓIÐIØÐÜÐAÓBÐBä‰Ñ˜¨)Ô4Ø!%×!5Ñ!5ˆÕó    ÚimagesÚtextÚadd_special_tokensÚpaddingÚ
truncationÚ
max_lengthÚstrideÚpad_to_multiple_ofÚreturn_image_maskÚreturn_codebook_pixelsÚreturn_token_type_idsÚreturn_attention_maskÚreturn_overflowing_tokensÚreturn_special_tokens_maskÚreturn_offsets_mappingÚreturn_lengthÚverboseÚreturn_tensorsc                 óü   — |€|€t        d«      ‚|�" | j                  d|||||||||||||||dœ|¤Ž}|� | j                  |f|	|
|dœ|¤Ž}|�|�j                  «       |S |�S t	        t        di ¤Ž|¬«      S )a  
        This method uses [`FlavaImageProcessor.__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.
        z?You have to specify either text or images. Both cannot be none.)r&   r'   r(   r)   r*   r+   r,   r/   r0   r1   r2   r3   r4   r5   r6   )r-   r.   r6   )ÚdataÚtensor_type© )r   r   r   Úupdater	   Údict)r    r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r!   ÚencodingÚimage_featuress                         r#   Ú__call__zFlavaProcessor.__call__?   sÞ   € ð: ˆ<˜F˜NÜÐ^Ó_Ð_àÐØ%�t—~‘~ð ØØ#5ØØ%Ø%ØØ#5Ø&;Ø&;Ø*CØ+EØ'=Ø+ØØ-ñð  ñ!ˆHð$ ÐØ1˜T×1Ñ1Øðà"3Ø'=Ø-ñ	ð
 ñˆNð Ð Ð 2Ø�O‰O˜NÔ+ØˆOØÐØˆOä ¤dÑ&<¨^Ñ&<È.ÔYÐYr$   c                 ó:   —  | j                   j                  |i |¤ŽS )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#   rA   zFlavaProcessor.batch_decodeƒ   s    € ð
 +ˆt�~‰~×*Ñ*¨DÐ;°FÑ;Ð;r$   c                 ó:   —  | j                   j                  |i |¤ŽS )z»
        This method forwards all its arguments to BertTokenizerFast's [`~PreTrainedTokenizer.decode`]. Please refer to
        the docstring of this method for more information.
        )r   ÚdecoderB   s      r#   rE   zFlavaProcessor.decodeŠ   s    € ð
 %ˆt�~‰~×$Ñ$ dÐ5¨fÑ5Ð5r$   c                 óœ   — | j                   j                  }| j                  j                  }t        t        j                  ||z   «      «      S )N)r   Úmodel_input_namesr   Úlistr<   Úfromkeys)r    Útokenizer_input_namesÚimage_processor_input_namess      r#   rG   z FlavaProcessor.model_input_names‘   s?   € à $§¡× @Ñ @ÐØ&*×&:Ñ&:×&LÑ&LÐ#Ü”D—M‘MÐ"7Ð:UÑ"UÓVÓWÐWr$   c                 óN   — t        j                  dt        «       | j                  S )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_classz&FlavaProcessor.feature_extractor_class—   s"   € ä�‰ØuÜô	
ð ×)Ñ)Ð)r$   c                 óN   — t        j                  dt        «       | j                  S )Nz[`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead.)r   r   r   r   rN   s    r#   r   z FlavaProcessor.feature_extractorŸ   s"   € ä�‰ØiÜô	
ð ×#Ñ#Ð#r$   )NN)NNTFFNr   NNNNNFFFFTN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú
attributesrM   Útokenizer_classr   r   r   r   r   r   r   ÚboolÚstrr
   r   Úintr   r?   rA   rE   ÚpropertyrG   rO   r   Ú__classcell__)r"   s   @r#   r   r      sä  ø„ ñ	ð $ [Ð1€JØ1ÐØ<€Oõ6ð* (,ØhlØ#'Ø5:Ø;@Ø$(ØØ,0Ø,0Ø15Ø04Ø04Ø*/Ø+0Ø',Ø#ØØ;?ñ'BZà˜Ñ$ðBZð �u˜YÐ(9¸4À	¹?ÈDÐQbÑLcÐcÑdÑeðBZð !ð	BZð
 �t˜S /Ð1Ñ2ðBZð ˜$ Ð%7Ð7Ñ8ðBZð ˜S‘MðBZð ðBZð % S™MðBZð $ D™>ðBZð !)¨¡ðBZð  (¨™~ðBZð  (¨™~ðBZð $(ðBZð %)ðBZð  !%ð!BZð" ð#BZð$ ð%BZð& !  s¨J Ñ!7Ñ8ó'BZòH<ò6ð ñXó ðXð
 ñ*ó ð*ð ñ$ó ô$r$   r   )rT   r   Útypingr   r   r   Úimage_utilsr   Úprocessing_utilsr   Útokenization_utils_baser	   r
   r   r   r   Úutilsr   r   Ú__all__r:   r$   r#   ú<module>rb      s=   ðñó ß (Ñ (å %Ý .ß wÕ wÝ ôI$�^ô I$ðX Ð
�r$   