




"""simple docstring"""







__A   :  Tuple					=      'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'

def 						snake_case__       (					_lowerCamelCase				)			->bytes:






		"""simple docstring"""


		if not isinstance(_lowerCamelCase,  _lowerCamelCase				):
				__lowercase				:		Optional[Any]												=				F'a bytes-like object is required, not \'{data.__class__.__name__}\''
				raise TypeError(_lowerCamelCase				)

		__lowercase				:		int												=				"".join(bin(_lowerCamelCase				)[2:].zfill(8				) for byte in data				)

		__lowercase				:		Dict												=				len(_lowerCamelCase				) % 6 != 0

		if padding_needed:
				# The padding that will be added later
				__lowercase				:		Optional[Any]												=				b"=" * ((6 - len(_lowerCamelCase				) % 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(_lowerCamelCase				) % 6)
		else:
				__lowercase				:		List[Any]												=				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(_lowerCamelCase				),  6				)				).encode()
		    + padding
		)

def 						snake_case__       (					_lowerCamelCase				)			->bytes:






		"""simple docstring"""


		if not isinstance(_lowerCamelCase,  _lowerCamelCase				) and not isinstance(_lowerCamelCase,  _lowerCamelCase				):
				__lowercase				:		Optional[int]												=				(
				    "argument should be a bytes-like object or ASCII string, "
				    F'not \'{encoded_data.__class__.__name__}\''
				)
				raise TypeError(_lowerCamelCase				)

		# 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(_lowerCamelCase,  _lowerCamelCase				):
				try:
						__lowercase				:		Union[str, Any]												=				encoded_data.decode("utf-8"				)
				except UnicodeDecodeError:
						raise ValueError("base64 encoded data should only contain ASCII characters"				)

		__lowercase				:		Union[str, Any]												=				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(_lowerCamelCase				) % 4 == 0 and padding < 3, "Incorrect padding"

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

				__lowercase				:		Optional[Any]												=				"".join(
				    bin(B64_CHARSET.index(_lowerCamelCase				)				)[2:].zfill(6				) for char in encoded_data				)[: -padding * 2]
		else:
				__lowercase				:		int												=				"".join(
				    bin(B64_CHARSET.index(_lowerCamelCase				)				)[2:].zfill(6				) for char in encoded_data				)

		__lowercase				:		Optional[int]												=				[
		    int(binary_stream[index : index + 8],  2				)
		    for index in range(0,  len(_lowerCamelCase				),  8				)
		]

		return bytes(_lowerCamelCase				)


if __name__ == "__main__":
						import doctest

						doctest.testmod()










"""simple docstring"""







from ...configuration_utils import PretrainedConfig
from ...utils import logging


__A   :  str					=      logging.get_logger(__name__)

__A   :  str					=      {
    'uclanlp/visualbert-vqa': 'https://huggingface.co/uclanlp/visualbert-vqa/resolve/main/config.json',
    'uclanlp/visualbert-vqa-pre': 'https://huggingface.co/uclanlp/visualbert-vqa-pre/resolve/main/config.json',
    'uclanlp/visualbert-vqa-coco-pre': (
        'https://huggingface.co/uclanlp/visualbert-vqa-coco-pre/resolve/main/config.json'
    ),
    'uclanlp/visualbert-vcr': 'https://huggingface.co/uclanlp/visualbert-vcr/resolve/main/config.json',
    'uclanlp/visualbert-vcr-pre': 'https://huggingface.co/uclanlp/visualbert-vcr-pre/resolve/main/config.json',
    'uclanlp/visualbert-vcr-coco-pre': (
        'https://huggingface.co/uclanlp/visualbert-vcr-coco-pre/resolve/main/config.json'
    ),
    'uclanlp/visualbert-nlvr2': 'https://huggingface.co/uclanlp/visualbert-nlvr2/resolve/main/config.json',
    'uclanlp/visualbert-nlvr2-pre': 'https://huggingface.co/uclanlp/visualbert-nlvr2-pre/resolve/main/config.json',
    'uclanlp/visualbert-nlvr2-coco-pre': (
        'https://huggingface.co/uclanlp/visualbert-nlvr2-coco-pre/resolve/main/config.json'
    )
    # See all VisualBERT models at https://huggingface.co/models?filter=visual_bert
}




class       lowerCAmelCase__       (			lowerCAmelCase_    ):


				"""simple docstring"""





				__UpperCAmelCase :     Tuple       =      "visual_bert"



				def __init__(     self					:	List[Any]    ,   lowercase__					:	Dict=3_0_5_2_2    ,   lowercase__					:	Any=7_6_8    ,   lowercase__					:	Dict=5_1_2    ,   lowercase__					:	Tuple=1_2    ,   lowercase__					:	Any=1_2    ,   lowercase__					:	Union[str, Any]=3_0_7_2    ,   lowercase__					:	Tuple="gelu"    ,   lowercase__					:	Dict=0.1    ,   lowercase__					:	Tuple=0.1    ,   lowercase__					:	str=5_1_2    ,   lowercase__					:	str=2    ,   lowercase__					:	Any=0.0_2    ,   lowercase__					:	Any=1e-12    ,   lowercase__					:	Any=False    ,   lowercase__					:	List[str]=True    ,   lowercase__					:	Dict=1    ,   lowercase__					:	List[Any]=0    ,   lowercase__					:	Tuple=2    ,   **lowercase__					:	Any    ,   ):
						super().__init__(pad_token_id=lowercase__    ,   bos_token_id=lowercase__    ,   eos_token_id=lowercase__    ,   **lowercase__						)

						__lowercase				:		Optional[int]												=				vocab_size
						__lowercase				:		Any												=				max_position_embeddings
						__lowercase				:		Optional[Any]												=				hidden_size
						__lowercase				:		List[str]												=				visual_embedding_dim
						__lowercase				:		Dict												=				num_hidden_layers
						__lowercase				:		Any												=				num_attention_heads
						__lowercase				:		str												=				intermediate_size
						__lowercase				:		Dict												=				hidden_act
						__lowercase				:		Any												=				hidden_dropout_prob
						__lowercase				:		Optional[int]												=				attention_probs_dropout_prob
						__lowercase				:		Dict												=				initializer_range
						__lowercase				:		str												=				type_vocab_size
						__lowercase				:		List[Any]												=				layer_norm_eps
						__lowercase				:		Tuple												=				bypass_transformer
						__lowercase				:		List[str]												=				special_visual_initialize
