



import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_layoutlm import LayoutLMTokenizer


UpperCamelCase													=		logging.get_logger(__name__)

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

UpperCamelCase													=		{
    """vocab_file""": {
        """microsoft/layoutlm-base-uncased""": (
            """https://huggingface.co/microsoft/layoutlm-base-uncased/resolve/main/vocab.txt"""
        ),
        """microsoft/layoutlm-large-uncased""": (
            """https://huggingface.co/microsoft/layoutlm-large-uncased/resolve/main/vocab.txt"""
        ),
    },
    """tokenizer_file""": {
        """microsoft/layoutlm-base-uncased""": (
            """https://huggingface.co/microsoft/layoutlm-base-uncased/resolve/main/tokenizer.json"""
        ),
        """microsoft/layoutlm-large-uncased""": (
            """https://huggingface.co/microsoft/layoutlm-large-uncased/resolve/main/tokenizer.json"""
        ),
    },
}

UpperCamelCase													=		{
    """microsoft/layoutlm-base-uncased""": 512,
    """microsoft/layoutlm-large-uncased""": 512,
}

UpperCamelCase													=		{
    """microsoft/layoutlm-base-uncased""": {"""do_lower_case""": True},
    """microsoft/layoutlm-large-uncased""": {"""do_lower_case""": True},
}



class 						snake_case_ (	snake_case__ ):
   __A			:	Tuple        =       VOCAB_FILES_NAMES
   __A			:	Dict        =       PRETRAINED_VOCAB_FILES_MAP
   __A			:	str        =       PRETRAINED_INIT_CONFIGURATION
   __A			:	int        =       PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
   __A			:	Any        =       LayoutLMTokenizer






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

       lowercase__				:     str					      =       json.loads(self.backend_tokenizer.normalizer.__getstate__()						)
       if (
           normalizer_state.get("lowercase"			,		lowercase_						) != do_lower_case
           or normalizer_state.get("strip_accents"			,		lowercase_						) != strip_accents
           or normalizer_state.get("handle_chinese_chars"			,		lowercase_						) != tokenize_chinese_chars
       ):
           lowercase__				:     Optional[int]					      =       getattr(lowercase_			,		normalizer_state.pop("type"						)						)
           lowercase__				:     List[Any]					      =       do_lower_case
           lowercase__				:     List[Any]					      =       strip_accents
           lowercase__				:     Dict					      =       tokenize_chinese_chars
           lowercase__				:     List[Any]					      =       normalizer_class(**lowercase_						)

       lowercase__				:     str					      =       do_lower_case






   def    __UpperCamelCase  (   self       :  Optional[Any]			,		lowercase_       :  Dict			,		lowercase_       :  List[str]=None						)      ->		Tuple:
       lowercase__				:     Dict					      =       [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[int]			,		lowercase_       :  List[int]			,		lowercase_       :  Optional[List[int]] = None						)      ->		Optional[int]:
       lowercase__				:     int					      =       [self.sep_token_id]
       lowercase__				:     int					      =       [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       :  Union[str, Any]			,		lowercase_       :  str			,		lowercase_       :  Optional[str] = None						)      ->		Tuple:
       lowercase__				:     Union[str, Any]					      =       self._tokenizer.model.save(lowercase_			,		name=lowercase_						)
       return tuple(lowercase_						)




from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


UpperCamelCase													=		{
    '''configuration_mobilenet_v1''': [
        '''MOBILENET_V1_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''MobileNetV1Config''',
        '''MobileNetV1OnnxConfig''',
    ],
}

try:
      if not is_vision_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      UpperCamelCase													=		['''MobileNetV1FeatureExtractor''']
      UpperCamelCase													=		['''MobileNetV1ImageProcessor''']

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      UpperCamelCase													=		[
          '''MOBILENET_V1_PRETRAINED_MODEL_ARCHIVE_LIST''',
          '''MobileNetV1ForImageClassification''',
          '''MobileNetV1Model''',
          '''MobileNetV1PreTrainedModel''',
          '''load_tf_weights_in_mobilenet_v1''',
      ]


if TYPE_CHECKING:
      from .configuration_mobilenet_va import (
          MOBILENET_V1_PRETRAINED_CONFIG_ARCHIVE_MAP,
          MobileNetVaConfig,
          MobileNetVaOnnxConfig,
      )

      try:
            if not is_vision_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .feature_extraction_mobilenet_va import MobileNetVaFeatureExtractor
            from .image_processing_mobilenet_va import MobileNetVaImageProcessor

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_mobilenet_va import (
                MOBILENET_V1_PRETRAINED_MODEL_ARCHIVE_LIST,
                MobileNetVaForImageClassification,
                MobileNetVaModel,
                MobileNetVaPreTrainedModel,
                load_tf_weights_in_mobilenet_va,
            )


else:
      import sys

      UpperCamelCase													=		_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)



