U
    ,-e                  p   @   s  d Z ddlZddlZddlZddlZddlZddlmZmZm	Z	 ddl
mZ ddlmZ eeZddd	Zd
dddddddddd
ddddddddddd
d	Zddddddddddd
Zd d!id!d"d#d$dd%d&d'd!d#d(d$dd%d)d'd!d#d*d$dd%d+d'd!d,d-d"d.d#d/d(d0d1d2d3d4d5d6d7d8dd%d9dd:d;d<d=d>d?d@dAdBdCdDdEd'd!d,d-d"d.d#d/d(d0d1d2d3d4d5d6d7d8dd%d9dd:d;d<d=d>d?d@dAdBdCdDdEd'd!d#d(d$dd%d)d'd!d"d#d$dd%d&d'dFd,d"d#d/d(d0dGdHdIdJdKdLd1dMd4d6d7dNdd%d9dd:d;d<d=d>d?d@dAdBdCdDdOdPdQd'dFdRdSdTdUdVd,dWdXdYdZd[d-d\d]d^d_d`dadbdcddd"d.d#ded/dfdgdhdid(djdkdldmdndod0dpdqdrdsdtdudGdHdvdwdxdydIdzd{d|d}d~dddddddddJddddKdLd*d1ddddddddddMd2ddd3dd4ddd5dd6dddd7ddddddd%d9dd:d;d<d=d>d?d@dAdBdCdDdOdPdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd'd
Zdd Zdd Zdd Zdd Zdd ZG dd deZdS (   zTokenization classes for XLM.    N)ListOptionalTuple   )PreTrainedTokenizer)loggingz
vocab.jsonz
merges.txt)
vocab_filemerges_filez>https://huggingface.co/xlm-mlm-en-2048/resolve/main/vocab.jsonz@https://huggingface.co/xlm-mlm-ende-1024/resolve/main/vocab.jsonz@https://huggingface.co/xlm-mlm-enfr-1024/resolve/main/vocab.jsonz@https://huggingface.co/xlm-mlm-enro-1024/resolve/main/vocab.jsonzFhttps://huggingface.co/xlm-mlm-tlm-xnli15-1024/resolve/main/vocab.jsonzBhttps://huggingface.co/xlm-mlm-xnli15-1024/resolve/main/vocab.jsonz@https://huggingface.co/xlm-clm-enfr-1024/resolve/main/vocab.jsonz@https://huggingface.co/xlm-clm-ende-1024/resolve/main/vocab.jsonz>https://huggingface.co/xlm-mlm-17-1280/resolve/main/vocab.jsonz?https://huggingface.co/xlm-mlm-100-1280/resolve/main/vocab.json)
zxlm-mlm-en-2048zxlm-mlm-ende-1024zxlm-mlm-enfr-1024zxlm-mlm-enro-1024zxlm-mlm-tlm-xnli15-1024zxlm-mlm-xnli15-1024zxlm-clm-enfr-1024zxlm-clm-ende-1024zxlm-mlm-17-1280zxlm-mlm-100-1280z>https://huggingface.co/xlm-mlm-en-2048/resolve/main/merges.txtz@https://huggingface.co/xlm-mlm-ende-1024/resolve/main/merges.txtz@https://huggingface.co/xlm-mlm-enfr-1024/resolve/main/merges.txtz@https://huggingface.co/xlm-mlm-enro-1024/resolve/main/merges.txtzFhttps://huggingface.co/xlm-mlm-tlm-xnli15-1024/resolve/main/merges.txtzBhttps://huggingface.co/xlm-mlm-xnli15-1024/resolve/main/merges.txtz@https://huggingface.co/xlm-clm-enfr-1024/resolve/main/merges.txtz@https://huggingface.co/xlm-clm-ende-1024/resolve/main/merges.txtz>https://huggingface.co/xlm-mlm-17-1280/resolve/main/merges.txtz?https://huggingface.co/xlm-mlm-100-1280/resolve/main/merges.txti   do_lowercase_and_remove_accentTdeen)r      r   )r   r   )r
   id2langlang2idfr)r   r   ro)r   r   arbgeleshiruswthtrurvizh)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   Fitjakonlplptsv)r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)         r1   r2   )r   r   r   r   r   r   r*   r+   r,   r-   r.   r/   r   r0   r   r   r   afalsamanangarzastazbarbebnbrbscacebckbcscydaeoeteufafifygaganglguhehrhuhyiaidisjvkakkknkulalbltlvmkmlmnmrmsmyndsnennnoocscnscoshsisimpleskslsqsrtatetlttukuzwarwuuyizh_classical
zh_min_nanzh_yue)dr   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r1   r2                                                    !   "   #   $   %   &   '   (   )   *   +   ,   -   .   /   0   1   2   3   4   5   6   7   8   9   :   ;   <   =   >   ?   @   A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Y   Z   [   \   ]   ^   _   `   a   b   c   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   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   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )dr3   r4   r5   r6   r7   r   r8   r9   r:   r;   r<   r   r=   r>   r?   r@   rA   rB   rC   rD   rE   r   r   r   rF   r   rG   rH   rI   rJ   r   rK   rL   rM   rN   rO   rP   r   rQ   rR   rS   rT   rU   rV   r*   r+   rW   rX   rY   rZ   r,   r[   r\   r]   r^   r_   r`   ra   rb   rc   rd   re   rf   rg   r-   rh   ri   rj   r.   r/   r   r   rk   rl   rm   rn   ro   rp   rq   rr   rs   r0   r   rt   ru   r   rv   r   rw   rx   r   ry   r   rz   r{   r|   r   r}   r~   r   c                 C   s6   t  }| d }| dd D ]}|||f |}q|S )z
    Return set of symbol pairs in a word. word is represented as tuple of symbols (symbols being variable-length
    strings)
    r   r   N)setadd)wordpairsZ	prev_charchar r   i/var/www/html/Darija-Ai-Train/env/lib/python3.8/site-packages/transformers/models/xlm/tokenization_xlm.py	get_pairs  s    r   c                 C   s^   d | } |  } td| } g }| D ]"}t|}|dkr>q&|| q&d | dS )z
    Lowercase and strips accents from a piece of text based on
    https://github.com/facebookresearch/XLM/blob/master/tools/lowercase_and_remove_accent.py
     ZNFDZMn )joinlowerunicodedata	normalizecategoryappendsplittextoutputr   catr   r   r   lowercase_and_remove_accent  s    

r   c                 C   s  |  dd} tdd| } |  dd} |  dd} |  dd} |  d	d
} |  dd
} |  dd} |  dd} |  dd} |  dd} |  dd} |  dd} |  dd} |  dd} |  dd} |  dd} |  dd} |  dd} |  d d!} |  d"d#} |  d$d%} |  d&d'} |  d(d)} |  d*d+} |  d,d-} td.d| } |  d/d0} |  d1d2} |  d3d4} |  d5d6} |  d7d8} |  d9d:} |  d;d<} |  d=d>} |  d?d@} | S )Azz
    Port of https://github.com/moses-smt/mosesdecoder/blob/master/scripts/tokenizer/replace-unicode-punctuation.perl
    u   ，,u   。\s*z. u   、u   ”"u   “u   ∶:u   ：u   ？?u   《u   》u   ）)u   ！!u   （(u   ；;u   １1u   」u   「u   ０0u   ３3u   ２2u   ５5u   ６6u   ９9u   ７7u   ８8u   ４4u   ．\s*u   ～~u   ’'u   …z...u   ━-u   〈<u   〉>u   【[u   】]u   ％%)replaceresubr   r   r   r   replace_unicode_punct  sJ    r  c                 C   s8   g }| D ]$}t |}|dr"q|| qd|S )zw
    Port of https://github.com/moses-smt/mosesdecoder/blob/master/scripts/tokenizer/remove-non-printing-char.perl
    Cr   )r   r   
startswithr   r   r   r   r   r   remove_non_printing_char  s    

r
  c                 C   s   |  dd dd} |  dd dd} |  dd	 dd
} |  dd dd} |  dd dd} |  dd dd} |  dd dd} | S )zVSennrich's WMT16 scripts for Romanian preprocessing, used by model `xlm-mlm-enro-1024`u   Şu   Șu   şu   șu   Ţu   Țu   ţu   țSsTtu   ĂAu   ăa   Â   â   ÎI   îi)r  r  r   r   r   romanian_preprocessing  s    r  c                       sb  e Zd ZdZeZeZeZ	e
Zdddddddddd	d
dddddg
dddf
 fdd	Zedd Zdd Zdd Zdd Zdd Zedd Zd d! Zd"d# Zd=d&d'Zd(d) Zd*d+ Zd,d- Zd>ee eee  ee d.d/d0Zd?ee eee  eee d1 fd2d3Zd@ee eee  ee d.d4d5Z dAe!ee! e"e! d6d7d8Z#d9d: Z$d;d< Z%  Z&S )BXLMTokenizeraK  
    Construct an XLM tokenizer. Based on Byte-Pair Encoding. The tokenization process is the following:

    - Moses preprocessing and tokenization for most supported languages.
    - Language specific tokenization for Chinese (Jieba), Japanese (KyTea) and Thai (PyThaiNLP).
    - Optionally lowercases and normalizes all inputs text.
    - The arguments `special_tokens` and the function `set_special_tokens`, can be used to add additional symbols (like
      "__classify__") to a vocabulary.
    - The `lang2id` attribute maps the languages supported by the model with their IDs if provided (automatically set
      for pretrained vocabularies).
    - The `id2lang` attributes does reverse mapping if provided (automatically set for pretrained vocabularies).

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

    Args:
        vocab_file (`str`):
            Vocabulary file.
        merges_file (`str`):
            Merges file.
        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.
        bos_token (`str`, *optional*, defaults to `"<s>"`):
            The beginning of sequence token that was used during pretraining. Can be used a sequence classifier token.

            <Tip>

            When building a sequence using special tokens, this is not the token that is used for the beginning of
            sequence. The token used is the `cls_token`.

            </Tip>

        sep_token (`str`, *optional*, defaults to `"</s>"`):
            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.
        pad_token (`str`, *optional*, defaults to `"<pad>"`):
            The token used for padding, for example when batching sequences of different lengths.
        cls_token (`str`, *optional*, defaults to `"</s>"`):
            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.
        mask_token (`str`, *optional*, defaults to `"<special1>"`):
            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.
        additional_special_tokens (`List[str]`, *optional*, defaults to `["<special0>","<special1>","<special2>","<special3>","<special4>","<special5>","<special6>","<special7>","<special8>","<special9>"]`):
            List of additional special tokens.
        lang2id (`Dict[str, int]`, *optional*):
            Dictionary mapping languages string identifiers to their IDs.
        id2lang (`Dict[int, str]`, *optional*):
            Dictionary mapping language IDs to their string identifiers.
        do_lowercase_and_remove_accent (`bool`, *optional*, defaults to `True`):
            Whether to lowercase and remove accents when tokenizing.
    z<unk>z<s>z</s>z<pad>z
<special1>z
<special0>z
<special2>z
<special3>z
<special4>z
<special5>z
<special6>z
<special7>z
<special8>z
<special9>NTc                    sJ  zdd l }W n tk
r(   tdY nX || _i | _i | _dddh| _|| _|
| _|| _|
d k	r~|d k	r~t	|
t	|ks~t
d | _d | _t|dd}t|| _W 5 Q R X dd	 | j D | _t|dd}| d
d d }W 5 Q R X dd |D }tt|tt	|| _i | _t jf |||||||	|
||d
| d S )Nr   nYou need to install sacremoses to use XLMTokenizer. See https://pypi.org/project/sacremoses/ for installation.r   r   r+   utf-8encodingc                 S   s   i | ]\}}||qS r   r   ).0kvr   r   r   
<dictcomp>  s      z)XLMTokenizer.__init__.<locals>.<dictcomp>
c                 S   s    g | ]}t | d d qS )Nr   )tupler   )r  merger   r   r   
<listcomp>  s     z)XLMTokenizer.__init__.<locals>.<listcomp>)
	unk_token	bos_token	sep_token	pad_token	cls_token
mask_tokenadditional_special_tokensr   r   r
   )
sacremosesImportErrorsmcache_moses_punct_normalizercache_moses_tokenizerlang_with_custom_tokenizerr
   r   r   lenAssertionErrorja_word_tokenizerZzh_word_tokenizeropenjsonloadencoderitemsdecoderreadr   dictziprange	bpe_rankscachesuper__init__)selfr   r	   r&  r'  r(  r)  r*  r+  r,  r   r   r
   kwargsr-  Zvocab_handleZmerges_handleZmerges	__class__r   r   rC  M  sN    
 zXLMTokenizer.__init__c                 C   s   | j S N)r
   rD  r   r   r   do_lower_case  s    zXLMTokenizer.do_lower_casec                 C   s8   || j kr$| jj|d}|| j |< n
| j | }||S )Nlang)r0  r/  ZMosesPunctNormalizerr   )rD  r   rL  Zpunct_normalizerr   r   r   moses_punct_norm  s
    

zXLMTokenizer.moses_punct_normc                 C   s>   || j kr$| jj|d}|| j |< n
| j | }|j|dddS )NrK  F)Z
return_strescape)r1  r/  ZMosesTokenizertokenize)rD  r   rL  Zmoses_tokenizerr   r   r   moses_tokenize  s
    

zXLMTokenizer.moses_tokenizec                 C   s    t |}| ||}t|}|S rH  )r  rM  r
  )rD  r   rL  r   r   r   moses_pipeline  s    zXLMTokenizer.moses_pipelinec              	   C   s   | j d krz(dd l}|dtjd d| _ W nV ttfk
r   td td td td td	 td
  Y nX t	| j 
|S )Nr   z-model r   z/local/share/kytea/model.binzMake sure you install KyTea (https://github.com/neubig/kytea) and it's python wrapper (https://github.com/chezou/Mykytea-python) with the following stepsz81. git clone git@github.com:neubig/kytea.git && cd kyteaz2. autoreconf -iz#3. ./configure --prefix=$HOME/localz4. make && make installz5. pip install kytea)r5  Mykyteaospath
expanduserAttributeErrorr.  loggererrorlistZgetWS)rD  r   rR  r   r   r   ja_tokenize  s"    






zXLMTokenizer.ja_tokenizec                 C   s
   t | jS rH  )r3  r9  rI  r   r   r   
vocab_size  s    zXLMTokenizer.vocab_sizec                 C   s   t | jf| jS rH  )r=  r9  Zadded_tokens_encoderrI  r   r   r   	get_vocab  s    zXLMTokenizer.get_vocabc           
         s  t |d d |d d f }| jkr2 j| S t|}|sF|d S t| fddd}| jkrhqf|\}}g }d}|t|k r<z|||}	W n, tk
r   |||d   Y q<Y nX ||||	  |	}|| |kr$|t|d k r$||d  |kr$|	||  |d7 }qx|	||  |d7 }qxt |}|}t|dkr\qfqFt|}qFd	
|}|d
kr~d}| j|< |S )Nr"  </w>c                    s    j | tdS )Ninf)r@  getfloat)pairrI  r   r   <lambda>      z"XLMTokenizer.bpe.<locals>.<lambda>keyr   r   r   r   z
  </w>z
</w>)r#  rA  r   minr@  r3  index
ValueErrorextendr   r   )
rD  tokenr   r   ZbigramfirstsecondZnew_wordr  jr   rI  r   bpe  sF    


2





zXLMTokenizer.bper   Fc              	   C   s  |r| j r|| j krtd |r.| }nf|| jkrh| j||d}|dkrVt|}| j||d}n,|dkr| j||d}z(dtj	krddl
m} ntj	d j}W n. ttfk
r   td td	  Y nX ||}n|d
krhz$dtj	krddl}n
tj	d }W n0 ttfk
r>   td td  Y nX d||}| j||d}| }n,|dkr| j||d}| |}ntd| jr|st|}g }|D ]&}|r|t| |d q|S )a  
        Tokenize a string given language code. For Chinese, Japanese and Thai, we use a language specific tokenizer.
        Otherwise, we use Moses.

        Details of tokenization:

            - [sacremoses](https://github.com/alvations/sacremoses): port of Moses
            - Install with `pip install sacremoses`
            - [pythainlp](https://github.com/PyThaiNLP/pythainlp): Thai tokenizer
            - Install with `pip install pythainlp`
            - [kytea](https://github.com/chezou/Mykytea-python): Japanese tokenizer, wrapper of
              [KyTea](https://github.com/neubig/kytea)
            - Install with the following steps:

            ::

                git clone git@github.com:neubig/kytea.git && cd kytea autoreconf -i ./configure --prefix=$HOME/local
                make && make install pip install kytea

            - [jieba](https://github.com/fxsjy/jieba): Chinese tokenizer (*)
            - Install with `pip install jieba`

        (*) The original XLM used [Stanford
        Segmenter](https://nlp.stanford.edu/software/stanford-segmenter-2018-10-16.zip). However, the wrapper
        (`nltk.tokenize.stanford_segmenter`) is slow due to JVM overhead, and it will be deprecated. Jieba is a lot
        faster and pip-installable. Note there is some mismatch with the Stanford Segmenter. It should be fine if you
        fine-tune the model with Chinese supervisionself. If you want the same exact behaviour, use the original XLM
        [preprocessing script](https://github.com/facebookresearch/XLM/tree/master/tools) to tokenize the sentence
        externally, and set `bypass_tokenizer=True` to bypass the tokenizer.

        Args:
            - lang: ISO language code (default = 'en') (string). Languages should belong of the model supported
              languages. However, we don't enforce it.
            - bypass_tokenizer: Allow users to preprocess and tokenize the sentences externally (default = False)
              (bool). If True, we only apply BPE.

        Returns:
            List of tokens.
        zSupplied language code not found in lang2id mapping. Please check that your language is supported by the loaded pretrained model.rK  r   r   Z	pythainlpr   )word_tokenizezaMake sure you install PyThaiNLP (https://github.com/PyThaiNLP/pythainlp) with the following stepsz1. pip install pythainlpr   jiebaNzUMake sure you install Jieba (https://github.com/fxsjy/jieba) with the following stepsz1. pip install jiebar   r+   zIt should not reach here)r   rW  rX  r   r2  rQ  r  rP  sysmodulesZpythainlp.tokenizero  rV  r.  rp  r   cutrZ  rh  r
   r   ri  rY  rn  )rD  r   rL  Zbypass_tokenizerZth_word_tokenizerp  Zsplit_tokensrj  r   r   r   	_tokenize  s^    (









zXLMTokenizer._tokenizec                 C   s   | j || j | jS )z0Converts a token (str) in an id using the vocab.)r9  r_  r&  )rD  rj  r   r   r   _convert_token_to_idY  s    z!XLMTokenizer._convert_token_to_idc                 C   s   | j || jS )z=Converts an index (integer) in a token (str) using the vocab.)r;  r_  r&  )rD  rg  r   r   r   _convert_id_to_token]  s    z!XLMTokenizer._convert_id_to_tokenc                 C   s   d |dd }|S )z:Converts a sequence of tokens (string) in a single string.r   r]  r   )r   r  strip)rD  tokensZ
out_stringr   r   r   convert_tokens_to_stringa  s    z%XLMTokenizer.convert_tokens_to_string)token_ids_0token_ids_1returnc                 C   s8   | j g}| jg}|dkr$|| | S || | | | S )a  
        Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
        adding special tokens. An XLM sequence has the following format:

        - single sequence: `<s> X </s>`
        - pair of sequences: `<s> A </s> B </s>`

        Args:
            token_ids_0 (`List[int]`):
                List of IDs to which the special tokens will be added.
            token_ids_1 (`List[int]`, *optional*):
                Optional second list of IDs for sequence pairs.

        Returns:
            `List[int]`: List of [input IDs](../glossary#input-ids) with the appropriate special tokens.

        N)Zbos_token_idsep_token_id)rD  rz  r{  Zbossepr   r   r    build_inputs_with_special_tokensf  s
    z-XLMTokenizer.build_inputs_with_special_tokens)rz  r{  already_has_special_tokensr|  c                    sf   |rt  j||ddS |dk	rLdgdgt|  dg dgt|  dg S dgdgt|  dg S )a  
        Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
        special tokens using the tokenizer `prepare_for_model` method.

        Args:
            token_ids_0 (`List[int]`):
                List of IDs.
            token_ids_1 (`List[int]`, *optional*):
                Optional second list of IDs for sequence pairs.
            already_has_special_tokens (`bool`, *optional*, defaults to `False`):
                Whether or not the token list is already formatted with special tokens for the model.

        Returns:
            `List[int]`: A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.
        T)rz  r{  r  Nr   r   )rB  get_special_tokens_maskr3  )rD  rz  r{  r  rF  r   r   r    s      .z$XLMTokenizer.get_special_tokens_maskc                 C   sV   | j g}| jg}|dkr.t|| | dg S t|| | dg t|| dg  S )a  
        Create a mask from the two sequences passed to be used in a sequence-pair classification task. An XLM sequence
        pair mask has the following format:

        ```
        0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1
        | first sequence    | second sequence |
        ```

        If `token_ids_1` is `None`, this method only returns the first portion of the mask (0s).

        Args:
            token_ids_0 (`List[int]`):
                List of IDs.
            token_ids_1 (`List[int]`, *optional*):
                Optional second list of IDs for sequence pairs.

        Returns:
            `List[int]`: List of [token type IDs](../glossary#token-type-ids) according to the given sequence(s).
        Nr   r   )r}  Zcls_token_idr3  )rD  rz  r{  r~  clsr   r   r   $create_token_type_ids_from_sequences  s
    z1XLMTokenizer.create_token_type_ids_from_sequences)save_directoryfilename_prefixr|  c           
   	   C   s  t j|s"td| d d S t j||r6|d ndtd  }t j||rX|d ndtd  }t|ddd	$}|t	j
| jd
dddd  W 5 Q R X d}t|ddd	`}t| j dd dD ]B\}}	||	krtd| d |	}|d|d  |d7 }qW 5 Q R X ||fS )NzVocabulary path (z) should be a directoryr   r   r   r	   wr  r  r   TF)indent	sort_keysensure_asciir!  r   c                 S   s   | d S )Nr   r   )kvr   r   r   rb    rc  z.XLMTokenizer.save_vocabulary.<locals>.<lambda>rd  zSaving vocabulary to zZ: BPE merge indices are not consecutive. Please check that the tokenizer is not corrupted!r   r   )rS  rT  isdirrW  rX  r   VOCAB_FILES_NAMESr6  writer7  dumpsr9  sortedr@  r:  warning)
rD  r  r  r   Z
merge_filefrg  writerZ
bpe_tokensZtoken_indexr   r   r   save_vocabulary  s0      (
zXLMTokenizer.save_vocabularyc                 C   s   | j  }d |d< |S )Nr/  )__dict__copy)rD  stater   r   r   __getstate__  s    
zXLMTokenizer.__getstate__c                 C   s:   || _ zdd l}W n tk
r.   tdY nX || _d S )Nr   r  )r  r-  r.  r/  )rD  dr-  r   r   r   __setstate__  s    
zXLMTokenizer.__setstate__)r   F)N)NF)N)N)'__name__
__module____qualname____doc__r  Zvocab_files_namesPRETRAINED_VOCAB_FILES_MAPZpretrained_vocab_files_mapPRETRAINED_INIT_CONFIGURATIONZpretrained_init_configuration&PRETRAINED_POSITIONAL_EMBEDDINGS_SIZESZmax_model_input_sizesrC  propertyrJ  rM  rP  rQ  rZ  r[  r\  rn  rt  ru  rv  ry  r   intr   r  boolr  r  strr   r  r  r  __classcell__r   r   rF  r   r    s~   7J

,
`  
    
   
r  )r  r7  rS  r  rq  r   typingr   r   r   Ztokenization_utilsr   utilsr   Z
get_loggerr  rW  r  r  r  r  r   r   r  r
  r  r  r   r   r   r   <module>   s  
&&*g   b+