
from collections import OrderedDict
from typing import List, Mapping

from packaging import version

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


__lowerCamelCase							=       logging.get_logger(__name__)

__lowerCamelCase							=       {
    """google/efficientnet-b7""": """https://huggingface.co/google/efficientnet-b7/resolve/main/config.json""",
}






class   UpperCAmelCase		(						A_ ):
   A__					:		Any						     =     "efficientnet"



   def __init__(self		:					Optional[Any]    ,						snake_case__		:					int = 3    ,						snake_case__		:					int = 6_00    ,						snake_case__		:					float = 2.0    ,						snake_case__		:					float = 3.1    ,						snake_case__		:					int = 8    ,						snake_case__		:					List[int] = [3, 3, 5, 3, 5, 5, 3]    ,						snake_case__		:					List[int] = [32, 16, 24, 40, 80, 1_12, 1_92]    ,						snake_case__		:					List[int] = [16, 24, 40, 80, 1_12, 1_92, 3_20]    ,						snake_case__		:					List[int] = []    ,						snake_case__		:					List[int] = [1, 2, 2, 2, 1, 2, 1]    ,						snake_case__		:					List[int] = [1, 2, 2, 3, 3, 4, 1]    ,						snake_case__		:					List[int] = [1, 6, 6, 6, 6, 6, 6]    ,						snake_case__		:					float = 0.25    ,						snake_case__		:					str = "swish"    ,						snake_case__		:					int = 25_60    ,						snake_case__		:					str = "mean"    ,						snake_case__		:					float = 0.02    ,						snake_case__		:					float = 0.001    ,						snake_case__		:					float = 0.99    ,						snake_case__		:					float = 0.5    ,						snake_case__		:					float = 0.2    ,						**snake_case__		:					int    ,						)		->	Union[str, Any]:


          '''simple docstring'''


          super().__init__(**snake_case__ )

          snake_case       :   List[str]							=      num_channels
          snake_case       :   Optional[Any]							=      image_size
          snake_case       :   Any							=      width_coefficient
          snake_case       :   Any							=      depth_coefficient
          snake_case       :   Optional[int]							=      depth_divisor
          snake_case       :   Tuple							=      kernel_sizes
          snake_case       :   Dict							=      in_channels
          snake_case       :   Tuple							=      out_channels
          snake_case       :   Any							=      depthwise_padding
          snake_case       :   Optional[Any]							=      strides
          snake_case       :   Optional[int]							=      num_block_repeats
          snake_case       :   Optional[Any]							=      expand_ratios
          snake_case       :   List[Any]							=      squeeze_expansion_ratio
          snake_case       :   Any							=      hidden_act
          snake_case       :   Dict							=      hidden_dim
          snake_case       :   Optional[Any]							=      pooling_type
          snake_case       :   Optional[int]							=      initializer_range
          snake_case       :   Union[str, Any]							=      batch_norm_eps
          snake_case       :   Dict							=      batch_norm_momentum
          snake_case       :   Optional[Any]							=      dropout_rate
          snake_case       :   List[str]							=      drop_connect_rate
          snake_case       :   int							=      sum(snake_case__ ) * 4






class   UpperCAmelCase		(						A_ ):
   A__					:		List[str]						     =     version.parse("1.11" )



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


          '''simple docstring'''


          return OrderedDict(
              [
                  ("pixel_values", {0: "batch", 1: "num_channels", 2: "height", 3: "width"}),
              ] )



   @property
   def 				_SCREAMING_SNAKE_CASE   (self		:					List[Any] )		->	float:


          '''simple docstring'''


          return 1e-5







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""": 5_12,
}

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






class   UpperCAmelCase		(						A_ ):
   A__					:		Any						     =     VOCAB_FILES_NAMES
   A__					:		Optional[int]						     =     PRETRAINED_VOCAB_FILES_MAP
   A__					:		Tuple						     =     PRETRAINED_INIT_CONFIGURATION
   A__					:		Tuple						     =     PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
   A__					:		List[Any]						     =     LxmertTokenizer



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


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

          snake_case       :   int							=      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
          ):
                 snake_case       :   Union[str, Any]							=      getattr(snake_case__    ,						normalizer_state.pop("type" ) )
                 snake_case       :   str							=      do_lower_case
                 snake_case       :   List[Any]							=      strip_accents
                 snake_case       :   Optional[int]							=      tokenize_chinese_chars
                 snake_case       :   int							=      normalizer_class(**snake_case__ )

          snake_case       :   Optional[Any]							=      do_lower_case



   def 				_SCREAMING_SNAKE_CASE   (self		:					Union[str, Any]    ,						snake_case__		:					Optional[Any]    ,						snake_case__		:					Dict=None )		->	Any:


          '''simple docstring'''


          snake_case       :   Optional[int]							=      [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		:					Optional[int]    ,						snake_case__		:					List[int]    ,						snake_case__		:					Optional[List[int]] = None )		->	List[int]:


          '''simple docstring'''


          snake_case       :   Optional[Any]							=      [self.sep_token_id]
          snake_case       :   Optional[Any]							=      [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		:					Any    ,						snake_case__		:					str    ,						snake_case__		:					Optional[str] = None )		->	Tuple[str]:


          '''simple docstring'''


          snake_case       :   List[Any]							=      self._tokenizer.model.save(snake_case__    ,						name=snake_case__ )
          return tuple(snake_case__ )





