ó
    Z– jÉ  ã                   óJ   • S SK Jr  S SKJr  S SKJr  S SKJrJr  S\S\	4S jr
g)	é    )ÚPath)ÚAny)ÚTikTokenConverter)ÚTIKTOKEN_VOCAB_FILEÚTOKENIZER_FILEÚencodingÚ
output_dirc                 ó€  • [        U5      nUR                  SS9  US-  [        -  nU[        -  nUR                  R                  SSS9  [        UR                  5       5      n[        UR                  5       5      n SSKJn  SSK	J
n  [        U [
        5      (       a  U" U 5      n U" U R                  U5        [!        X@R"                  U R$                  S9R'                  5       n
U
R)                  U5        g! [         a<  n[        U5      n	SU	R                  5       ;   a  [        S	5      Ue[        S
5      UeSnAff = f)a—  
Converts given `tiktoken` encoding to `PretrainedTokenizerFast` and saves the configuration of converted tokenizer
on disk.

Args:
    encoding (`str` or `tiktoken.Encoding`):
        Tokenizer from `tiktoken` library. If `encoding` is `str`, the tokenizer will be loaded with
        `tiktoken.get_encoding(encoding)`.
    output_dir (`str`):
        Save path for converted tokenizer configuration file.
T)Úexist_okÚtiktoken)Úparentsr   r   )Úget_encoding)Údump_tiktoken_bpeÚblobfilezY`blobfile` is required to save a `tiktoken` file. Install it with `pip install blobfile`.zY`tiktoken` is required to save a `tiktoken` file. Install it with `pip install tiktoken`.N)Ú
vocab_fileÚpatternÚextra_special_tokens)r   Úmkdirr   r   ÚparentÚstrÚabsoluter   r   Útiktoken.loadr   Ú
isinstanceÚ_mergeable_ranksÚImportErrorÚlowerÚ
ValueErrorr   Ú_pat_strÚ_special_tokensÚ	convertedÚsave)r   r	   Ú	save_fileÚtokenizer_fileÚsave_file_absoluteÚoutput_file_absoluter   r   ÚeÚ	error_msgÚ	tokenizers              Ús/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/transformers/integrations/tiktoken.pyÚconvert_tiktoken_to_fastr*      s8  € ô jÓ!€JØ×Ñ˜dÐÑ#à˜ZÑ'Ô*=Ñ=€IØ¤.Ñ0€Nð ×Ñ×Ñ 4°$ÐÑ7ä˜Y×/Ñ/Ó1Ó2ÐÜ˜~×6Ñ6Ó8Ó9ÐðÝ)Ý3äh¤×$Ñ$Ù# HÓ-ˆHá˜(×3Ñ3Ð5GÔHô "Ø%×/@Ñ/@ÐW_×WoÑWoñçiƒkð ð ‡NNÐ'Õ(øô ó Ü˜“Fˆ	Ø˜Ÿ™Ó*Ó*ÜØkóàðô Øgó
àð	ûðús   Á=<C7 Ã7
D=Ä7D8Ä8D=N)Úpathlibr   Útypingr   Ú#transformers.convert_slow_tokenizerr   Ú*transformers.tokenization_utils_tokenizersr   r   r   r*   © ó    r)   Ú<module>r1      s$   ðÝ Ý å Aß Zð-) sð -)¸õ -)r0   