
    hp                     !   d Z ddlZddlZddlZddlZddlmZ ddlmZm	Z	m
Z
 ddlmZ ddlmZ ddlmZmZ dd	lmZ dd
lmZ ddlmZ ddlmZmZmZmZmZmZ ddlm Z  ddl!m"Z" ddl#m$Z$m%Z%m&Z&m'Z'm(Z(  e       rddl)m*Z* ndZ* ejV                  e,      Z- ee.e/e	e.   e	e.   f   f   g dd e       rdndffd e       rdnd e       rdndffdd e       rdndffdd e       rdndffdd e       rdndffd d e       rd!ndffd"d e       rdndffd#d$ e       rd%nd e       rd&ndffd'd(d e       rdndffd) e       rd*nddffd+d,d- e       rd.nd e       rd/ndffd0d1 e       rd2ndffd3d4d e       rd5ndffd6d7d8d e       rdndffd9d: e       rd;ndffd<d e       rd=ndffd>d? e       rd@ndffdAd e       rdndffdBdC e       rdDnd e       rdEndffdFdG e       rdnd e       rdndffdHd e       rdndffdId? e       rd@ndffdJd e       rdndffdKd e       rdndffdLdM e       rdNnd e       rdOndffdPdQ e       rdRndffdSd e       rd!ndffdTd e       rd!ndffdUd e       rdndffdVdW e       rdXndffdYdZ e       rd[ndffd\ e       rd]nd e       rd^ndffd_d`dadbd? e       rd@ndffdcd: e       rd;ndffddde e       rdfndffdg e       rdhnd e       rdindffdj e       rdnd e       rdndffdk e       rdnd e       rdndffdl e       rdnd e       rdndffdm e       rdnd e       rdndffdndo e       rdnd e       rdndffdpdq e       rdrndffdsdt e       rdundffdvdw e       rdxndffdyd: e       rd;ndffdzd e       rdndffd{d e       rdndffd|d e       rdndffd} e       rd~nddffdd e       rd:nd e       rd;ndffdd e       rd5ndffdd e       rdndffd e       rdnddffddd e       rdndffddd e       rdndffd e       rdnd e       rdndffd e       rdnd e       rdndffd e       rdnd e       rdndffd e       rdnd e       rdndffd e       rdnd e       rdndffd e       rdnd e       rdndffdd e       rdndffdd e       rd5ndffdd e       rd5ndffdd e       rd5ndffdd e       rd5ndffdd e       rd5ndffd e       rdnddffdd: e       rd;ndffdd: e       rd;ndffdd: e       rd;ndffdd e       rdndffddd e       rd5ndffdd: e       rd;ndffddddddd e       rdndffdd e       rdndffdd e       rd5ndffdd e       rdndffddd? e       rd@ndffdd e       rdndffdd e       rdndffdd e       rdndffdd: e       rd;ndffdd: e       rd;ndffddW e       rdXndffd e       rdnd e       rdndffdd e       rdndffd e       rdnd e       rdndffdd e       rdnd e       rdndffdd e       rd5ndffdd e       rdndffdd e       rdndffdd e       rdndffdd e       rdndffdd e       rdndffdd e       rdndffd e       rdnd e       rdndffd e       rdnd e       rdndffd e       rdnd e       rdndffdd e       rdndffdd e       rdndffdd e       rdndffdd e       rdndffdd e       rdndffd e       rdnd e       rdndffdݑdd e       rdndffd e       rdnddffdd e       rdndffdd e       rdndffd e       rdnddffd e       rdnd e       rdndffd e       rdnd e       rdndffdd? e       rd@ndffdd e       rdndffdd e       rdndffdd e       rd:nd e       rd;ndffd e       rdn
 e       rdnd e       r	 e       sdndffd e       rdn
 e       rdnd e       r	 e       sdndffdd e       rdndffd e       rdnddffdd e       rdndffdd e       rdndffdd e       rd5ndffdd e       rd5ndffdd e       rd5ndffdd  e       rdndffdd e       rdndffdd? e       rd@ndffd e       rdnd e       rdndffdd e       rdndffdd e       rdndffd	d
 e       rdndffddd e       rd5ndffdd e       rdndffd e       rdnd e       rdndffd e       rdnd e       rdndffd e       rdnd e       rdndffdd e       rdndffdd e       rdndffdd e       rdndffdd e       rdndffdd e       rdndffdd e       rdndffdd: e       rd;ndffdd e       rdndffdd e       rdndffdd e       rdndffd  e       rd1nd e       rd2ndffd! e       rd1nd e       rd2ndffd"d# e       rdnd e       rdndffd$dQ e       rdRndffd%d e       rdndffd&d e       rdndffd'd(d e       rdndffd)d e       rdn
 e       rd5ndffd* e       rd+nddffd,d-d e       rdndffd.dW e       rdXndffd/dW e       rdXndffd0dW e       rdXndffd1dW e       rdXndffd2dW e       rdXndffd3dW e       rdXndffd4dW e       rdXndffd5dW e       rdXndffd6d7d8 e       rd9ndffd: e       rdnd e       rdndffd; e       rd<nd e       rd=ndffd> e       rd?nd e       rd@ndffdAdB e       rdCndffdDd? e       rd@ndffdEd? e       rd@ndffdFdGdH e       rdIndffdJd e       rdndffdK e       rdLnd e       rdMndffdN e       rdLnd e       rdMndffdO e       rdnd e       rdndffdP e       rdQnddffdR e       rdnd e       rdndffdSd e       rd5ndffdT e       rdUnddffdVdW e       rdXnddffdYdZd[ e       rd\ndffd]d e       rdndffd^d: e       rd;ndffd_ e       rdnd e       rdndffd` e       rdnd e       rdndffda e       rdnd e       rdndffdbdcddded e       rdndffdf e       rdgnd e       rdhndffdi e       rdnd e       rdndffdjd e       rdndffdkd e       rdndffdld e       rdndffdmd e       rdndffdndo e       rdn
 e       rdnd e       r	 e       sdndffdpdqdrdsdtdu e       rdvndffdwd e       rdndffdx e       rdynd e       rdzndffd{d| e       rd}nddffd~ e       rdnd e       rdndffd e       rdnd e       rdndffd e       rdnd e       rdndffdd e       rdndffd e       rdnd e       rdndffd e       rdnd e       rdndffd e       rdnd e       rdndffd e       rdnd e       rdndff      Z0 e"e$e0      Z1 e$jd                         D  ci c]  \  } }|| 
 c}} Z3de.de
e4e   df   fdZ5	 	 	 	 	 	 	 	 dde
e.ejl                  e.   f   de	e
e.ejl                  e.   f      de7de	e7   de	e8e.e.f      de	e
e7e.f      de	e.   de7de.de8e.ef   fdZ9 G d d      Z:ddgZ;yc c}} w (  zAuto Tokenizer class.    N)OrderedDict)AnyOptionalUnion)is_mistral_common_available   )PretrainedConfig)get_class_from_dynamic_moduleresolve_trust_remote_code)load_gguf_checkpoint)PreTrainedTokenizer)TOKENIZER_CONFIG_FILE)cached_fileextract_commit_hashis_g2p_en_availableis_sentencepiece_availableis_tokenizers_availablelogging   )EncoderDecoderConfig   )_LazyAutoMapping)CONFIG_MAPPING_NAMES
AutoConfigconfig_class_to_model_typemodel_type_to_module_name!replace_list_option_in_docstrings)PreTrainedTokenizerFastaimv2CLIPTokenizerCLIPTokenizerFastalbertAlbertTokenizerAlbertTokenizerFastalignBertTokenizerBertTokenizerFastarceeLlamaTokenizerLlamaTokenizerFastaria
aya_visionCohereTokenizerFastbark)bart)BartTokenizerBartTokenizerFastbarthezBarthezTokenizerBarthezTokenizerFast)bartpho)BartphoTokenizerNbertzbert-generationBertGenerationTokenizer)zbert-japanese)BertJapaneseTokenizerN)bertweet)BertweetTokenizerNbig_birdBigBirdTokenizerBigBirdTokenizerFastbigbird_pegasusPegasusTokenizerPegasusTokenizerFast)biogpt)BioGptTokenizerNbitnetr   )
blenderbot)BlenderbotTokenizerBlenderbotTokenizerFast)zblenderbot-small)BlenderbotSmallTokenizerNblipzblip-2GPT2TokenizerGPT2TokenizerFastbloomBloomTokenizerFastbridgetowerRobertaTokenizerRobertaTokenizerFastbros)byt5)ByT5TokenizerN	camembertCamembertTokenizerCamembertTokenizerFast)canine)CanineTokenizerN	chameleonchinese_clipclapclipclipseg)clvp)ClvpTokenizerN
code_llamaCodeLlamaTokenizerCodeLlamaTokenizerFastcodegenCodeGenTokenizerCodeGenTokenizerFastcoherecohere2colpalicolqwen2Qwen2TokenizerQwen2TokenizerFastconvbertConvBertTokenizerConvBertTokenizerFastcpmCpmTokenizerCpmTokenizerFast)cpmant)CpmAntTokenizerN)ctrl)CTRLTokenizerN)zdata2vec-audioWav2Vec2CTCTokenizerNzdata2vec-textdbrxdebertaDebertaTokenizerDebertaTokenizerFastz
deberta-v2DebertaV2TokenizerDebertaV2TokenizerFastdeepseek_v2deepseek_v3deepseek_vldeepseek_vl_hybrid)dia)DiaTokenizerN	diffllama
distilbertDistilBertTokenizerDistilBertTokenizerFastdprDPRQuestionEncoderTokenizerDPRQuestionEncoderTokenizerFastelectraElectraTokenizerElectraTokenizerFastemu3ernieernie4_5ernie4_5_moeernie_mErnieMTokenizer)esm)EsmTokenizerNexaone4falconfalcon_mambaGPTNeoXTokenizerFastfastspeech2_conformerFastSpeech2ConformerTokenizer)flaubert)FlaubertTokenizerNfnetFNetTokenizerFNetTokenizerFast)fsmt)FSMTTokenizerNfunnelFunnelTokenizerFunnelTokenizerFastgemmaGemmaTokenizerGemmaTokenizerFastgemma2gemma3gemma3_textgemma3ngemma3n_textgitglmglm4glm4_moeglm4v	glm4v_moezgpt-sw3GPTSw3Tokenizergpt2gpt_bigcodegpt_neogpt_neox)gpt_neox_japanese)GPTNeoXJapaneseTokenizerNgpt_ossgptj)zgptsan-japanese)GPTSanJapaneseTokenizerN)graniterJ   N)
granitemoer   )granitemoehybridr   )granitemoesharedr   zgrounding-dinogroupvitheliumherbertHerbertTokenizerHerbertTokenizerFast)hubertrv   ibertideficsidefics2idefics3instructblipinstructblipvideointernvljambajanusjetmoe)jukebox)JukeboxTokenizerNzkosmos-2XLMRobertaTokenizerXLMRobertaTokenizerFastz
kosmos-2.5layoutlmLayoutLMTokenizerLayoutLMTokenizerFast
layoutlmv2LayoutLMv2TokenizerLayoutLMv2TokenizerFast
layoutlmv3LayoutLMv3TokenizerLayoutLMv3TokenizerFast	layoutxlmLayoutXLMTokenizerLayoutXLMTokenizerFastledLEDTokenizerLEDTokenizerFastliltllamallama4llama4_textllava
llava_nextllava_next_videollava_onevision
longformerLongformerTokenizerLongformerTokenizerFastlongt5T5TokenizerT5TokenizerFast)luke)LukeTokenizerNlxmertLxmertTokenizerLxmertTokenizerFastm2m_100M2M100Tokenizermambamamba2marianMarianTokenizermbartMBartTokenizerMBartTokenizerFastmbart50MBart50TokenizerMBart50TokenizerFastmegazmegatron-bert
metaclip_2)zmgp-str)MgpstrTokenizerNminimaxmistralMistralCommonTokenizermixtralmllamamlukeMLukeTokenizerzmm-grounding-dino
mobilebertMobileBertTokenizerMobileBertTokenizerFast
modernbert	moonshinemoshimpnetMPNetTokenizerMPNetTokenizerFastmptmramt5MT5TokenizerMT5TokenizerFastmusicgenmusicgen_melodymvpMvpTokenizerMvpTokenizerFast)myt5)MyT5TokenizerNnemotronnezhanllbNllbTokenizerNllbTokenizerFastznllb-moenystromformerolmoolmo2olmoezomdet-turbo	oneformerz
openai-gptOpenAIGPTTokenizerOpenAIGPTTokenizerFastoptowlv2owlvit	paligemmapegasus	pegasus_x)	perceiver)PerceiverTokenizerN	persimmonphiphi3phimoe)phobert)PhobertTokenizerN
pix2structpixtralplbartPLBartTokenizer)
prophetnet)ProphetNetTokenizerNqdqbertqwen2qwen2_5_omni
qwen2_5_vlqwen2_audio	qwen2_moeqwen2_vlqwen3	qwen3_moe)rag)RagTokenizerNrealmRealmTokenizerRealmTokenizerFastrecurrent_gemmareformerReformerTokenizerReformerTokenizerFastrembertRemBertTokenizerRemBertTokenizerFast	retribertRetriBertTokenizerRetriBertTokenizerFastrobertazroberta-prelayernorm)roc_bert)RoCBertTokenizerNroformerRoFormerTokenizerRoFormerTokenizerFastrwkvseamless_m4tSeamlessM4TTokenizerSeamlessM4TTokenizerFastseamless_m4t_v2shieldgemma2siglipSiglipTokenizersiglip2smollm3speech_to_textSpeech2TextTokenizer)speech_to_text_2)Speech2Text2TokenizerNspeecht5SpeechT5Tokenizer)splinter)SplinterTokenizerSplinterTokenizerFastsqueezebertSqueezeBertTokenizerSqueezeBertTokenizerFaststablelm
starcoder2switch_transformerst5t5gemma)tapas)TapasTokenizerN)tapex)TapexTokenizerN)z
transfo-xl)TransfoXLTokenizerNtvpudopUdopTokenizerUdopTokenizerFastumt5video_llavaviltvipllavavisual_bert)vits)VitsTokenizerNvoxtral)wav2vec2rv   )zwav2vec2-bertrv   )zwav2vec2-conformerrv   )wav2vec2_phoneme)Wav2Vec2PhonemeCTCTokenizerNwhisperWhisperTokenizerWhisperTokenizerFastxclipxglmXGLMTokenizerXGLMTokenizerFast)xlm)XLMTokenizerNzxlm-prophetnetXLMProphetNetTokenizerzxlm-robertazxlm-roberta-xlxlnetXLNetTokenizerXLNetTokenizerFastxlstmxmodyosozambazamba2
class_namereturnc                    | dk(  rt         S t        j                         D ]\  \  }}| |v st        |      }|dv r| dk(  rt	        j
                  dd      }nt	        j
                  d| d      }	 t        ||       c S  t        j                  j                         D ]  }|D ]  }t        |dd       | k(  s|c c S  ! t	        j
                  d      }t        ||       rt        ||       S y # t        $ r Y w xY w)	Nr   )r	  r  r
  z.tokenization_mistral_commontransformers.ztransformers.models__name__)r   TOKENIZER_MAPPING_NAMESitemsr   	importlibimport_modulegetattrAttributeErrorTOKENIZER_MAPPING_extra_contentvalueshasattr)r  module_name
tokenizersmodule	tokenizermain_modules         h/var/www/html/eduruby.in/venv/lib/python3.12/site-packages/transformers/models/auto/tokenization_auto.pytokenizer_class_from_namer    s   ..&&#:#@#@#B 
Z#3K@K44G_9_"001OQ_`"001[M1BDYZvz22
 (66==? !
# 	!Iy*d3zA  	!! )).9K{J'{J// " s   0C--	C98C9pretrained_model_name_or_path	cache_dirforce_downloadresume_downloadproxiestokenrevisionlocal_files_only	subfolderc	                    |	j                  dd      }
|
)t        j                  dt               |t	        d      |
}|	j                  d      }t        | t        ||||||||ddd|      }|t        j                  d       i S t        ||      }t        |d	
      5 }t        j                  |      }ddd       |d<   |S # 1 sw Y   xY w)a  
    Loads the tokenizer configuration from a pretrained model tokenizer configuration.

    Args:
        pretrained_model_name_or_path (`str` or `os.PathLike`):
            This can be either:

            - a string, the *model id* of a pretrained model configuration hosted inside a model repo on
              huggingface.co.
            - a path to a *directory* containing a configuration file saved using the
              [`~PreTrainedTokenizer.save_pretrained`] method, e.g., `./my_model_directory/`.

        cache_dir (`str` or `os.PathLike`, *optional*):
            Path to a directory in which a downloaded pretrained model configuration should be cached if the standard
            cache should not be used.
        force_download (`bool`, *optional*, defaults to `False`):
            Whether or not to force to (re-)download the configuration files and override the cached versions if they
            exist.
        resume_download:
            Deprecated and ignored. All downloads are now resumed by default when possible.
            Will be removed in v5 of Transformers.
        proxies (`dict[str, str]`, *optional*):
            A dictionary of proxy servers to use by protocol or endpoint, e.g., `{'http': 'foo.bar:3128',
            'http://hostname': 'foo.bar:4012'}.` The proxies are used on each request.
        token (`str` or *bool*, *optional*):
            The token to use as HTTP bearer authorization for remote files. If `True`, will use the token generated
            when running `hf auth login` (stored in `~/.huggingface`).
        revision (`str`, *optional*, defaults to `"main"`):
            The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a
            git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any
            identifier allowed by git.
        local_files_only (`bool`, *optional*, defaults to `False`):
            If `True`, will only try to load the tokenizer configuration from local files.
        subfolder (`str`, *optional*, defaults to `""`):
            In case the tokenizer config is located inside a subfolder of the model repo on huggingface.co, you can
            specify the folder name here.

    <Tip>

    Passing `token=True` is required when you want to use a private model.

    </Tip>

    Returns:
        `dict`: The configuration of the tokenizer.

    Examples:

    ```python
    # Download configuration from huggingface.co and cache.
    tokenizer_config = get_tokenizer_config("google-bert/bert-base-uncased")
    # This model does not have a tokenizer config so the result will be an empty dict.
    tokenizer_config = get_tokenizer_config("FacebookAI/xlm-roberta-base")

    # Save a pretrained tokenizer locally and you can reload its config
    from transformers import AutoTokenizer

    tokenizer = AutoTokenizer.from_pretrained("google-bert/bert-base-cased")
    tokenizer.save_pretrained("tokenizer-test")
    tokenizer_config = get_tokenizer_config("tokenizer-test")
    ```use_auth_tokenNrThe `use_auth_token` argument is deprecated and will be removed in v5 of Transformers. Please use `token` instead.V`token` and `use_auth_token` are both specified. Please set only the argument `token`._commit_hashF)r  r  r  r  r  r  r  r   _raise_exceptions_for_gated_repo%_raise_exceptions_for_missing_entries'_raise_exceptions_for_connection_errorsr  z\Could not locate the tokenizer configuration file, will try to use the model config instead.zutf-8)encoding)popwarningswarnFutureWarning
ValueErrorgetr   r   loggerinfor   openjsonload)r  r  r  r  r  r  r  r  r  kwargsr  commit_hashresolved_config_filereaderresults                  r  get_tokenizer_configr  &  s    R ZZ 0$7N! A	
 uvv**^,K&%%'))..305   #rs	%&:KHK	"W	5 #6"#(F>M# #s   CCc                   N    e Zd ZdZd Ze ee      d               Ze	dd       Z
y)AutoTokenizera  
    This is a generic tokenizer class that will be instantiated as one of the tokenizer classes of the library when
    created with the [`AutoTokenizer.from_pretrained`] class method.

    This class cannot be instantiated directly using `__init__()` (throws an error).
    c                     t        d      )Nz}AutoTokenizer is designed to be instantiated using the `AutoTokenizer.from_pretrained(pretrained_model_name_or_path)` method.)OSError)selfs    r  __init__zAutoTokenizer.__init__  s    _
 	
    c           	      B	   |j                  dd      }|;t        j                  dt               |j	                  d      t        d      ||d<   |j                  dd      }d|d<   |j                  d	d      }|j                  d
d      }|j                  dd      }|j	                  d      }	|d}
t        j	                  |d      }|,t        d| ddj                  d t        D               d      |\  }}|r#|t        |      }
nt        j                  d       |
t        |      }
|
t        d| d       |
j                  |g|i |S t        |fi |}d|v r|d   |d<   |j	                  d      }d}d|v r4t        |d   t        t        f      r|d   }n|d   j	                  dd      }|t        |t               sM|	r3t#        ||	fi |}t%        |d      d   }t'        j(                  d(i |}nt'        j                  |fd|i|}|j*                  }t-        |d      rd|j.                  v r|j.                  d   }|du}t1        |      t2        v xs% |duxr t        |      duxs t        |dz         du}|r<|r|d   |d   }n|d   }d|v r|j5                  d      d   }nd}t7        |||||      }|rI|rGt9        |fi |}
|j                  dd      }|
j;                           |
j                  |g|d|i|S |[d}
|r!|j=                  d      s| d}t        |      }
|
|}t        |      }
|
t        d d        |
j                  |g|i |S t        |t>              rzt1        |j@                        t1        |jB                        urDt        j                  d!|jB                  jD                   d"|j@                  jD                   d#       |jB                  }tG        t1        |      jH                        }|Tt2        t1        |         \  }}|r|s| |j                  |g|i |S | |j                  |g|i |S t        d$      t        d%|jD                   d&dj                  d' t2        D               d      ))a]  
        Instantiate one of the tokenizer classes of the library from a pretrained model vocabulary.

        The tokenizer class to instantiate is selected based on the `model_type` property of the config object (either
        passed as an argument or loaded from `pretrained_model_name_or_path` if possible), or when it's missing, by
        falling back to using pattern matching on `pretrained_model_name_or_path`:

        List options

        Params:
            pretrained_model_name_or_path (`str` or `os.PathLike`):
                Can be either:

                    - A string, the *model id* of a predefined tokenizer hosted inside a model repo on huggingface.co.
                    - A path to a *directory* containing vocabulary files required by the tokenizer, for instance saved
                      using the [`~PreTrainedTokenizer.save_pretrained`] method, e.g., `./my_model_directory/`.
                    - A path or url to a single saved vocabulary file if and only if the tokenizer only requires a
                      single vocabulary file (like Bert or XLNet), e.g.: `./my_model_directory/vocab.txt`. (Not
                      applicable to all derived classes)
            inputs (additional positional arguments, *optional*):
                Will be passed along to the Tokenizer `__init__()` method.
            config ([`PretrainedConfig`], *optional*)
                The configuration object used to determine the tokenizer class to instantiate.
            cache_dir (`str` or `os.PathLike`, *optional*):
                Path to a directory in which a downloaded pretrained model configuration should be cached if the
                standard cache should not be used.
            force_download (`bool`, *optional*, defaults to `False`):
                Whether or not to force the (re-)download the model weights and configuration files and override the
                cached versions if they exist.
            resume_download:
                Deprecated and ignored. All downloads are now resumed by default when possible.
                Will be removed in v5 of Transformers.
            proxies (`dict[str, str]`, *optional*):
                A dictionary of proxy servers to use by protocol or endpoint, e.g., `{'http': 'foo.bar:3128',
                'http://hostname': 'foo.bar:4012'}`. The proxies are used on each request.
            revision (`str`, *optional*, defaults to `"main"`):
                The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a
                git-based system for storing models and other artifacts on huggingface.co, so `revision` can be any
                identifier allowed by git.
            subfolder (`str`, *optional*):
                In case the relevant files are located inside a subfolder of the model repo on huggingface.co (e.g. for
                facebook/rag-token-base), specify it here.
            use_fast (`bool`, *optional*, defaults to `True`):
                Use a [fast Rust-based tokenizer](https://huggingface.co/docs/tokenizers/index) if it is supported for
                a given model. If a fast tokenizer is not available for a given model, a normal Python-based tokenizer
                is returned instead.
            tokenizer_type (`str`, *optional*):
                Tokenizer type to be loaded.
            trust_remote_code (`bool`, *optional*, defaults to `False`):
                Whether or not to allow for custom models defined on the Hub in their own modeling files. This option
                should only be set to `True` for repositories you trust and in which you have read the code, as it will
                execute code present on the Hub on your local machine.
            kwargs (additional keyword arguments, *optional*):
                Will be passed to the Tokenizer `__init__()` method. Can be used to set special tokens like
                `bos_token`, `eos_token`, `unk_token`, `sep_token`, `pad_token`, `cls_token`, `mask_token`,
                `additional_special_tokens`. See parameters in the `__init__()` for more details.

        Examples:

        ```python
        >>> from transformers import AutoTokenizer

        >>> # Download vocabulary from huggingface.co and cache.
        >>> tokenizer = AutoTokenizer.from_pretrained("google-bert/bert-base-uncased")

        >>> # Download vocabulary from huggingface.co (user-uploaded) and cache.
        >>> tokenizer = AutoTokenizer.from_pretrained("dbmdz/bert-base-german-cased")

        >>> # If vocabulary files are in a directory (e.g. tokenizer was saved using *save_pretrained('./test/saved_model/')*)
        >>> # tokenizer = AutoTokenizer.from_pretrained("./test/bert_saved_model/")

        >>> # Download vocabulary from huggingface.co and define model-specific arguments
        >>> tokenizer = AutoTokenizer.from_pretrained("FacebookAI/roberta-base", add_prefix_space=True)
        ```r  Nr  r  r  configT
_from_autouse_fasttokenizer_typetrust_remote_code	gguf_filezPassed `tokenizer_type` z3 does not exist. `tokenizer_type` should be one of z, c              3       K   | ]  }|  y wN .0cs     r  	<genexpr>z0AutoTokenizer.from_pretrained.<locals>.<genexpr>  s      Dq Ds   r  zt`use_fast` is set to `True` but the tokenizer class does not have a fast version.  Falling back to the slow version.zTokenizer class z is not currently imported.r  tokenizer_classauto_mapr  F)return_tensorsFastr   r   z--code_revisionz- does not exist or is not currently imported.z The encoder model config class: z3 is different from the decoder model config class: z. It is not recommended to use the `AutoTokenizer.from_pretrained()` method in this case. Please use the encoder and decoder specific tokenizer classes.zzThis tokenizer cannot be instantiated. Please make sure you have `sentencepiece` installed in order to use this tokenizer.z!Unrecognized configuration class z8 to build an AutoTokenizer.
Model type should be one of c              3   4   K   | ]  }|j                     y wr  )r  r  s     r  r  z0AutoTokenizer.from_pretrained.<locals>.<genexpr>  s     4[AQZZ4[s   r  )%r  r  r  r  r  r  r  joinr  r  warningfrom_pretrainedr  
isinstancetuplelistr	   r   r   r   	for_modelr  r  r  typer  splitr   r
   register_for_auto_classendswithr   decoderencoder	__class__r   r  )clsr  inputsr  r  r  r  r  r  r  r  tokenizer_class_tupletokenizer_class_nametokenizer_fast_class_nametokenizer_configconfig_tokenizer_classtokenizer_auto_map	gguf_pathconfig_dicthas_remote_codehas_local_code	class_refupstream_repo_tokenizer_class_candidate
model_typetokenizer_class_pytokenizer_class_fasts                               r  r  zAutoTokenizer.from_pretrained  s   Z  $4d;%MM E zz'". l  -F7OHd+#|::j$/$4d;"JJ':DAJJ{+	 %"O$;$?$?PT$U!$, .~.>>qyy D,C DDEQH 
 ?T; ";,8&?@Y&ZONN= &";<P"Q& #34H3IId!eff2?223PdSYd]cdd 00MXQWX--%5n%EF>"!1!5!56G!H!))*:6F%5j%A"%5j%A%E%EoW[%\" ")f&67 +,I9 _X^ _I"6yQV"WX`"aK'11@K@F'775IZ^dF &,%;%;"vz*&///Q%+___%E",D8f):: 
"$. )*@AM Z,-Cf-LMUYY	 	 .q1=.q1	.q1	y  ) 5a 8 $ 9!#@.Racp! 0;IGdohnoO

?D1A3352?22-06J[_e  $/"O 6 ? ? G/E.Fd,K)";<U"V&,B)";<U"V& &'@&AAno  3?223PdSYd]cdd f23FNN#4+??6v~~7O7O6P Q%%+^^%=%=$> ?22 ^^F/V0E0EF
!7Hf7V4 4#5G5O;+;;<Ym\bmflmm%1=-==>[o^dohnoo$: 
 /0@0@/A B++/994[IZ4[+[*\\]_
 	
r  Nc                    ||t        d      |t        |t              rt        d      |t        |t              rt        d      |=|;t        |t              r+|j                  |k7  rt        d|j                   d| d      | t
        j                  v rt
        |    \  }}||}||}t
        j                  | ||f|       y)	a  
        Register a new tokenizer in this mapping.


        Args:
            config_class ([`PretrainedConfig`]):
                The configuration corresponding to the model to register.
            slow_tokenizer_class ([`PretrainedTokenizer`], *optional*):
                The slow tokenizer to register.
            fast_tokenizer_class ([`PretrainedTokenizerFast`], *optional*):
                The fast tokenizer to register.
        NzKYou need to pass either a `slow_tokenizer_class` or a `fast_tokenizer_classz:You passed a fast tokenizer in the `slow_tokenizer_class`.z:You passed a slow tokenizer in the `fast_tokenizer_class`.zThe fast tokenizer class you are passing has a `slow_tokenizer_class` attribute that is not consistent with the slow tokenizer class you passed (fast tokenizer has z and you passed z!. Fix one of those so they match!)exist_ok)r  
issubclassr   r   slow_tokenizer_classr  r  register)config_classr  fast_tokenizer_classr  existing_slowexisting_fasts         r  r  zAutoTokenizer.register  s     ',@,Hjkk+
;OQh0iYZZ+
;OQd0eYZZ !,$0/1HI$99=QQ['<<==MNbMc d!!  ,;;;+<\+J(M=#+'4$#+'4$""<2FH\1]hp"qr  )NNF)r  
__module____qualname____doc__r  classmethodr   r  r  staticmethodr  r  r  r  r  r    sH    
 &'>?`
 @ `
D )r )rr  r  r  )NFNNNNF )<r$  r  r  osr  collectionsr   typingr   r   r   transformers.utils.import_utilsr   configuration_utilsr	   dynamic_module_utilsr
   r   modeling_gguf_pytorch_utilsr   tokenization_utilsr   tokenization_utils_baser   utilsr   r   r   r   r   r   encoder_decoderr   auto_factoryr   configuration_autor   r   r   r   r   tokenization_utils_fastr   
get_loggerr  r  strr  r  r  r  CONFIG_TO_TYPEr  r  PathLikebooldictr  r  __all__)kvs   00r  <module>r?     sn"      	  # ' ' G 3 \ ? 5 <  3 *  B" 
		H	% P+c5#1M+N&NOD'>'@#d	
D %?%A!t)@)B%	
D 
?;R;T$7Z^_`D  
#=T=V%9\`ab!D" 
"<S<U$8[_`a#D$ 
7N7P3VZ[\%D& 
/:Q:S#6Y]^_'D( 	9)D, &@&B"*A*C&	
+D8 	09D: 
/:Q:S#6Y]^_;D< 
:T:V6\`bfgh=D> 	;?D@ 	2ADD &@&B"*A*C&	
CDP 
/KbKd1GjnopQDR 	.SDT 
D7N7P3VZ[\UDV 	KWDX 	AYDZ 
/:Q:S#6Y]^_[D\ 
O<S<U%8[_`a]D^ 
41H1J-PTUV_D` 
+G^G`-CfjklaDb 
/:Q:S#6Y]^_cDd 	*eDh (B(D$$,C,E(4	
gDt 	.uDx $>$@ d(?(A$t	
wDD 
/BYB[+>aefgEDH "*A*C&	
GDV '>'@#d	
UDd '>'@#d	
cDp 	*qDt (B(D$$,C,E(4	
sD@ 
'CZC\)?bfghADB 
D3J3L/RVWXCDD 
T4K4M0SWXYEDF 
%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