"""simple docstring"""




from collections import OrderedDict
from typing import Mapping

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


_a      :		Union[str, Any]           =   logging.get_logger(__name__)

_a      :		str           =   {
    'bert-base-uncased': 'https://huggingface.co/bert-base-uncased/resolve/main/config.json',
    'bert-large-uncased': 'https://huggingface.co/bert-large-uncased/resolve/main/config.json',
    'bert-base-cased': 'https://huggingface.co/bert-base-cased/resolve/main/config.json',
    'bert-large-cased': 'https://huggingface.co/bert-large-cased/resolve/main/config.json',
    'bert-base-multilingual-uncased': 'https://huggingface.co/bert-base-multilingual-uncased/resolve/main/config.json',
    'bert-base-multilingual-cased': 'https://huggingface.co/bert-base-multilingual-cased/resolve/main/config.json',
    'bert-base-chinese': 'https://huggingface.co/bert-base-chinese/resolve/main/config.json',
    'bert-base-german-cased': 'https://huggingface.co/bert-base-german-cased/resolve/main/config.json',
    'bert-large-uncased-whole-word-masking': (
        'https://huggingface.co/bert-large-uncased-whole-word-masking/resolve/main/config.json'
    ),
    'bert-large-cased-whole-word-masking': (
        'https://huggingface.co/bert-large-cased-whole-word-masking/resolve/main/config.json'
    ),
    'bert-large-uncased-whole-word-masking-finetuned-squad': (
        'https://huggingface.co/bert-large-uncased-whole-word-masking-finetuned-squad/resolve/main/config.json'
    ),
    'bert-large-cased-whole-word-masking-finetuned-squad': (
        'https://huggingface.co/bert-large-cased-whole-word-masking-finetuned-squad/resolve/main/config.json'
    ),
    'bert-base-cased-finetuned-mrpc': 'https://huggingface.co/bert-base-cased-finetuned-mrpc/resolve/main/config.json',
    'bert-base-german-dbmdz-cased': 'https://huggingface.co/bert-base-german-dbmdz-cased/resolve/main/config.json',
    'bert-base-german-dbmdz-uncased': 'https://huggingface.co/bert-base-german-dbmdz-uncased/resolve/main/config.json',
    'cl-tohoku/bert-base-japanese': 'https://huggingface.co/cl-tohoku/bert-base-japanese/resolve/main/config.json',
    'cl-tohoku/bert-base-japanese-whole-word-masking': (
        'https://huggingface.co/cl-tohoku/bert-base-japanese-whole-word-masking/resolve/main/config.json'
    ),
    'cl-tohoku/bert-base-japanese-char': (
        'https://huggingface.co/cl-tohoku/bert-base-japanese-char/resolve/main/config.json'
    ),
    'cl-tohoku/bert-base-japanese-char-whole-word-masking': (
        'https://huggingface.co/cl-tohoku/bert-base-japanese-char-whole-word-masking/resolve/main/config.json'
    ),
    'TurkuNLP/bert-base-finnish-cased-v1': (
        'https://huggingface.co/TurkuNLP/bert-base-finnish-cased-v1/resolve/main/config.json'
    ),
    'TurkuNLP/bert-base-finnish-uncased-v1': (
        'https://huggingface.co/TurkuNLP/bert-base-finnish-uncased-v1/resolve/main/config.json'
    ),
    'wietsedv/bert-base-dutch-cased': 'https://huggingface.co/wietsedv/bert-base-dutch-cased/resolve/main/config.json',
    # See all BERT models at https://huggingface.co/models?filter=bert
}
class 						__A							( SCREAMING_SNAKE_CASE_		):
     _UpperCamelCase							:			Optional[int]							=		"bert"






     def __init__(		self				,     a__=30522				,     a__=768				,     a__=12				,     a__=12				,     a__=3072				,     a__="gelu"				,     a__=0.1				,     a__=0.1				,     a__=512				,     a__=2				,     a__=0.0_2				,     a__=1e-12				,     a__=0				,     a__="absolute"				,     a__=True				,     a__=None				,     **a__				,     ):
       super().__init__(pad_token_id=a__				,     **a__  )

       _lowerCAmelCase						:       Optional[Any]  			=     vocab_size
       _lowerCAmelCase						:       Tuple  			=     hidden_size
       _lowerCAmelCase						:       Union[str, Any]  			=     num_hidden_layers
       _lowerCAmelCase						:       Union[str, Any]  			=     num_attention_heads
       _lowerCAmelCase						:       str  			=     hidden_act
       _lowerCAmelCase						:       Dict  			=     intermediate_size
       _lowerCAmelCase						:       Union[str, Any]  			=     hidden_dropout_prob
       _lowerCAmelCase						:       Dict  			=     attention_probs_dropout_prob
       _lowerCAmelCase						:       List[Any]  			=     max_position_embeddings
       _lowerCAmelCase						:       List[str]  			=     type_vocab_size
       _lowerCAmelCase						:       int  			=     initializer_range
       _lowerCAmelCase						:       List[str]  			=     layer_norm_eps
       _lowerCAmelCase						:       Union[str, Any]  			=     position_embedding_type
       _lowerCAmelCase						:       str  			=     use_cache
       _lowerCAmelCase						:       Union[str, Any]  			=     classifier_dropout







class 						__A							( SCREAMING_SNAKE_CASE_		):






     @property
     def     __A  (		self  ):
       if self.task == "multiple-choice":
         _lowerCAmelCase						:       Tuple  			=     {0: """batch""", 1: """choice""", 2: """sequence"""}
       else:
         _lowerCAmelCase						:       str  			=     {0: """batch""", 1: """sequence"""}
       return OrderedDict(
           [
               ("""input_ids""", dynamic_axis),
               ("""attention_mask""", dynamic_axis),
               ("""token_type_ids""", dynamic_axis),
           ]  )





"""simple docstring"""




from math import ceil





def 							SCREAMING_SNAKE_CASE     (			_lowerCamelCase						:       Union[str, Any]			,_lowerCamelCase						:       Union[str, Any]	)       ->      int:
  _lowerCAmelCase						:       Dict  			=     list(range(0			,_lowerCamelCase	)	)

  _lowerCAmelCase						:       Tuple  			=     [item for sublist in list(device_map.values()	) for item in sublist]

  # Duplicate check
  _lowerCAmelCase						:       Union[str, Any]  			=     []
  for i in device_map_blocks:
    if device_map_blocks.count(_lowerCamelCase	) > 1 and i not in duplicate_blocks:
      duplicate_blocks.append(_lowerCamelCase	)
    # Missing blocks
  _lowerCAmelCase						:       int  			=     [i for i in blocks if i not in device_map_blocks]
  _lowerCAmelCase						:       List[Any]  			=     [i for i in device_map_blocks if i not in blocks]

  if len(_lowerCamelCase	) != 0:
    raise ValueError(
        """Duplicate attention blocks specified in device_map. Attention blocks must be specified to one device."""
        """ These attention blocks were specified more than once: """ + str(_lowerCamelCase	)	)
  if len(_lowerCamelCase	) != 0:
    raise ValueError(
        """There are attention blocks for this model that are not specified in the device_map. Add these attention """
        """blocks to a device on the device_map: """ + str(_lowerCamelCase	)	)
  if len(_lowerCamelCase	) != 0:
    raise ValueError(
        """The device_map contains more attention blocks than this model has. Remove these from the device_map:"""
        + str(_lowerCamelCase	)	)






def 							SCREAMING_SNAKE_CASE     (			_lowerCamelCase						:       int			,_lowerCamelCase						:       Tuple	)       ->      str:
  _lowerCAmelCase						:       Optional[Any]  			=     list(range(_lowerCamelCase	)	)
  _lowerCAmelCase						:       Optional[Any]  			=     int(ceil(n_layers / len(_lowerCamelCase	)	)	)
  _lowerCAmelCase						:       Optional[int]  			=     [layers[i : i + n_blocks] for i in range(0			,_lowerCamelCase			,_lowerCamelCase	)]

  return dict(zip(_lowerCamelCase			,_lowerCamelCase	)	)




