ó
    ˆŽ¡jŒ  ã                   óš   • S r SSKrSSKJrJrJrJrJr  SSKJ	r	  SSK
Jr  SSKJr  \R                  " \5      rSS	S
.r " S S\5      rS/rg)z Tokenization class for model T5.é    N)Ú	TokenizerÚdecodersÚnormalizersÚpre_tokenizersÚ
processors)ÚUnigramé   )ÚTokenizersBackend)Úloggingzspiece.modelztokenizer.json)Ú
vocab_fileÚtokenizer_filec                   ó~   ^ • \ rS rSrSr\rSS/r\r	       SS\
\\\
\4      -  S-  4U 4S jjjrS rS	 rS
rU =r$ )ÚT5Tokenizeré   aN  
Construct a T5 tokenizer (backed by HuggingFace's *tokenizers* library). Based on
[Unigram](https://huggingface.co/docs/tokenizers/python/latest/components.html?highlight=unigram#models).

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

Args:
    vocab_file (`str`, *optional*):
        [SentencePiece](https://github.com/google/sentencepiece) file (generally has a *.spm* extension) that
        contains the vocabulary necessary to instantiate a tokenizer.
    eos_token (`str`, *optional*, defaults to `"</s>"`):
        The end of sequence token.

        <Tip>

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

        </Tip>

    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.
    extra_ids (`int`, *optional*, defaults to 100):
        Add a number of extra ids added to the vocabulary for use as sentinels. These tokens are accessible as
        "<extra_id_{%d}>" where "{%d}" is a number between 0 and extra_ids-1. These tokens can be retrieved by
        calling get_sentinel_tokens method and token ids can be by calling get_sentinel_token_ids method
    additional_special_tokens (`list[str]`, *optional*):
        Additional special tokens used by the tokenizer.
    vocab (`str`, `dict` or `list`, *optional*):
        Custom vocabulary dict. If not provided, a minimal vocabulary is created using the special tokens.
Ú	input_idsÚattention_maskNÚvocabc           	      ód  >• X`l         Ub~  U V	s/ s H  n	S[        U	5      ;   d  M  U	PM     n
n	[        U
5      S:  a$  U[        U5       Vs/ s H	  nSU S3PM     sn-  nOIUS:”  a!  U[        U
5      :w  a  [	        SU SU S35      eO![        U5       Vs/ s H	  nSU S3PM     n
nU
nUb  Xl        Od[        U5      S4[        U5      S4[        U5      S4S	/U l        [        US-
  S
S
5       H$  nU R
                  R                  SU S3S45        M&     [        [        U R
                  SSS95      U l	        Ub%  [        R                  " U5      U R                  l        [        R                  " [        R                  " 5       [        R                   " SSSS9/5      U R                  l        [$        R                   " SSSS9U R                  l        [(        TU ]T  " SUUUUUS.UD6  [,        R.                  " SS// SQSU R0                  4/S9U R                  l        g s  sn	f s  snf s  snf )Nz
<extra_id_é   Ú>r   zBoth extra_ids (z!) and additional_special_tokens (zk) are provided to T5Tokenizer. In this case the additional_special_tokens must include the extra_ids tokensg        )õ   â–�g       Àéÿÿÿÿé   F)Úunk_idÚbyte_fallbackr   ÚalwaysT)ÚreplacementÚprepend_schemeÚsplit)Ú	eos_tokenÚ	unk_tokenÚ	pad_tokenÚ	extra_idsÚadditional_special_tokensú$Aú</s>)r%   r&   z$Br&   )ÚsingleÚpairÚspecial_tokens© )Ú
_extra_idsÚstrÚlenÚrangeÚ
ValueErrorÚ_vocab_scoresÚappendr   r   Ú
_tokenizerr   ÚPrecompiledÚ
normalizerr   ÚSequenceÚWhitespaceSplitÚ	MetaspaceÚpre_tokenizerr   ÚdecoderÚsuperÚ__init__r   ÚTemplateProcessingÚeos_token_idÚpost_processor)Úselfr   r    r!   r"   Ú_spm_precompiled_charsmapr#   r$   ÚkwargsÚxÚextra_tokensÚiÚ	__class__s               €Ú´C:\Users\johnn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\transformers/models/t5/tokenization_t5.pyr;   ÚT5Tokenizer.__init__G   sa  ø€ ð $Œð %Ñ0Ù'@Ó[Ò'@ !ÀLÔTWÐXYÓTZÑDZŸAÑ'@ˆLÐ[Ü�<Ó  1Ó$Ø)ÌÈyÔIYÓ-ZÒIYÀA°
¸1¸#¸QÓ.?ÑIYÑ-ZÑZÑ)Ø˜Q“ 9´°LÓ0AÓ#AÜ Ø& y kÐ1RÐSlÐRmð nð óð øô 8=¸YÔ7GÓHÒ7G°!˜j¨¨¨1Ó-Ñ7GˆLÐHØ(4Ð%ð ÑØ!&Õô �Y“ Ð%Ü�Y“ Ð%Ü�Y“ Ð%Øð	"ˆDÔô ˜9 q™=¨"¨bÖ1�Ø×"Ñ"×)Ñ)¨Z¸°s¸!Ð+<¸cÐ*BÖCñ 2ô $ÜØ×"Ñ"ØØ#ñó
ˆŒð %Ñ0Ü)4×)@Ò)@ÐAZÓ)[ˆD�O‰OÔ&ä(6×(?Ò(?ä×.Ò.Ó0Ü×(Ò(°UÈ8Ð[_Ñ`ðó)
ˆ�‰Ô%ô #+×"4Ò"4ÀÐW_ÐgkÑ"lˆ�‰Ôä‰Òð 	
ØØØØØ&?ñ	
ð ò	
ô *4×)FÒ)FØ˜&�>Ú-à˜×*Ñ*Ð+ðñ*
ˆ�‰Õ&ùòm \ùâ-Zùò Is   �H#¦H#ÁH(ÂH-c                 óT   • [        [        [        S U R                  5      5      5      $ )zQGet the list of sentinel tokens (extra_id tokens) from additional_special_tokens.c                 óF   • [        [        R                  " SU 5      5      S L$ )Nz<extra_id_\d+>)ÚboolÚreÚsearch)rB   s    rF   Ú<lambda>Ú1T5Tokenizer.get_sentinel_tokens.<locals>.<lambda>—   s   € ¤¤b§i¢iÐ0AÀ1Ó&EÓ!FÈdÑ!Ró    )ÚlistÚsetÚfilterr$   )r?   s    rF   Úget_sentinel_tokensÚT5Tokenizer.get_sentinel_tokens”   s&   € äÜ”ÑRÐTX×TrÑTrÓsÓtó
ð 	
rO   c                 ój   • U R                  5        Vs/ s H  oR                  U5      PM     sn$ s  snf )z&Get the token IDs for sentinel tokens.)rS   Úconvert_tokens_to_ids)r?   Útokens     rF   Úget_sentinel_token_idsÚ"T5Tokenizer.get_sentinel_token_idsš   s.   € à?C×?WÑ?WÔ?YÓZÒ?Y°e×*Ñ*¨5Ö1Ñ?YÑZÐZùÒZs   “0)r+   r2   r0   )Nr&   z<unk>z<pad>Néd   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__ÚVOCAB_FILES_NAMESÚvocab_files_namesÚmodel_input_namesr   Úmodelr,   rP   ÚtupleÚfloatr;   rS   rX   Ú__static_attributes__Ú__classcell__)rE   s   @rF   r   r      sx   ø† ñ"ðH *ÐØ$Ð&6Ð7ÐØ€Eð 7;ØØØØ"&ØØ"&ñK
à�T˜%  U 
Ñ+Ñ,Ñ,¨tÑ3÷K
ð K
òZ
÷[ð [rO   r   )r_   rK   Ú
tokenizersr   r   r   r   r   Útokenizers.modelsr   Útokenization_utils_tokenizersr
   Úutilsr   Ú
get_loggerr[   Úloggerr`   r   Ú__all__r*   rO   rF   Ú<module>ro      sU   ðñ 'ã 	ç SÕ SÝ %å >Ý ð 
×	Ò	˜HÓ	%€à#1ÐEUÑVÐ ô~[Ð#ô ~[ðB ˆ/�rO   