
    sga                     f    d Z ddlmZmZ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y	)
z
Processor class for Bros.
    )ListOptionalUnion   )ProcessorMixin)BatchEncodingPaddingStrategyPreTokenizedInput	TextInputTruncationStrategy)
TensorTypec            "           e Zd ZdZdgZdZd fd	Z	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd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dededededeeeef      def dZd Zd Zed        Z xZS )BrosProcessora  
    Constructs a Bros processor which wraps a BERT tokenizer.

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

    Args:
        tokenizer (`BertTokenizerFast`, *optional*):
            An instance of ['BertTokenizerFast`]. The tokenizer is a required input.
    	tokenizer)BertTokenizerBertTokenizerFastc                 >    |t        d      t        | 	  |       y )Nz"You need to specify a `tokenizer`.)
ValueErrorsuper__init__)selfr   kwargs	__class__s      [/var/www/html/venv/lib/python3.12/site-packages/transformers/models/bros/processing_bros.pyr   zBrosProcessor.__init__)   s"    ABB#    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                 J     | j                   d|||||||||	|
|||||d|}|S )z
        This method uses [`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%   r&   r'   r(   r)   r*    )r   )r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r   encodings                     r   __call__zBrosProcessor.__call__/   sW    0 "4>> 
1!!1"7"7&?'A#9')
  !
& r   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   r1   zBrosProcessor.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   decoder2   s      r   r5   zBrosProcessor.decodec   s     
 %t~~$$d5f55r   c                 j    | j                   j                  }t        t        j	                  |            S N)r   model_input_nameslistdictfromkeys)r   tokenizer_input_namess     r   r8   zBrosProcessor.model_input_namesj   s'     $ @ @DMM"7899r   r7   )NTFNNr   NNNFFFFTN)__name__
__module____qualname____doc__
attributestokenizer_classr   r   r   r
   r   boolstrr	   r   r   intr   r   r/   r1   r5   propertyr8   __classcell__)r   s   @r   r   r      s^   	 J<O$ _c#'5:;?$(,00404*/+0',#;?!+I0$y/4HYCZZ[+ !+ tS/12	+
 $%778+ SM+ + %SM+  (~+  (~+ $(+ %)+ !%+ + +  !sJ!78!+$ 
%+Z<6 : :r   r   N)r@   typingr   r   r   processing_utilsr   tokenization_utils_baser   r	   r
   r   r   utilsr   r   r-   r   r   <module>rL      s,    ) ( . w w S:N S:r   