


"""simple docstring"""



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


__snake_case       =       logging.get_logger(__name__)

__snake_case       =       {
    """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							( snake_case_      ):
   __UpperCAmelCase					:			str				    =    '''visual_bert'''







   def __init__(      self		,      UpperCamelCase__=3_0522		,      UpperCamelCase__=768		,      UpperCamelCase__=512		,      UpperCamelCase__=12		,      UpperCamelCase__=12		,      UpperCamelCase__=3072		,      UpperCamelCase__="gelu"		,      UpperCamelCase__=0.1		,      UpperCamelCase__=0.1		,      UpperCamelCase__=512		,      UpperCamelCase__=2		,      UpperCamelCase__=0.02		,      UpperCamelCase__=1e-12		,      UpperCamelCase__=False		,      UpperCamelCase__=True		,      UpperCamelCase__=1		,      UpperCamelCase__=0		,      UpperCamelCase__=2		,      **UpperCamelCase__		,      )      ->						Union[str, Any]:

       '''simple docstring'''




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

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









"""simple docstring"""



from manim import *







class _lowerCAmelCase							( snake_case_      ):







   def 					lowerCamelCase						(      self		)      ->						Any:

       '''simple docstring'''




       snake_case       : List[str]    =       Rectangle(height=0.5		,      width=0.5		)
       snake_case       : Dict    =       Rectangle(height=0.46		,      width=0.46		).set_stroke(width=0		)

       snake_case       : Tuple    =       [mem.copy() for i in range(6		)]
       snake_case       : Any    =       [mem.copy() for i in range(6		)]
       snake_case       : Tuple    =       VGroup(*UpperCamelCase__		).arrange(UpperCamelCase__		,      buff=0		)
       snake_case       : Optional[Any]    =       VGroup(*UpperCamelCase__		).arrange(UpperCamelCase__		,      buff=0		)
       snake_case       : Optional[Any]    =       VGroup(UpperCamelCase__		,      UpperCamelCase__		).arrange(UpperCamelCase__		,      buff=0		)
       snake_case       : Optional[Any]    =       Text("CPU"		,      font_size=24		)
       snake_case       : Optional[int]    =       Group(UpperCamelCase__		,      UpperCamelCase__		).arrange(UpperCamelCase__		,      buff=0.5		,      aligned_edge=UpperCamelCase__		)
       cpu.move_to([-2.5, -0.5, 0]		)
       self.add(UpperCamelCase__		)

       snake_case       : Optional[Any]    =       [mem.copy() for i in range(1		)]
       snake_case       : List[str]    =       VGroup(*UpperCamelCase__		).arrange(UpperCamelCase__		,      buff=0		)
       snake_case       : Optional[int]    =       Text("GPU"		,      font_size=24		)
       snake_case       : Tuple    =       Group(UpperCamelCase__		,      UpperCamelCase__		).arrange(UpperCamelCase__		,      buff=0.5		,      aligned_edge=UpperCamelCase__		)
       gpu.align_to(UpperCamelCase__		,      UpperCamelCase__		)
       gpu.set_x(gpu.get_x() - 1		)

       self.add(UpperCamelCase__		)

       snake_case       : Any    =       [mem.copy() for i in range(6		)]
       snake_case       : Any    =       VGroup(*UpperCamelCase__		).arrange(UpperCamelCase__		,      buff=0		)

       snake_case       : Dict    =       Text("Model"		,      font_size=24		)
       snake_case       : Optional[Any]    =       Group(UpperCamelCase__		,      UpperCamelCase__		).arrange(UpperCamelCase__		,      buff=0.5		,      aligned_edge=UpperCamelCase__		)
       model.move_to([3, -1.0, 0]		)

       self.play(
           Create(UpperCamelCase__		,      run_time=1		)		,      Create(UpperCamelCase__		,      run_time=1		)		,      Create(UpperCamelCase__		,      run_time=1		)		,      )

       snake_case       : Optional[Any]    =       MarkupText(
           F'First, an empty model skeleton is loaded\ninto <span fgcolor=\'{YELLOW}\'>memory</span> without using much RAM.'		,      font_size=24		,      )

       snake_case       : Any    =       Square(side_length=2.2		)
       key.move_to([-5, 2, 0]		)

       snake_case       : Any    =       MarkupText(
           F'<b>Key:</b>\n\n<span fgcolor=\'{YELLOW}\'>●</span> Empty Model'		,      font_size=18		,      )

       key_text.move_to([-5, 2.4, 0]		)

       step_a.move_to([2, 2, 0]		)
       self.play(Write(UpperCamelCase__		,      run_time=2.5		)		,      Write(UpperCamelCase__		)		,      Write(UpperCamelCase__		)		)

       self.add(UpperCamelCase__		)

       snake_case       : Optional[Any]    =       []
       snake_case       : Dict    =       []
       snake_case       : Union[str, Any]    =       []
       for i, rect in enumerate(UpperCamelCase__		):
           snake_case       : Any    =       Rectangle(height=0.46		,      width=0.46		).set_stroke(width=0.0		).set_fill(UpperCamelCase__		,      opacity=0.7		)
           cpu_target.move_to(UpperCamelCase__		)
           cpu_target.generate_target()
           snake_case       : Optional[int]    =       0.46 / 4
           snake_case       : Any    =       0.46 / 3

           if i == 0:
               cpu_target.target.next_to(cpu_left_col_base[0].get_corner(DOWN + LEFT		)		,      buff=0.02		,      direction=UpperCamelCase__		)
               cpu_target.target.set_x(cpu_target.target.get_x() + 0.1		)
           elif i == 3:
               cpu_target.target.next_to(cpu_targs[0].target		,      direction=UpperCamelCase__		,      buff=0.0		)
           else:
               cpu_target.target.next_to(cpu_targs[i - 1].target		,      direction=UpperCamelCase__		,      buff=0.0		)
           cpu_targs.append(UpperCamelCase__		)

           first_animations.append(rect.animate(run_time=0.5		).set_stroke(UpperCamelCase__		)		)
           second_animations.append(MoveToTarget(UpperCamelCase__		,      run_time=1.5		)		)

       self.play(*UpperCamelCase__		)
       self.play(*UpperCamelCase__		)

       self.wait()





