





"""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


__UpperCamelCase     :						Union[str, Any]						       =  {'''vocab_file''': '''vocab.txt''', '''tokenizer_file''': '''tokenizer.json'''}

__UpperCamelCase     :						int						       =  {
    '''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'''
        ),
    },
}

__UpperCamelCase     :						List[str]						       =  {
    '''unc-nlp/lxmert-base-uncased''': 512,
}

__UpperCamelCase     :						Optional[int]						       =  {
    '''unc-nlp/lxmert-base-uncased''': {'''do_lower_case''': True},
}







class       a							(   a__  ):
 snake_case__             =       VOCAB_FILES_NAMES
 snake_case__             =       PRETRAINED_VOCAB_FILES_MAP
 snake_case__             =       PRETRAINED_INIT_CONFIGURATION
 snake_case__             =       PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
 snake_case__             =       LxmertTokenizer



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







  """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				,       )

  lowerCAmelCase    				= 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
  ):
   lowerCAmelCase    				= getattr(_snake_case				,       normalizer_state.pop('type'     )     )
   lowerCAmelCase    				= do_lower_case
   lowerCAmelCase    				= strip_accents
   lowerCAmelCase    				= tokenize_chinese_chars
   lowerCAmelCase    				= normalizer_class(**_snake_case     )

  lowerCAmelCase    				= do_lower_case



 def    UpperCamelCase__  (     self				,       _snake_case				,       _snake_case=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    UpperCamelCase__  (     self				,       _snake_case				,       _snake_case = 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    UpperCamelCase__  (     self				,       _snake_case				,       _snake_case = None     ):







  """simple docstring"""






  lowerCAmelCase    				= self._tokenizer.model.save(_snake_case				,       name=_snake_case     )
  return tuple(_snake_case     )







from typing import TYPE_CHECKING

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


lowerCamelCase_    :			Union[str, Any]    =	{
    """configuration_tapas""": ["""TAPAS_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TapasConfig"""],
    """tokenization_tapas""": ["""TapasTokenizer"""],
}

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							lowerCamelCase_    :			List[Any]    =	[
							    """TAPAS_PRETRAINED_MODEL_ARCHIVE_LIST""",
							    """TapasForMaskedLM""",
							    """TapasForQuestionAnswering""",
							    """TapasForSequenceClassification""",
							    """TapasModel""",
							    """TapasPreTrainedModel""",
							    """load_tf_weights_in_tapas""",
							]
try:
							if not is_tf_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							lowerCamelCase_    :			Optional[Any]    =	[
							    """TF_TAPAS_PRETRAINED_MODEL_ARCHIVE_LIST""",
							    """TFTapasForMaskedLM""",
							    """TFTapasForQuestionAnswering""",
							    """TFTapasForSequenceClassification""",
							    """TFTapasModel""",
							    """TFTapasPreTrainedModel""",
							]


if TYPE_CHECKING:
							from .configuration_tapas import TAPAS_PRETRAINED_CONFIG_ARCHIVE_MAP, TapasConfig
							from .tokenization_tapas import TapasTokenizer

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_tapas import (
														    TAPAS_PRETRAINED_MODEL_ARCHIVE_LIST,
														    TapasForMaskedLM,
														    TapasForQuestionAnswering,
														    TapasForSequenceClassification,
														    TapasModel,
														    TapasPreTrainedModel,
														    load_tf_weights_in_tapas,
														)

							try:
														if not is_tf_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_tf_tapas import (
														    TF_TAPAS_PRETRAINED_MODEL_ARCHIVE_LIST,
														    TFTapasForMaskedLM,
														    TFTapasForQuestionAnswering,
														    TFTapasForSequenceClassification,
														    TFTapasModel,
														    TFTapasPreTrainedModel,
														)


else:
							import sys

							lowerCamelCase_    :			Any    =	_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)






