




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      a__       (   snake_case__ ):
						_a				:       Optional[Any]   =       VOCAB_FILES_NAMES
						_a				:       Optional[int]   =       PRETRAINED_VOCAB_FILES_MAP
						_a				:       Tuple   =       PRETRAINED_INIT_CONFIGURATION
						_a				:       Union[str, Any]   =       PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
						_a				:       List[str]   =       LayoutLMTokenizer






						def __init__(  self						,     _A=None						,     _A=None						,     _A=True						,     _A="[UNK]"						,     _A="[SEP]"						,     _A="[PAD]"						,     _A="[CLS]"						,     _A="[MASK]"						,     _A=True						,     _A=None						,     **_A						,     ):




											"""simple docstring"""



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

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

											__lowerCAmelCase							  =			do_lower_case






						def 							__SCREAMING_SNAKE_CASE(  self						,     _A						,     _A=None     ):




											"""simple docstring"""



											__lowerCAmelCase							  =			[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 							__SCREAMING_SNAKE_CASE(  self						,     _A						,     _A = None     ):




											"""simple docstring"""



											__lowerCAmelCase							  =			[self.sep_token_id]
											__lowerCAmelCase							  =			[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 							__SCREAMING_SNAKE_CASE(  self						,     _A						,     _A = None     ):




											"""simple docstring"""



											__lowerCAmelCase							  =			self._tokenizer.model.save(_A						,     name=_A     )
											return tuple(_A     )










from typing import TYPE_CHECKING

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


UpperCamelCase__            =     {"""configuration_vit_hybrid""": ["""VIT_HYBRID_PRETRAINED_CONFIG_ARCHIVE_MAP""", """ViTHybridConfig"""]}

try:
					if not is_torch_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					UpperCamelCase__            =     [
					    """VIT_HYBRID_PRETRAINED_MODEL_ARCHIVE_LIST""",
					    """ViTHybridForImageClassification""",
					    """ViTHybridModel""",
					    """ViTHybridPreTrainedModel""",
					]

try:
					if not is_vision_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					UpperCamelCase__            =     ["""ViTHybridImageProcessor"""]


if TYPE_CHECKING:
					from .configuration_vit_hybrid import VIT_HYBRID_PRETRAINED_CONFIG_ARCHIVE_MAP, ViTHybridConfig

					try:
										if not is_torch_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_vit_hybrid import (
										    VIT_HYBRID_PRETRAINED_MODEL_ARCHIVE_LIST,
										    ViTHybridForImageClassification,
										    ViTHybridModel,
										    ViTHybridPreTrainedModel,
										)

					try:
										if not is_vision_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .image_processing_vit_hybrid import ViTHybridImageProcessor


else:
					import sys

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




