



'''simple docstring'''
from unittest import TestCase

from datasets import Sequence, Value
from datasets.arrow_dataset import Dataset






class 							lowercase__	(							lowercase   ):





	def 	UpperCamelCase_  ( self					:				Optional[Any] ):







							'''simple docstring'''
							return [
							    {"col_1": 3, "col_2": "a"},
							    {"col_1": 2, "col_2": "b"},
							    {"col_1": 1, "col_2": "c"},
							    {"col_1": 0, "col_2": "d"},
							]





	def 	UpperCamelCase_  ( self					:				Optional[int] ):







							'''simple docstring'''
							_UpperCamelCase					:		Tuple 				=   {'col_1': [3, 2, 1, 0], 'col_2': ['a', 'b', 'c', 'd']}
							return Dataset.from_dict(lowerCamelCase__ )





	def 	UpperCamelCase_  ( self					:				List[str] ):







							'''simple docstring'''
							_UpperCamelCase					:		Union[str, Any] 				=   self._create_example_records()
							_UpperCamelCase					:		Any 				=   Dataset.from_list(lowerCamelCase__ )
							self.assertListEqual(dset.column_names ,['col_1', 'col_2'] )
							for i, r in enumerate(lowerCamelCase__ ):
													self.assertDictEqual(lowerCamelCase__ ,example_records[i] )





	def 	UpperCamelCase_  ( self					:				List[Any] ):







							'''simple docstring'''
							_UpperCamelCase					:		List[Any] 				=   self._create_example_records()
							_UpperCamelCase					:		Any 				=   Dataset.from_list(lowerCamelCase__ )
							_UpperCamelCase					:		str 				=   Dataset.from_dict({k: [r[k] for r in example_records] for k in example_records[0]} )
							self.assertEqual(dset.info ,dset_from_dict.info )





	def 	UpperCamelCase_  ( self					:				List[Any] ):  # checks what happens with missing columns







							'''simple docstring'''
							_UpperCamelCase					:		str 				=   [{'col_1': 1}, {'col_2': 'x'}]
							_UpperCamelCase					:		Tuple 				=   Dataset.from_list(lowerCamelCase__ )
							self.assertDictEqual(dset[0] ,{'col_1': 1} )
							self.assertDictEqual(dset[1] ,{'col_1': None} )  # NB: first record is used for columns





	def 	UpperCamelCase_  ( self					:				Optional[int] ):  # checks if the type can be inferred from the second record







							'''simple docstring'''
							_UpperCamelCase					:		Any 				=   [{'col_1': []}, {'col_1': [1, 2]}]
							_UpperCamelCase					:		int 				=   Dataset.from_list(lowerCamelCase__ )
							self.assertEqual(dset.info.features['col_1'] ,Sequence(Value('int64' ) ) )





	def 	UpperCamelCase_  ( self					:				int ):







							'''simple docstring'''
							_UpperCamelCase					:		Optional[int] 				=   Dataset.from_list([] )
							self.assertEqual(len(lowerCamelCase__ ) ,0 )
							self.assertListEqual(dset.column_names ,[] )




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


lowercase  :					List[str]						    =							logging.get_logger(__name__)

lowercase  :					Any						    =							{
    """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 __snake_case		(      lowerCAmelCase     ):
    _a		:						Union[str, Any]=				"visual_bert"
    def __init__(  self		,snake_case=30522		,snake_case=768		,snake_case=512		,snake_case=12		,snake_case=12		,snake_case=3072		,snake_case="gelu"		,snake_case=0.1		,snake_case=0.1		,snake_case=512		,snake_case=2		,snake_case=0.02		,snake_case=1e-12		,snake_case=False		,snake_case=True		,snake_case=1		,snake_case=0		,snake_case=2		,**snake_case		,):



           '''simple docstring'''







           super().__init__(pad_token_id=snake_case		,bos_token_id=snake_case		,eos_token_id=snake_case		,**snake_case      )

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