+
    œ°³j'  ã                   ón   € R t ^ RIt^RIHtHt ^RIHt ]P                  ! ]4      t	 ! R R]4      t
R.tR# )z"Tokenization class for model ByT5.N)Ú
AddedTokenÚPreTrainedTokenizer)Úloggingc                   óø   a a€ ] tR t^t oRtRR.tRV3R lV 3R lllt]R 4       tR t	RV3R lV 3R	 lllt
V3R
 lR ltRV3R lR lltRV3R lR lltV3R lR ltR tR tR tRV3R lR lltRtVtV ;t# )ÚByT5Tokenizera7  
Construct a ByT5 tokenizer. ByT5 simply uses raw bytes utf-8 encoding.

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:
    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 125):
        Add a number of extra ids added to the end of 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. Extra tokens are
        indexed from the end of the vocabulary up to beginning ("<extra_id_0>" is the last token in the vocabulary
        like in ByT5 preprocessing see
        [here](https://github.com/google-research/text-to-text-transfer-transformer/blob/9fd7b14a769417be33bc6c850f9598764913c833/t5/data/preprocessors.py#L2117)).
    additional_special_tokens (`list[str]`, *optional*):
        Additional special tokens used by the tokenizer.
Ú	input_idsÚattention_maskc                ó   <€ V ^8„  d   QhRR/# )é   ÚreturnN© )ÚformatÚ__classdict__s   "€Úk/home/luca/screen-checking/.venv/lib/python3.14/site-packages/transformers/models/byt5/tokenization_byt5.pyÚ__annotate__ÚByT5Tokenizer.__annotate__<   s   ø€ ÷ %
ñ %
ð 
ñ%
ó    c                ó~  <€ V^ 8”  d$   Vf    \        V4       Uu. uF	  pRV R2NK  	  ppMRV^ 8”  dL   VeH   \        V4      ^ 8”  d8   \        \        \        R V4      4      4      pW„8w  d   \	        RV RV R24      h\        V\        4      '       d   \        VRRR	7      MTp\        V\        4      '       d   \        VRRR	7      MTp\        V\        4      '       d   \        VRRR	7      MTp^ V^V^V/V n        \        V P                  4      V n	        RV n
        \        S	V `0  ! RR
VRVRVR^ RV/VB  R# u upi )é    Nz
<extra_id_Ú>c                 ó0   € \        R \        V 4      9   4      # )Úextra_id)ÚboolÚstr)Úxs   &r   Ú<lambda>Ú(ByT5Tokenizer.__init__.<locals>.<lambda>J   s   € ´D¸ÄsÈ1ÃvÑ9MÔ4Nr   zBoth extra_ids (z!) and additional_special_tokens (zm) are provided to ByT5Tokenizer. In this case the additional_special_tokens must include the extra_ids tokensT)ÚlstripÚrstripÚ	eos_tokenÚ	unk_tokenÚ	pad_tokenÚ	extra_idsÚadditional_special_tokensé   r   )ÚrangeÚlenÚsetÚfilterÚ
ValueErrorÚ
isinstancer   r   Ú_added_tokens_decoderÚoffsetÚ_utf_vocab_sizeÚsuperÚ__init__)
Úselfr   r    r!   r"   r#   ÚkwargsÚiÚextra_tokensÚ	__class__s
   &&&&&&,  €r   r/   ÚByT5Tokenizer.__init__<   sw  ø€ ð �qŒ=Ð6Ò>ÜDIÈ)ÔDTÓ(UÑDT¸q¨:°a°S¸Ó):ÑDTÐ%Ð(UÐ%Ø˜Œ]Ð8ÒDÌÐMfÓIgÐjkÔIkäœs¤6Ñ*NÐPiÓ#jÓkÓlˆLØÔ(Ü Ø& y kÐ1RÐSlÐRmð n(ð (óð ô HRÐR[Ô]`×GaÒGa”J˜y°¸dÕCÐgpˆ	äGQÐR[Ô]`×GaÒGa”J˜y°¸dÕCÐgpˆ	ÜGQÐR[Ô]`×GaÒGa”J˜y°¸dÕCÐgpˆ	à&'¨°A°yÀ!ÀYÐ%OˆÔ"Ü˜$×4Ñ4Ó5ˆŒØ#ˆÔÜ‰Òñ 	
Øð	
àð	
ð  ð	
ð ð		
ð
 '@ð	
ð ô	
ùò' )Vs   šD:c                ó   € V P                   # ©N)r-   )r0   s   &r   Ú
vocab_sizeÚByT5Tokenizer.vocab_sizec   s   € à×#Ñ#Ð#r   c                óÎ   € \        V P                  V P                  ,           4       Uu/ uF  qP                  V4      VbK  	  ppVP	                  V P
                  4       V# u upi r7   )r%   r8   r,   Úconvert_ids_to_tokensÚupdateÚadded_tokens_encoder)r0   r2   Úvocabs   &  r   Ú	get_vocabÚByT5Tokenizer.get_vocabg   sX   € Ü;@ÀÇÁÐSW×S^ÑS^ÕA^Ô;_Ó`Ñ;_°a×+Ñ+¨AÓ.°Ò1Ñ;_ˆÐ`Ø�‰�T×.Ñ.Ô/Øˆùò as   ©A"c          	      óp   <€ V ^8„  d   QhRS[ S[,          RS[ S[,          R,          RS[RS[ S[,          /# )r
   Útoken_ids_0Útoken_ids_1NÚalready_has_special_tokensr   )ÚlistÚintr   )r   r   s   "€r   r   r   l   sD   ø€ ÷ Oñ OÙ¡�9ðOÙ37¹µ9¸tÕ3CðOÙhlðOá	‰c�ñOr   c                óê   <€ V'       d   \         SV `  WRR7      # Vf   ^ .\        V4      ,          ^.,           # ^ .\        V4      ,          ^.,           ^ .\        V4      ,          ,           ^.,           # )ad  
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)rB   rC   rD   )r.   Úget_special_tokens_maskr&   )r0   rB   rC   rD   r4   s   &&&&€r   rH   Ú%ByT5Tokenizer.get_special_tokens_maskl   sw   ø€ ÷$ &Ü‘7Ñ2Ø'Ð]að 3ó ð ð
 ÒØ�Cœ#˜kÓ*Õ*¨q¨cÕ1Ð1Ø�”c˜+Ó&Õ&¨1¨#Õ-°!°´s¸;Ó7GÕ1GÕHÈAÈ3ÕNÐNr   c                óF   <€ V ^8„  d   QhRS[ S[,          RS[ S[,          /# )r
   Ú	token_idsr   ©rE   rF   )r   r   s   "€r   r   r   ˆ   s#   ø€ ÷ 	3ñ 	3±±cµð 	3¹tÁC½yñ 	3r   c                óÄ   € \        V4      ^ 8”  d?   VR,          V P                  8X  d'   \        P                  ! RV P                   R24       V# WP                  .,           # )z.Do not add eos again if user already added it.zThis sequence already has zQ. In future versions this behavior may lead to duplicated eos tokens being added.éÿÿÿÿ)r&   Úeos_token_idÚwarningsÚwarnr   )r0   rK   s   &&r   Ú_add_eos_if_not_presentÚ%ByT5Tokenizer._add_eos_if_not_presentˆ   s[   € äˆy‹>˜AÔ )¨B¥-°4×3DÑ3DÔ"DÜ�MŠMØ,¨T¯^©^Ð,<ð =+ð +ôð Ðà× 1Ñ 1Ð2Õ2Ð2r   c                ój   <€ V ^8„  d   QhRS[ S[,          RS[ S[,          R,          RS[ S[,          /# ©r
   rB   rC   Nr   rL   )r   r   s   "€r   r   r   “   s;   ø€ ÷ @ñ @Ù¡�9ð@Ù37¹µ9¸tÕ3Cð@á	‰c�ñ@r   c                ó¤   € V P                   .pVf   \        W,           4      ^ .,          # \        W,           V,           V,           4      ^ .,          # )ay  
Create a mask from the two sequences passed to be used in a sequence-pair classification task. ByT5 does not
make use of token type ids, therefore a list of zeros is returned.

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 zeros.
)rO   r&   )r0   rB   rC   Úeoss   &&& r   Ú$create_token_type_ids_from_sequencesÚ2ByT5Tokenizer.create_token_type_ids_from_sequences“   sL   € ð  × Ñ Ð!ˆàÒÜ�{Õ(Ó)¨Q¨CÕ/Ð/Ü�;Õ$ {Õ2°SÕ8Ó9¸Q¸CÕ?Ð?r   c                ój   <€ V ^8„  d   QhRS[ S[,          RS[ S[,          R,          RS[ S[,          /# rU   rL   )r   r   s   "€r   r   r   ©   s6   ø€ ÷ -ñ -Ù¡�9ð-Ù37¹µ9¸tÕ3Cð-á	‰c�ñ-r   c                ób   € V P                  V4      pVf   V# V P                  V4      pW,           # )a"  
Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. A sequence has the following format:

- single sequence: `X </s>`
- pair of sequences: `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.
)rR   )r0   rB   rC   s   &&&r   Ú build_inputs_with_special_tokensÚ.ByT5Tokenizer.build_inputs_with_special_tokens©   s9   € ð& ×2Ñ2°;Ó?ˆØÒØÐà×6Ñ6°{ÓCˆKØÕ,Ð,r   c                ó6   <€ V ^8„  d   QhRS[ RS[S[ ,          /# )r
   Útextr   )r   rE   )r   r   s   "€r   r   r   Ã   s   ø€ ÷ ñ ™cð ¡d©3¥iñ r   c                ób   € VP                  R4       Uu. uF  p\        V4      NK  	  ppV# u upi )zPTake as input a string and return a list of strings (tokens) for words/sub-wordsúutf-8)ÚencodeÚchr)r0   r_   r2   Útokenss   &&  r   Ú	_tokenizeÚByT5Tokenizer._tokenizeÃ   s/   € à"&§+¡+¨gÔ"6Ó7Ñ"6˜Q”#�a–&Ñ"6ˆÐ7Øˆùò 8s   ”,c                óf   € \        V4      ^8w  d   RpV# \        V4      V P                  ,           pV# )z0Converts a token (str) in an id using the vocab.N)r&   Úordr,   )r0   ÚtokenÚtoken_ids   && r   Ú_convert_token_to_idÚ"ByT5Tokenizer._convert_token_to_idÈ   s4   € ô ˆu‹:˜Œ?ØˆHð ˆô ˜5“z D§K¡KÕ/ˆHàˆr   c                ó<   € \        WP                  ,
          4      pV# )z=Converts an index (integer) in a token (str) using the vocab.)rc   r,   )r0   Úindexri   s   && r   Ú_convert_id_to_tokenÚ"ByT5Tokenizer._convert_id_to_tokenÒ   s   € ä�EŸK™KÕ'Ó(ˆØˆr   c                ó&  € RpV Fu  pW0P                   9   d$   V P                   V,          P                  R4      pM7W0P                  9   d   VP                  R4      pM\        \	        V4      .4      pW$,          pKw  	  VP                  RRR7      pV# )z:Converts a sequence of tokens (string) in a single string.r   ra   Úignore)Úerrors)r+   rb   Ú_added_tokens_encoderÚbytesrh   Údecode)r0   rd   Úbstringri   Ú
tok_stringÚstrings   &&    r   Úconvert_tokens_to_stringÚ&ByT5Tokenizer.convert_tokens_to_string×   sƒ   € àˆÛˆEØ×2Ñ2Ô2Ø!×7Ñ7¸Õ>×EÑEÀgÓN‘
Ø×4Ñ4Ô4Ø"Ÿ\™\¨'Ó2‘
ä"¤C¨£J <Ó0�
ØÕ!ŠGñ ð —‘ °�Ó9ˆØˆr   c                óJ   <€ V ^8„  d   QhRS[ RS[ R,          RS[S[ ,          /# )r
   Úsave_directoryÚfilename_prefixNr   )r   Útuple)r   r   s   "€r   r   r   æ   s-   ø€ ÷ ñ ©cð ÁCÈ$ÅJð ÑZ_Ñ`cÕZdñ r   c                ó   € R# )Nr   r   )r0   r}   r~   s   &&&r   Úsave_vocabularyÚByT5Tokenizer.save_vocabularyæ   s   € Øˆ	r   )r+   r-   r,   )z</s>z<unk>z<pad>é}   N)NFr7   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Úmodel_input_namesr/   Úpropertyr8   r?   rH   rR   rX   r\   re   rk   ro   rz   r�   Ú__static_attributes__Ú__classdictcell__Ú__classcell__)r4   r   s   @@r   r   r      s‘   ù‡ € ñð@ %Ð&6Ð7Ð÷%
õ %
ðN ñ$ó ð$ò÷
Oõ O÷8	3ð 	3÷@ò @÷,-ò -÷4ð ò
òò
÷÷ ò r   r   )rˆ   rP   Útokenization_pythonr   r   Úutilsr   Ú
get_loggerr„   Úloggerr   Ú__all__r   r   r   Ú<module>r“      s?   ðñ )ã ç BÝ ð 
×	Ò	˜HÓ	%€ôNÐ'ô Nðb Ð
‚r   