Ë
    T^(h>  ã                   ó–   — d Z ddlmZmZ ddl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ddiZ G d„ de«      Zy)zTokenization classes for Qwen2.é    )ÚOptionalÚTupleé   )Ú
AddedToken)ÚPreTrainedTokenizerFast)Úloggingé   )ÚQwen2Tokenizerz
vocab.jsonz
merges.txtztokenizer.json)Ú
vocab_fileÚmerges_fileÚtokenizer_filezqwen/qwen-tokenizeri €  c                   ód   ‡ — e Zd ZdZeZddgZeZ	 	 	 	 	 	 	 d	ˆ fd„	Z	d
de
dee
   dee
   fd„Zˆ xZS )ÚQwen2TokenizerFastac  
    Construct a "fast" Qwen2 tokenizer (backed by HuggingFace's *tokenizers* library). Based on byte-level
    Byte-Pair-Encoding.

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

    ```python
    >>> from transformers import Qwen2TokenizerFast

    >>> tokenizer = Qwen2TokenizerFast.from_pretrained("Qwen/Qwen-tokenizer")
    >>> tokenizer("Hello world")["input_ids"]
    [9707, 1879]

    >>> tokenizer(" Hello world")["input_ids"]
    [21927, 1879]
    ```
    This is expected.

    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*):
            Path to [tokenizers](https://github.com/huggingface/tokenizers) file (generally has a .json extension) that
            contains everything needed to load the tokenizer.
        unk_token (`str`, *optional*, defaults to `"<|endoftext|>"`):
            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. Not applicable to this tokenizer.
        bos_token (`str`, *optional*):
            The beginning of sequence token. Not applicable for this tokenizer.
        eos_token (`str`, *optional*, defaults to `"<|endoftext|>"`):
            The end of sequence token.
        pad_token (`str`, *optional*, defaults to `"<|endoftext|>"`):
            The token used for padding, for example when batching sequences of different lengths.
    Ú	input_idsÚattention_maskc                 óD  •— t        |t        «      rt        |dddd¬«      n|}t        |t        «      rt        |dddd¬«      n|}t        |t        «      rt        |dddd¬«      n|}t        |t        «      rt        |dddd¬«      n|}t        ‰	| �  d|||||||dœ|¤Ž y )NFT)ÚlstripÚrstripÚspecialÚ
normalized)r   r   r   Ú	unk_tokenÚ	bos_tokenÚ	eos_tokenÚ	pad_token© )Ú
isinstanceÚstrr   ÚsuperÚ__init__)
Úselfr   r   r   r   r   r   r   ÚkwargsÚ	__class__s
            €úo/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/transformers/models/qwen2/tokenization_qwen2_fast.pyr   zQwen2TokenizerFast.__init__S   sÒ   ø€ ô$ ˜)¤SÔ)ô �y¨°uÀdÐW\Õ]àð 	ô ˜)¤SÔ)ô �y¨°uÀdÐW\Õ]àð 	ô ˜)¤SÔ)ô �y¨°uÀdÐW\Õ]àð 	ô ˜)¤SÔ)ô �y¨°uÀdÐW\Õ]àð 	ô 	‰Ñð 		
Ø!Ø#Ø)ØØØØñ		
ð ó		
ó    Úsave_directoryÚfilename_prefixÚreturnc                 óf   — | j                   j                  j                  ||¬«      }t        |«      S )N)Úname)Ú
_tokenizerÚmodelÚsaveÚtuple)r    r%   r&   Úfiless       r#   Úsave_vocabularyz"Qwen2TokenizerFast.save_vocabulary„   s+   € Ø—‘×%Ñ%×*Ñ*¨>ÀÐ*ÓPˆÜ�U‹|Ðr$   )NNNú<|endoftext|>Nr0   r0   )N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚVOCAB_FILES_NAMESÚvocab_files_namesÚmodel_input_namesr
   Úslow_tokenizer_classr   r   r   r   r/   Ú__classcell__)r"   s   @r#   r   r   %   se   ø„ ñ'ðR *ÐØ$Ð&6Ð7ÐØ)Ðð ØØØ!ØØ!Ø!õ.
ñb¨cð ÀHÈSÁMð Ð]bÐcfÑ]g÷ r$   r   N)r4   Útypingr   r   Útokenization_utilsr   Útokenization_utils_fastr   Úutilsr   Útokenization_qwen2r
   Ú
get_loggerr1   Úloggerr5   ÚMAX_MODEL_INPUT_SIZESr   r   r$   r#   ú<module>rB      s\   ðñ &ç "å ,Ý >Ý Ý .ð 
ˆ×	Ñ	˜HÓ	%€ð ØØ&ñÐ ð /°Ð6Ð ôaÐ0õ ar$   