




from collections import OrderedDict
from typing import Mapping

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


UpperCAmelCase_									=	logging.get_logger(__name__)

UpperCAmelCase_									=	{
    'distilbert-base-uncased': 'https://huggingface.co/distilbert-base-uncased/resolve/main/config.json',
    'distilbert-base-uncased-distilled-squad': (
        'https://huggingface.co/distilbert-base-uncased-distilled-squad/resolve/main/config.json'
    ),
    'distilbert-base-cased': 'https://huggingface.co/distilbert-base-cased/resolve/main/config.json',
    'distilbert-base-cased-distilled-squad': (
        'https://huggingface.co/distilbert-base-cased-distilled-squad/resolve/main/config.json'
    ),
    'distilbert-base-german-cased': 'https://huggingface.co/distilbert-base-german-cased/resolve/main/config.json',
    'distilbert-base-multilingual-cased': (
        'https://huggingface.co/distilbert-base-multilingual-cased/resolve/main/config.json'
    ),
    'distilbert-base-uncased-finetuned-sst-2-english': (
        'https://huggingface.co/distilbert-base-uncased-finetuned-sst-2-english/resolve/main/config.json'
    ),
}





class     lowerCamelCase__(					__lowerCamelCase):
      UpperCAmelCase__      :	str    		=   'distilbert'
      UpperCAmelCase__      :	Optional[Any]    		=   {
          'hidden_size': 'dim',
          'num_attention_heads': 'n_heads',
          'num_hidden_layers': 'n_layers',
      }
      def __init__(				self: str    ,       UpperCamelCase_: Union[str, Any]=3_05_22    ,       UpperCamelCase_: Tuple=5_12    ,       UpperCamelCase_: Union[str, Any]=False    ,       UpperCamelCase_: Union[str, Any]=6    ,       UpperCamelCase_: Tuple=12    ,       UpperCamelCase_: int=7_68    ,       UpperCamelCase_: Any=4 * 7_68    ,       UpperCamelCase_: int=0.1    ,       UpperCamelCase_: List[str]=0.1    ,       UpperCamelCase_: Optional[Any]="gelu"    ,       UpperCamelCase_: Union[str, Any]=0.02    ,       UpperCamelCase_: Optional[int]=0.1    ,       UpperCamelCase_: Optional[int]=0.2    ,       UpperCamelCase_: Any=0    ,       **UpperCamelCase_: Optional[Any]    ,       ):
             __lowerCamelCase   =						vocab_size
             __lowerCamelCase   =						max_position_embeddings
             __lowerCamelCase   =						sinusoidal_pos_embds
             __lowerCamelCase   =						n_layers
             __lowerCamelCase   =						n_heads
             __lowerCamelCase   =						dim
             __lowerCamelCase   =						hidden_dim
             __lowerCamelCase   =						dropout
             __lowerCamelCase   =						attention_dropout
             __lowerCamelCase   =						activation
             __lowerCamelCase   =						initializer_range
             __lowerCamelCase   =						qa_dropout
             __lowerCamelCase   =						seq_classif_dropout
             super().__init__(**UpperCamelCase_    ,       pad_token_id=UpperCamelCase_   )





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








'''simple docstring'''







def  _lowerCamelCase				( lowercase						:      bytes						)	->	str:
				return "".join([hex(lowercase						)[2:].zfill(2						).upper() for byte in list(lowercase						)]						)






def  _lowerCamelCase				( lowercase						:      str						)	->	bytes:
				# Check data validity, following RFC3548
				# https://www.ietf.org/rfc/rfc3548.txt
				if (len(lowercase						) % 2) != 0:
								raise ValueError(
								    "Base16 encoded data is invalid:\nData does not have an even number of hex digits."						)
				# Check the character set - the standard base16 alphabet
				# is uppercase according to RFC3548 section 6
				if not set(lowercase						) <= set("0123456789ABCDEF"						):
								raise ValueError(
								    "Base16 encoded data is invalid:\nData is not uppercase hex or it contains invalid characters."						)
				# For every two hexadecimal digits (= a byte), turn it into an integer.
				# Then, string the result together into bytes, and return it.
				return bytes(int(data[i] + data[i + 1]    ,							16						) for i in range(0    ,							len(lowercase						)    ,							2						)						)


if __name__ == "__main__":
					import doctest

					doctest.testmod()
