





lowercase_					     =	"""ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"""




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

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

   lowercase__			    =						len(_SCREAMING_SNAKE_CASE	) % 6 != 0

   if padding_needed:
      # The padding that will be added later
      lowercase__			    =						b'=' * ((6 - len(_SCREAMING_SNAKE_CASE	) % 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(_SCREAMING_SNAKE_CASE	) % 6)
   else:
      lowercase__			    =						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(_SCREAMING_SNAKE_CASE	)	,		6	)	).encode()
       + padding
   )




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

   # 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(_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE	):
      try:
         lowercase__			    =						encoded_data.decode('utf-8'	)
      except UnicodeDecodeError:
         raise ValueError('base64 encoded data should only contain ASCII characters'	)

   lowercase__			    =						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(_SCREAMING_SNAKE_CASE	) % 4 == 0 and padding < 3, "Incorrect padding"

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

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

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

   return bytes(_SCREAMING_SNAKE_CASE	)


if __name__ == "__main__":
      import doctest

      doctest.testmod()









from collections import OrderedDict
from typing import Mapping

from packaging import version

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


lowercase_					     =	logging.get_logger(__name__)

lowercase_					     =	{
    """facebook/deit-base-distilled-patch16-224""": (
        """https://huggingface.co/facebook/deit-base-patch16-224/resolve/main/config.json"""
    ),
    # See all DeiT models at https://huggingface.co/models?filter=deit
}
class        SCREAMING_SNAKE_CASE     (UpperCAmelCase   ):
   _UpperCamelCase					:	Any				      = 'deit'


   def __init__(					self    :       Any    ,  a    :       Union[str, Any]=768    ,  a    :       Optional[Any]=12    ,  a    :       Union[str, Any]=12    ,  a    :       Optional[int]=3_072    ,  a    :       Optional[int]="gelu"    ,  a    :       Optional[Any]=0.0    ,  a    :       List[Any]=0.0    ,  a    :       int=0.02    ,  a    :       List[str]=1E-1_2    ,  a    :       Optional[int]=224    ,  a    :       Tuple=16    ,  a    :       List[Any]=3    ,  a    :       List[str]=True    ,  a    :       Any=16    ,  **a    :       Union[str, Any]    ,  )->     int:





     """simple docstring"""







     super().__init__(**a )

     lowercase__			    =						hidden_size
     lowercase__			    =						num_hidden_layers
     lowercase__			    =						num_attention_heads
     lowercase__			    =						intermediate_size
     lowercase__			    =						hidden_act
     lowercase__			    =						hidden_dropout_prob
     lowercase__			    =						attention_probs_dropout_prob
     lowercase__			    =						initializer_range
     lowercase__			    =						layer_norm_eps
     lowercase__			    =						image_size
     lowercase__			    =						patch_size
     lowercase__			    =						num_channels
     lowercase__			    =						qkv_bias
     lowercase__			    =						encoder_stride






class        SCREAMING_SNAKE_CASE     (UpperCAmelCase   ):
   _UpperCamelCase					:	List[Any]				      = version.parse('1.11'   )


   @property
   def  SCREAMING_SNAKE_CASE_							(					self    :       int )->     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    :       Any )->     float:





     """simple docstring"""







     return 1E-4


