§
    ‚Štjr  ã                   ó˜   — d Z ddlmZmZmZmZmZ ddlmZ ddl	m
Z
 ddlmZ  ej        e¦  «        Zddd	d
œZ G d„ de
¦  «        ZdgZdS )z*Fast Tokenization class for model DeBERTa.é    )Ú
AddedTokenÚ	TokenizerÚdecodersÚpre_tokenizersÚ
processors)ÚBPEé   )ÚTokenizersBackend)Úloggingz
vocab.jsonz
merges.txtztokenizer.json)Ú
vocab_fileÚmerges_fileÚtokenizer_filec                   óÄ   ‡ — e Zd ZdZeZg d¢ZeZ	 	 	 	 	 	 	 	 	 	 	 dde	e
e	ef         z  dz  de	ee	         z  dz  fˆ fd„Zede	fd„¦   «         Zej        d„ ¦   «         Zˆ xZS )ÚDebertaTokenizera™  
    Construct a "fast" DeBERTa tokenizer (backed by HuggingFace's *tokenizers* library). Based on byte-level
    Byte-Pair-Encoding.

    This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will
    be encoded differently whether it is at the beginning of the sentence (without space) or not:

    ```python
    >>> from transformers import DebertaTokenizer

    >>> tokenizer = DebertaTokenizer.from_pretrained("microsoft/deberta-base")
    >>> tokenizer("Hello world")["input_ids"]
    [1, 31414, 232, 2]

    >>> tokenizer(" Hello world")["input_ids"]
    [1, 20920, 232, 2]
    ```

    You can get around that behavior by passing `add_prefix_space=True` when instantiating this tokenizer, but since
    the model was not pretrained this way, it might yield a decrease in performance.

    <Tip>

    When used with `is_split_into_words=True`, this tokenizer needs to be instantiated with `add_prefix_space=True`.

    </Tip>

    This tokenizer inherits from [`PreTrainedTokenizerFast`] which contains most of the main methods. Users should
    refer to this superclass for more information regarding those methods.

    Args:
        vocab_file (`str`, *optional*):
            Path to the vocabulary file.
        merges_file (`str`, *optional*):
            Path to the merges file.
        tokenizer_file (`str`, *optional*):
            The path to a tokenizer file to use instead of the vocab file.
        errors (`str`, *optional*, defaults to `"replace"`):
            Paradigm to follow when decoding bytes to UTF-8. See
            [bytes.decode](https://docs.python.org/3/library/stdtypes.html#bytes.decode) for more information.
        bos_token (`str`, *optional*, defaults to `"[CLS]"`):
            The beginning of sequence token.
        eos_token (`str`, *optional*, defaults to `"[SEP]"`):
            The end of sequence token.
        sep_token (`str`, *optional*, defaults to `"[SEP]"`):
            The separator token, which is used when building a sequence from multiple sequences, e.g. two sequences for
            sequence classification or for a text and a question for question answering. It is also used as the last
            token of a sequence built with special tokens.
        cls_token (`str`, *optional*, defaults to `"[CLS]"`):
            The classifier token which is used when doing sequence classification (classification of the whole sequence
            instead of per-token classification). It is the first token of the sequence when built with special tokens.
        unk_token (`str`, *optional*, defaults to `"[UNK]"`):
            The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
            token instead.
        pad_token (`str`, *optional*, defaults to `"[PAD]"`):
            The token used for padding, for example when batching sequences of different lengths.
        mask_token (`str`, *optional*, defaults to `"[MASK]"`):
            The token used for masking values. This is the token used when training this model with masked language
            modeling. This is the token which the model will try to predict.
        add_prefix_space (`bool`, *optional*, defaults to `False`):
            Whether or not to add an initial space to the input. This allows to treat the leading word just as any
            other word. (Deberta tokenizer detect beginning of words by the preceding space).
    )Ú	input_idsÚattention_maskÚtoken_type_idsNÚreplaceú[CLS]ú[SEP]ú[UNK]ú[PAD]ú[MASK]FÚvocabÚmergesc                 óà  •— || _         |�|nLt          |¦  «        dt          |¦  «        dt          |¦  «        dt          |	¦  «        dt          |
¦  «        di| _        |pg | _        t	          t          | j        | j        d d ddd¬¦  «        ¦  «        | _        d | j        _        t          j	        |¬	¦  «        | j        _
        t          j	        ¦   «         | j        _         t          ¦   «         j        d|||||||	|
|d
œ	|¤Ž t          j        | j        › d| j        › �| j        › d| j        › d| j        › d| j        › �| j        | j        f| j        | j        fg¬¦  «        | j        _        d S )Nr   é   é   r	   é   Ú F)r   r   ÚdropoutÚ	unk_tokenÚcontinuing_subword_prefixÚend_of_word_suffixÚfuse_unk)Úadd_prefix_space)	ÚerrorsÚ	bos_tokenÚ	eos_tokenr"   Ú	sep_tokenÚ	cls_tokenÚ	pad_tokenÚ
mask_tokenr&   z $A ú z $B )ÚsingleÚpairÚspecial_tokens© )r&   ÚstrÚ_vocabÚ_mergesr   r   Ú
_tokenizerÚ
normalizerr   Ú	ByteLevelÚpre_tokenizerr   ÚdecoderÚsuperÚ__init__r   ÚTemplateProcessingr+   r*   Úcls_token_idÚsep_token_idÚpost_processor)Úselfr   r   r'   r(   r)   r*   r+   r"   r,   r-   r&   ÚkwargsÚ	__class__s                €ún/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/transformers/models/deberta/tokenization_deberta.pyr<   zDebertaTokenizer.__init__a   s­  ø€ ð !1ˆÔð Ð ð ˆEõ �I‘” Ý�I‘” Ý�I‘” Ý�I‘” Ý�J‘” ðð 	Œð �| ˆŒå#ÝØ”kØ”|ØØØ*,Ø#%Øðñ ô ñ

ô 

ˆŒð &*ˆŒÔ"å(6Ô(@ÐRbÐ(cÑ(cÔ(cˆŒÔ%Ý"*Ô"4Ñ"6Ô"6ˆŒÔà�‰ŒÔð 	
ØØØØØØØØ!Ø-ð	
ð 	
ð ð	
ð 	
ð 	
õ *4Ô)FØ”nÐ:Ð:¨$¬.Ð:Ð:Ø”NÐ]Ð]¨¬Ð]Ð]¸¼Ð]Ð]ÈTÌ^Ð]Ð]à” Ô!2Ð3Ø” Ô!2Ð3ðð*
ñ *
ô *
ˆŒÔ&Ð&Ð&ó    Úreturnc                 ó~   — | j         €#| j        rt                               d¦  «         dS t	          | j         ¦  «        S )a?  
        `str`: Mask token, to use when training a model with masked-language modeling. Log an error if used while not
        having been set.

        Deberta tokenizer has a special mask token to be used in the fill-mask pipeline. The mask token will greedily
        comprise the space before the *[MASK]*.
        Nz(Using mask_token, but it is not set yet.)Ú_mask_tokenÚverboseÚloggerÚerrorr3   )rA   s    rD   r-   zDebertaTokenizer.mask_token¦   sA   € ð ÔÐ#ØŒ|ð IÝ—’ÐGÑHÔHÐHØ�4Ý�4Ô#Ñ$Ô$Ð$rE   c                 óf   — t          |t          ¦  «        rt          |dd¬¦  «        n|}|| _        dS )zg
        Overriding the default behavior of the mask token to have it eat the space before it.
        TF)ÚlstripÚrstripN)Ú
isinstancer3   r   rH   )rA   Úvalues     rD   r-   zDebertaTokenizer.mask_tokenµ   s>   € õ AKÈ5ÕRUÑ@VÔ@VÐa•
˜5¨°eÐ<Ñ<Ô<Ð<Ð\aˆØ ˆÔÐÐrE   )NNr   r   r   r   r   r   r   r   F)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚVOCAB_FILES_NAMESÚvocab_files_namesÚmodel_input_namesr   Úmodelr3   ÚdictÚintÚlistr<   Úpropertyr-   ÚsetterÚ__classcell__)rC   s   @rD   r   r      s
  ø€ € € € € ð>ð >ð@ *ÐØIÐIÐIÐØ€Eð .2Ø)-ØØØØØØØØØðC
ð C
à�T˜#˜s˜(”^Ñ# dÑ*ðC
ð �d˜3”i‘ $Ñ&ðC
ð C
ð C
ð C
ð C
ð C
ðJ ð%˜Cð %ð %ð %ñ „Xð%ð Ôð!ð !ñ Ôð!ð !ð !ð !ð !rE   r   N)rT   Ú
tokenizersr   r   r   r   r   Útokenizers.modelsr   Útokenization_utils_tokenizersr
   Úutilsr   Ú
get_loggerrQ   rJ   rU   r   Ú__all__r2   rE   rD   ú<module>re      sÔ   ðð 1Ð 0à RÐ RÐ RÐ RÐ RÐ RÐ RÐ RÐ RÐ RÐ RÐ RÐ RÐ RØ !Ð !Ð !Ð !Ð !Ð !à >Ð >Ð >Ð >Ð >Ð >Ø Ð Ð Ð Ð Ð ð 
ˆÔ	˜HÑ	%Ô	%€à#/ÀÐ`pÐqÐqÐ ða!ð a!ð a!ð a!ð a!Ð(ñ a!ô a!ð a!ðH Ð
€€€rE   