




"""simple docstring"""



import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

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


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

SCREAMING_SNAKE_CASE    =	{
    "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"
        ),
    },
}

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

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




class      UpperCAmelCase_  (						A_							):
    lowercase__						 =				VOCAB_FILES_NAMES
    lowercase__						 =				PRETRAINED_VOCAB_FILES_MAP
    lowercase__						 =				PRETRAINED_INIT_CONFIGURATION
    lowercase__						 =				PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
    lowercase__						 =				LxmertTokenizer




    def __init__(   self						:	int     ,			snake_case_						:	List[str]=None     ,			snake_case_						:	List[str]=None     ,			snake_case_						:	int=True     ,			snake_case_						:	str="[UNK]"     ,			snake_case_						:	int="[SEP]"     ,			snake_case_						:	Any="[PAD]"     ,			snake_case_						:	Union[str, Any]="[CLS]"     ,			snake_case_						:	Tuple="[MASK]"     ,			snake_case_						:	int=True     ,			snake_case_						:	Optional[int]=None     ,			**snake_case_						:	Tuple     ,			)				->							Tuple:




     '''simple docstring'''

     super().__init__(
         snake_case_     ,			tokenizer_file=snake_case_     ,			do_lower_case=snake_case_     ,			unk_token=snake_case_     ,			sep_token=snake_case_     ,			pad_token=snake_case_     ,			cls_token=snake_case_     ,			mask_token=snake_case_     ,			tokenize_chinese_chars=snake_case_     ,			strip_accents=snake_case_     ,			**snake_case_     ,			)

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

     A__	=    do_lower_case




    def 							__magic_name__							(   self						:	Any     ,			snake_case_						:	str     ,			snake_case_						:	int=None				)				->							str:




     '''simple docstring'''

     A__	=    [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 							__magic_name__							(   self						:	Dict     ,			snake_case_						:	List[int]     ,			snake_case_						:	Optional[List[int]] = None				)				->							List[int]:




     '''simple docstring'''

     A__	=    [self.sep_token_id]
     A__	=    [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 							__magic_name__							(   self						:	List[str]     ,			snake_case_						:	str     ,			snake_case_						:	Optional[str] = None				)				->							Tuple[str]:




     '''simple docstring'''

     A__	=    self._tokenizer.model.save(snake_case_     ,			name=snake_case_				)
     return tuple(snake_case_				)











"""simple docstring"""



from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_tf_available,
    is_torch_available,
    is_vision_available,
)


SCREAMING_SNAKE_CASE    =	{
    "configuration_mobilevit": ["MOBILEVIT_PRETRAINED_CONFIG_ARCHIVE_MAP", "MobileViTConfig", "MobileViTOnnxConfig"],
}

try:
      if not is_vision_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      SCREAMING_SNAKE_CASE    =	["MobileViTFeatureExtractor"]
      SCREAMING_SNAKE_CASE    =	["MobileViTImageProcessor"]

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      SCREAMING_SNAKE_CASE    =	[
          "MOBILEVIT_PRETRAINED_MODEL_ARCHIVE_LIST",
          "MobileViTForImageClassification",
          "MobileViTForSemanticSegmentation",
          "MobileViTModel",
          "MobileViTPreTrainedModel",
      ]

try:
      if not is_tf_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      SCREAMING_SNAKE_CASE    =	[
          "TF_MOBILEVIT_PRETRAINED_MODEL_ARCHIVE_LIST",
          "TFMobileViTForImageClassification",
          "TFMobileViTForSemanticSegmentation",
          "TFMobileViTModel",
          "TFMobileViTPreTrainedModel",
      ]

if TYPE_CHECKING:
      from .configuration_mobilevit import MOBILEVIT_PRETRAINED_CONFIG_ARCHIVE_MAP, MobileViTConfig, MobileViTOnnxConfig

      try:
            if not is_vision_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .feature_extraction_mobilevit import MobileViTFeatureExtractor
            from .image_processing_mobilevit import MobileViTImageProcessor

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_mobilevit import (
                MOBILEVIT_PRETRAINED_MODEL_ARCHIVE_LIST,
                MobileViTForImageClassification,
                MobileViTForSemanticSegmentation,
                MobileViTModel,
                MobileViTPreTrainedModel,
            )

      try:
            if not is_tf_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_tf_mobilevit import (
                TF_MOBILEVIT_PRETRAINED_MODEL_ARCHIVE_LIST,
                TFMobileViTForImageClassification,
                TFMobileViTForSemanticSegmentation,
                TFMobileViTModel,
                TFMobileViTPreTrainedModel,
            )


else:
      import sys

      SCREAMING_SNAKE_CASE    =	_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)





