




import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

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


__lowerCAmelCase		:				Optional[int]       			=		{'vocab_file': 'vocab.txt', 'tokenizer_file': 'tokenizer.json'}

__lowerCAmelCase		:				List[Any]       			=		{
    '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		:				Tuple       			=		{
    'unc-nlp/lxmert-base-uncased': 512,
}

__lowerCAmelCase		:				int       			=		{
    'unc-nlp/lxmert-base-uncased': {'do_lower_case': True},
}




class     snake_case__							(snake_case_   ):
				"""simple docstring"""



				SCREAMING_SNAKE_CASE_       :							Any							 =					VOCAB_FILES_NAMES
				SCREAMING_SNAKE_CASE_       :							int							 =					PRETRAINED_VOCAB_FILES_MAP
				SCREAMING_SNAKE_CASE_       :							Any							 =					PRETRAINED_INIT_CONFIGURATION
				SCREAMING_SNAKE_CASE_       :							int							 =					PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
				SCREAMING_SNAKE_CASE_       :							Optional[Any]							 =					LxmertTokenizer





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

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

							a    =			do_lower_case





				def 							__UpperCAmelCase							(      self				:     Union[str, Any]					,      __lowerCamelCase				:     str					,      __lowerCamelCase				:     Dict=None							)					->     int:
							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 							__UpperCAmelCase							(      self				:     str					,      __lowerCamelCase				:     List[Any]					,      __lowerCamelCase				:     List[str] = None							)					->     List[int]:
							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 							__UpperCAmelCase							(      self				:     Any					,      __lowerCamelCase				:     Union[str, Any]					,      __lowerCamelCase				:     List[str] = None							)					->     Tuple[str]:
							a    =			self._tokenizer.model.save(UpperCamelCase__					,      name=UpperCamelCase__							)
							return tuple(UpperCamelCase__							)










"""simple docstring"""



from collections import OrderedDict
from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


__snake_case   			=    logging.get_logger(__name__)

__snake_case   			=    {
    """facebook/xmod-base""": """https://huggingface.co/facebook/xmod-base/resolve/main/config.json""",
    """facebook/xmod-large-prenorm""": """https://huggingface.co/facebook/xmod-large-prenorm/resolve/main/config.json""",
    """facebook/xmod-base-13-125k""": """https://huggingface.co/facebook/xmod-base-13-125k/resolve/main/config.json""",
    """facebook/xmod-base-30-125k""": """https://huggingface.co/facebook/xmod-base-30-125k/resolve/main/config.json""",
    """facebook/xmod-base-30-195k""": """https://huggingface.co/facebook/xmod-base-30-195k/resolve/main/config.json""",
    """facebook/xmod-base-60-125k""": """https://huggingface.co/facebook/xmod-base-60-125k/resolve/main/config.json""",
    """facebook/xmod-base-60-265k""": """https://huggingface.co/facebook/xmod-base-60-265k/resolve/main/config.json""",
    """facebook/xmod-base-75-125k""": """https://huggingface.co/facebook/xmod-base-75-125k/resolve/main/config.json""",
    """facebook/xmod-base-75-269k""": """https://huggingface.co/facebook/xmod-base-75-269k/resolve/main/config.json""",
}







class _lowerCAmelCase				(      snake_case_	):
   __UpperCAmelCase :       Optional[Any]							  =  '''xmod'''







   def __init__(	self						,	UpperCamelCase__=3_0522						,	UpperCamelCase__=768						,	UpperCamelCase__=12						,	UpperCamelCase__=12						,	UpperCamelCase__=3072						,	UpperCamelCase__="gelu"						,	UpperCamelCase__=0.1						,	UpperCamelCase__=0.1						,	UpperCamelCase__=512						,	UpperCamelCase__=2						,	UpperCamelCase__=0.02						,	UpperCamelCase__=1e-12						,	UpperCamelCase__=1						,	UpperCamelCase__=0						,	UpperCamelCase__=2						,	UpperCamelCase__="absolute"						,	UpperCamelCase__=True						,	UpperCamelCase__=None						,	UpperCamelCase__=False						,	UpperCamelCase__=2						,	UpperCamelCase__=False						,	UpperCamelCase__=True						,	UpperCamelCase__=True						,	UpperCamelCase__=("en_XX",)						,	UpperCamelCase__=None						,	**UpperCamelCase__						,	)	->		int:

       '''simple docstring'''




       super().__init__(pad_token_id=UpperCamelCase__						,	bos_token_id=UpperCamelCase__						,	eos_token_id=UpperCamelCase__						,	**UpperCamelCase__						)

       snake_case    :      List[Any]      					=    vocab_size
       snake_case    :      List[Any]      					=    hidden_size
       snake_case    :      Union[str, Any]      					=    num_hidden_layers
       snake_case    :      Any      					=    num_attention_heads
       snake_case    :      List[str]      					=    hidden_act
       snake_case    :      Union[str, Any]      					=    intermediate_size
       snake_case    :      int      					=    hidden_dropout_prob
       snake_case    :      Any      					=    attention_probs_dropout_prob
       snake_case    :      Optional[int]      					=    max_position_embeddings
       snake_case    :      Tuple      					=    type_vocab_size
       snake_case    :      List[str]      					=    initializer_range
       snake_case    :      int      					=    layer_norm_eps
       snake_case    :      Optional[Any]      					=    position_embedding_type
       snake_case    :      int      					=    use_cache
       snake_case    :      Dict      					=    classifier_dropout
       snake_case    :      Dict      					=    pre_norm
       snake_case    :      Union[str, Any]      					=    adapter_reduction_factor
       snake_case    :      Any      					=    adapter_layer_norm
       snake_case    :      Optional[int]      					=    adapter_reuse_layer_norm
       snake_case    :      List[Any]      					=    ln_before_adapter
       snake_case    :      str      					=    list(UpperCamelCase__						)
       snake_case    :      int      					=    default_language







class _lowerCAmelCase				(      snake_case_	):







   @property
   def  lowerCamelCase		(	self						)	->		Mapping[str, Mapping[int, str]]:

       '''simple docstring'''




       if self.task == "multiple-choice":
           snake_case    :      Optional[int]      					=    {0: "batch", 1: "choice", 2: "sequence"}
       else:
           snake_case    :      Optional[Any]      					=    {0: "batch", 1: "sequence"}
       return OrderedDict(
           [
               ("input_ids", dynamic_axis),
               ("attention_mask", dynamic_axis),
           ]						)





