

import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from .tokenization_lxmert import LxmertTokenizer


lowerCAmelCase__       = {"vocab_file": "vocab.txt", "tokenizer_file": "tokenizer.json"}

lowerCAmelCase__       = {
    "vocab_file": {
        "unc-nlp/lxmert-base-uncased": "https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/vocab.txt",
    },
    "tokenizer_file": {
        "unc-nlp/lxmert-base-uncased": (
            "https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/tokenizer.json"
        ),
    },
}

lowerCAmelCase__       = {
    "unc-nlp/lxmert-base-uncased": 512,
}

lowerCAmelCase__       = {
    "unc-nlp/lxmert-base-uncased": {"do_lower_case": True},
}






class 						__magic_name__    (       _snake_case    ):
 UpperCAmelCase							    =						VOCAB_FILES_NAMES
 UpperCAmelCase							    =						PRETRAINED_VOCAB_FILES_MAP
 UpperCAmelCase							    =						PRETRAINED_INIT_CONFIGURATION
 UpperCAmelCase							    =						PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
 UpperCAmelCase							    =						LxmertTokenizer


 def __init__(						self		: Optional[int]			,						lowerCAmelCase__		: List[str]=None			,						lowerCAmelCase__		: List[str]=None			,						lowerCAmelCase__		: List[Any]=True			,						lowerCAmelCase__		: List[str]="[UNK]"			,						lowerCAmelCase__		: Dict="[SEP]"			,						lowerCAmelCase__		: Any="[PAD]"			,						lowerCAmelCase__		: List[str]="[CLS]"			,						lowerCAmelCase__		: Union[str, Any]="[MASK]"			,						lowerCAmelCase__		: Tuple=True			,						lowerCAmelCase__		: Any=None			,						**lowerCAmelCase__		: Optional[int]			,						)    ->      List[str]:
   super().__init__(
       lowerCAmelCase__			,						tokenizer_file=lowerCAmelCase__			,						do_lower_case=lowerCAmelCase__			,						unk_token=lowerCAmelCase__			,						sep_token=lowerCAmelCase__			,						pad_token=lowerCAmelCase__			,						cls_token=lowerCAmelCase__			,						mask_token=lowerCAmelCase__			,						tokenize_chinese_chars=lowerCAmelCase__			,						strip_accents=lowerCAmelCase__			,						**lowerCAmelCase__			,						)

   UpperCAmelCase					      =  json.loads(self.backend_tokenizer.normalizer.__getstate__()    )
   if (
       normalizer_state.get("lowercase"			,						lowerCAmelCase__    ) != do_lower_case
       or normalizer_state.get("strip_accents"			,						lowerCAmelCase__    ) != strip_accents
       or normalizer_state.get("handle_chinese_chars"			,						lowerCAmelCase__    ) != tokenize_chinese_chars
   ):
     UpperCAmelCase					      =  getattr(lowerCAmelCase__			,						normalizer_state.pop("type"    )    )
     UpperCAmelCase					      =  do_lower_case
     UpperCAmelCase					      =  strip_accents
     UpperCAmelCase					      =  tokenize_chinese_chars
     UpperCAmelCase					      =  normalizer_class(**lowerCAmelCase__    )

   UpperCAmelCase					      =  do_lower_case


 def _UpperCamelCase	(						self		: Dict			,						lowerCAmelCase__		: Union[str, Any]			,						lowerCAmelCase__		: Dict=None    )    ->      Optional[Any]:
   UpperCAmelCase					      =  [self.cls_token_id] + token_ids_a + [self.sep_token_id]

   if token_ids_a:
     output += token_ids_a + [self.sep_token_id]

   return output


 def _UpperCamelCase	(						self		: Optional[Any]			,						lowerCAmelCase__		: List[int]			,						lowerCAmelCase__		: Optional[List[int]] = None    )    ->      List[int]:
   UpperCAmelCase					      =  [self.sep_token_id]
   UpperCAmelCase					      =  [self.cls_token_id]
   if token_ids_a is None:
     return len(cls + token_ids_a + sep    ) * [0]
   return len(cls + token_ids_a + sep    ) * [0] + len(token_ids_a + sep    ) * [1]


 def _UpperCamelCase	(						self		: List[Any]			,						lowerCAmelCase__		: str			,						lowerCAmelCase__		: Optional[str] = None    )    ->      Tuple[str]:
   UpperCAmelCase					      =  self._tokenizer.model.save(lowerCAmelCase__			,						name=lowerCAmelCase__    )
   return tuple(lowerCAmelCase__    )






from . import (
    albert,
    align,
    altclip,
    audio_spectrogram_transformer,
    auto,
    autoformer,
    bark,
    bart,
    barthez,
    bartpho,
    beit,
    bert,
    bert_generation,
    bert_japanese,
    bertweet,
    big_bird,
    bigbird_pegasus,
    biogpt,
    bit,
    blenderbot,
    blenderbot_small,
    blip,
    blip_a,
    bloom,
    bridgetower,
    byta,
    camembert,
    canine,
    chinese_clip,
    clap,
    clip,
    clipseg,
    codegen,
    conditional_detr,
    convbert,
    convnext,
    convnextva,
    cpm,
    cpmant,
    ctrl,
    cvt,
    dataavec,
    deberta,
    deberta_va,
    decision_transformer,
    deformable_detr,
    deit,
    deprecated,
    deta,
    detr,
    dialogpt,
    dinat,
    distilbert,
    dit,
    donut,
    dpr,
    dpt,
    efficientformer,
    efficientnet,
    electra,
    encodec,
    encoder_decoder,
    ernie,
    ernie_m,
    esm,
    falcon,
    flaubert,
    flava,
    fnet,
    focalnet,
    fsmt,
    funnel,
    git,
    glpn,
    gpta,
    gpt_bigcode,
    gpt_neo,
    gpt_neox,
    gpt_neox_japanese,
    gpt_swa,
    gptj,
    gptsan_japanese,
    graphormer,
    groupvit,
    herbert,
    hubert,
    ibert,
    imagegpt,
    informer,
    instructblip,
    jukebox,
    layoutlm,
    layoutlmva,
    layoutlmva,
    layoutxlm,
    led,
    levit,
    lilt,
    llama,
    longformer,
    longta,
    luke,
    lxmert,
    mam_aaa,
    marian,
    markuplm,
    maskaformer,
    maskformer,
    mbart,
    mbartaa,
    mega,
    megatron_bert,
    megatron_gpta,
    mgp_str,
    mluke,
    mobilebert,
    mobilenet_va,
    mobilenet_va,
    mobilevit,
    mobilevitva,
    mpnet,
    mra,
    mta,
    musicgen,
    mvp,
    nat,
    nezha,
    nllb,
    nllb_moe,
    nystromformer,
    oneformer,
    open_llama,
    openai,
    opt,
    owlvit,
    pegasus,
    pegasus_x,
    perceiver,
    phobert,
    pixastruct,
    plbart,
    poolformer,
    prophetnet,
    qdqbert,
    rag,
    realm,
    reformer,
    regnet,
    rembert,
    resnet,
    roberta,
    roberta_prelayernorm,
    roc_bert,
    roformer,
    rwkv,
    sam,
    segformer,
    sew,
    sew_d,
    speech_encoder_decoder,
    speech_to_text,
    speech_to_text_a,
    speechta,
    splinter,
    squeezebert,
    swiftformer,
    swin,
    swinasr,
    swinva,
    switch_transformers,
    ta,
    table_transformer,
    tapas,
    time_series_transformer,
    timesformer,
    timm_backbone,
    transfo_xl,
    trocr,
    tvlt,
    umta,
    unispeech,
    unispeech_sat,
    upernet,
    videomae,
    vilt,
    vision_encoder_decoder,
    vision_text_dual_encoder,
    visual_bert,
    vit,
    vit_hybrid,
    vit_mae,
    vit_msn,
    vivit,
    wavaveca,
    wavaveca_conformer,
    wavaveca_phoneme,
    wavaveca_with_lm,
    wavlm,
    whisper,
    x_clip,
    xglm,
    xlm,
    xlm_prophetnet,
    xlm_roberta,
    xlm_roberta_xl,
    xlnet,
    xmod,
    yolos,
    yoso,
)



