





from typing import List

from ...configuration_utils import PretrainedConfig
from ...utils import logging


lowerCAmelCase_						   =    logging.get_logger(__name__)

lowerCAmelCase_						   =    {
    """snap-research/efficientformer-l1-300""": (
        """https://huggingface.co/snap-research/efficientformer-l1-300/resolve/main/config.json"""
    ),
}



class        _lowerCAmelCase    (			UpperCAmelCase_							):


  '''simple docstring'''
  a_							:       Optional[int]      					="""efficientformer"""







  def __init__(      self      :					Dict      ,				UpperCamelCase      :					List[int] = [3, 2, 6, 4]      ,				UpperCamelCase      :					List[int] = [48, 96, 2_24, 4_48]      ,				UpperCamelCase      :					List[bool] = [True, True, True, True]      ,				UpperCamelCase      :					int = 4_48      ,				UpperCamelCase      :					int = 32      ,				UpperCamelCase      :					int = 4      ,				UpperCamelCase      :					int = 7      ,				UpperCamelCase      :					int = 5      ,				UpperCamelCase      :					int = 8      ,				UpperCamelCase      :					int = 4      ,				UpperCamelCase      :					float = 0.0      ,				UpperCamelCase      :					int = 16      ,				UpperCamelCase      :					int = 3      ,				UpperCamelCase      :					int = 3      ,				UpperCamelCase      :					int = 3      ,				UpperCamelCase      :					int = 2      ,				UpperCamelCase      :					int = 1      ,				UpperCamelCase      :					float = 0.0      ,				UpperCamelCase      :					int = 1      ,				UpperCamelCase      :					bool = True      ,				UpperCamelCase      :					bool = True      ,				UpperCamelCase      :					float = 1e-5      ,				UpperCamelCase      :					str = "gelu"      ,				UpperCamelCase      :					float = 0.02      ,				UpperCamelCase      :					float = 1e-1_2      ,				UpperCamelCase      :					int = 2_24      ,				UpperCamelCase      :					float = 1e-0_5      ,				**UpperCamelCase      :					int      ,				)     ->   None:


    '''simple docstring'''





    super().__init__(**__A							)

    _snake_case   :				int														=	hidden_act
    _snake_case   :				List[str]														=	hidden_dropout_prob
    _snake_case   :				Dict														=	hidden_sizes
    _snake_case   :				List[str]														=	num_hidden_layers
    _snake_case   :				Tuple														=	num_attention_heads
    _snake_case   :				Optional[int]														=	initializer_range
    _snake_case   :				Optional[int]														=	layer_norm_eps
    _snake_case   :				Dict														=	patch_size
    _snake_case   :				Dict														=	num_channels
    _snake_case   :				Optional[Any]														=	depths
    _snake_case   :				str														=	mlp_expansion_ratio
    _snake_case   :				Any														=	downsamples
    _snake_case   :				List[str]														=	dim
    _snake_case   :				Union[str, Any]														=	key_dim
    _snake_case   :				str														=	attention_ratio
    _snake_case   :				Any														=	resolution
    _snake_case   :				Any														=	pool_size
    _snake_case   :				int														=	downsample_patch_size
    _snake_case   :				List[str]														=	downsample_stride
    _snake_case   :				str														=	downsample_pad
    _snake_case   :				Dict														=	drop_path_rate
    _snake_case   :				Union[str, Any]														=	num_metaad_blocks
    _snake_case   :				List[str]														=	distillation
    _snake_case   :				Optional[int]														=	use_layer_scale
    _snake_case   :				List[Any]														=	layer_scale_init_value
    _snake_case   :				Dict														=	image_size
    _snake_case   :				Optional[int]														=	batch_norm_eps











import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

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


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

lowerCAmelCase_						   =    {
    """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_						   =    {
    """unc-nlp/lxmert-base-uncased""": 512,
}

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



class        _lowerCAmelCase    (			UpperCAmelCase_							):


  '''simple docstring'''
  a_							:       List[Any]      					=VOCAB_FILES_NAMES
  a_							:       Tuple      					=PRETRAINED_VOCAB_FILES_MAP
  a_							:       Optional[Any]      					=PRETRAINED_INIT_CONFIGURATION
  a_							:       Any      					=PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
  a_							:       Any      					=LxmertTokenizer







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


    '''simple docstring'''





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

    _snake_case   :				Tuple														=	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
    ):
      _snake_case   :				List[Any]														=	getattr(UpperCamelCase      ,				normalizer_state.pop('type'							)							)
      _snake_case   :				Optional[int]														=	do_lower_case
      _snake_case   :				Dict														=	strip_accents
      _snake_case   :				Optional[int]														=	tokenize_chinese_chars
      _snake_case   :				Optional[Any]														=	normalizer_class(**UpperCamelCase							)

    _snake_case   :				int														=	do_lower_case







  def UpperCamelCase_ (      self      :					int      ,				UpperCamelCase      :					List[str]      ,				UpperCamelCase      :					str=None							):


    '''simple docstring'''





    _snake_case   :				List[Any]														=	[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      :					List[str]      ,				UpperCamelCase      :					List[int]      ,				UpperCamelCase      :					Optional[List[int]] = None							):


    '''simple docstring'''





    _snake_case   :				Tuple														=	[self.sep_token_id]
    _snake_case   :				List[str]														=	[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      :					int      ,				UpperCamelCase      :					str      ,				UpperCamelCase      :					Optional[str] = None							):


    '''simple docstring'''





    _snake_case   :				int														=	self._tokenizer.model.save(UpperCamelCase      ,				name=UpperCamelCase							)
    return tuple(UpperCamelCase							)




