


'''simple docstring'''






__UpperCAmelCase       =							'''ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'''


def  _snake_case       (					A	)						->   bytes:
							# Make sure the supplied data is a bytes-like object
							if not isinstance(A			,   A	):
														lowerCAmelCase__	       =     F"""a bytes-like object is required, not '{data.__class__.__name__}'"""
														raise TypeError(A	)

							lowerCAmelCase__	       =     ''''''.join(bin(A	)[2:].zfill(8	) for byte in data	)

							lowerCAmelCase__	       =     len(A	) % 6 != 0

							if padding_needed:
														# The padding that will be added later
														lowerCAmelCase__	       =     B'''=''' * ((6 - len(A	) % 6) // 2)

														# Append binary_stream with arbitrary binary digits (0's by default) to make its
														# length a multiple of 6.
														binary_stream += "0" * (6 - len(A	) % 6)
							else:
														lowerCAmelCase__	       =     B''''''

							# Encode every 6 binary digits to their corresponding Base64 character
							return (
							    "".join(
							        B64_CHARSET[int(binary_stream[index : index + 6]			,   2	)]
							        for index in range(0			,   len(A	)			,   6	)	).encode()
							    + padding
							)


def  _snake_case       (					A	)						->   bytes:
							# Make sure encoded_data is either a string or a bytes-like object
							if not isinstance(A			,   A	) and not isinstance(A			,   A	):
														lowerCAmelCase__	       =     (
														    '''argument should be a bytes-like object or ASCII string, '''
														    F"""not '{encoded_data.__class__.__name__}'"""
														)
														raise TypeError(A	)

							# In case encoded_data is a bytes-like object, make sure it contains only
							# ASCII characters so we convert it to a string object
							if isinstance(A			,   A	):
														try:
																					lowerCAmelCase__	       =     encoded_data.decode('''utf-8'''	)
														except UnicodeDecodeError:
																					raise ValueError('''base64 encoded data should only contain ASCII characters'''	)

							lowerCAmelCase__	       =     encoded_data.count('''='''	)

							# Check if the encoded string contains non base64 characters
							if padding:
														assert all(
														    char in B64_CHARSET for char in encoded_data[:-padding]	), "Invalid base64 character(s) found."
							else:
														assert all(
														    char in B64_CHARSET for char in encoded_data	), "Invalid base64 character(s) found."

							# Check the padding
							assert len(A	) % 4 == 0 and padding < 3, "Incorrect padding"

							if padding:
														# Remove padding if there is one
														lowerCAmelCase__	       =     encoded_data[:-padding]

														lowerCAmelCase__	       =     ''''''.join(
														    bin(B64_CHARSET.index(A	)	)[2:].zfill(6	) for char in encoded_data	)[: -padding * 2]
							else:
														lowerCAmelCase__	       =     ''''''.join(
														    bin(B64_CHARSET.index(A	)	)[2:].zfill(6	) for char in encoded_data	)

							lowerCAmelCase__	       =     [
							    int(binary_stream[index : index + 8]			,   2	)
							    for index in range(0			,   len(A	)			,   8	)
							]

							return bytes(A	)


if __name__ == "__main__":
		import doctest

		doctest.testmod()



'''simple docstring'''






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 		a__    (							a__  ):





							'''simple docstring'''






							lowercase__      :       Optional[Any]     						=				"distilbert"
							lowercase__      :       Tuple     						=				{
							    "hidden_size": "dim",
							    "num_attention_heads": "n_heads",
							    "num_hidden_layers": "n_layers",
							}







							def __init__(		self ,   lowerCamelCase_=3_05_22 ,   lowerCamelCase_=5_12 ,   lowerCamelCase_=False ,   lowerCamelCase_=6 ,   lowerCamelCase_=12 ,   lowerCamelCase_=7_68 ,   lowerCamelCase_=4 * 7_68 ,   lowerCamelCase_=0.1 ,   lowerCamelCase_=0.1 ,   lowerCamelCase_="gelu" ,   lowerCamelCase_=0.02 ,   lowerCamelCase_=0.1 ,   lowerCamelCase_=0.2 ,   lowerCamelCase_=0 ,   **lowerCamelCase_ ,   )	->							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__(**lowerCamelCase_ ,   pad_token_id=lowerCamelCase_       )




class 		a__    (							a__  ):





							'''simple docstring'''






							@property
							def   __SCREAMING_SNAKE_CASE							(		self       )	->							Mapping[str, Mapping[int, str]]:
														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),
														    ]       )