




'''simple docstring'''







from manim import *

class 	_snake_case(			_UpperCAmelCase      ):






 def 						_UpperCamelCase (self       :  Optional[int]    )       ->   Optional[Any]:






    """simple docstring"""


    A__       =     Rectangle(height=0.5    ,		width=0.5    )
    A__       =     Rectangle(height=0.25    ,		width=0.25    )
    A__       =     Rectangle(height=0.46    ,		width=0.46    ).set_stroke(width=0    )

    A__       =     [mem.copy() for i in range(6    )]
    A__       =     [mem.copy() for i in range(6    )]
    A__       =     VGroup(*a    ).arrange(a    ,		buff=0    )
    A__       =     VGroup(*a    ).arrange(a    ,		buff=0    )
    A__       =     VGroup(a    ,		a    ).arrange(a    ,		buff=0    )
    A__       =     Text('CPU'    ,		font_size=24    )
    A__       =     Group(a    ,		a    ).arrange(a    ,		buff=0.5    ,		aligned_edge=a    )
    cpu.move_to([-2.5, -0.5, 0]    )
    self.add(a    )

    A__       =     [mem.copy() for i in range(4    )]
    A__       =     VGroup(*a    ).arrange(a    ,		buff=0    )
    A__       =     Text('GPU'    ,		font_size=24    )
    A__       =     Group(a    ,		a    ).arrange(a    ,		buff=0.5    ,		aligned_edge=a    )
    gpu.move_to([-1, -1, 0]    )
    self.add(a    )

    A__       =     [mem.copy() for i in range(6    )]
    A__       =     VGroup(*a    ).arrange(a    ,		buff=0    )

    A__       =     Text('Model'    ,		font_size=24    )
    A__       =     Group(a    ,		a    ).arrange(a    ,		buff=0.5    ,		aligned_edge=a    )
    model.move_to([3, -1.0, 0]    )
    self.add(a    )

    A__       =     []
    A__       =     []
    A__       =     []

    for i, rect in enumerate(a    ):
       rect.set_stroke(a    )

       A__       =     Rectangle(height=0.46 / 4    ,		width=0.46 / 3    ).set_stroke(width=0.0    ).set_fill(a    ,		opacity=0.7    )

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

    self.add(*a    ,		*a    ,		*a    )

    A__       =     [mem.copy() for i in range(6    )]
    A__       =     VGroup(*a    ).arrange(a    ,		buff=0    )

    A__       =     Text('Loaded Checkpoint'    ,		font_size=24    )
    A__       =     Group(a    ,		a    ).arrange(a    ,		buff=0.5    ,		aligned_edge=a    )
    checkpoint.move_to([3, 0.5, 0]    )

    self.add(a    )

    A__       =     []
    A__       =     []

    for i, rect in enumerate(a    ):
       A__       =     fill.copy().set_fill(a    ,		opacity=0.7    )
       target.move_to(a    )
       ckpt_arr.append(a    )

       A__       =     target.copy()
       if i < 5:
          cpu_target.move_to(cpu_left_col_base[i + 1]    )
       else:
          cpu_target.move_to(cpu_right_col_base[i - 5]    )
       ckpt_cpu_arr.append(a    )
    self.add(*a    ,		*a    )

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

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

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

    self.add(a    ,		a    )

    A__       =     MarkupText(
        f"""<span fgcolor=\'{BLUE}\'>●</span> Checkpoint"""    ,		font_size=18    ,		)

    blue_text.next_to(a    ,		DOWN * 2.4    ,		aligned_edge=key_text.get_left()    )
    self.add(a    )

    A__       =     MarkupText(
        f"""Based on the passed in configuration, weights are stored in\na variety of np.memmaps on disk or to a particular device."""    ,		font_size=24    ,		)
    step_a.move_to([2, 2, 0]    )

    A__       =     [meta_mem.copy() for i in range(6    )]
    A__       =     [meta_mem.copy() for i in range(6    )]
    A__       =     VGroup(*a    ).arrange(a    ,		buff=0    )
    A__       =     VGroup(*a    ).arrange(a    ,		buff=0    )
    A__       =     VGroup(a    ,		a    ).arrange(a    ,		buff=0    )
    A__       =     Text('Disk'    ,		font_size=24    )
    A__       =     Group(a    ,		a    ).arrange(a    ,		buff=0.5    ,		aligned_edge=a    )
    disk.move_to([-4.0, -1.25, 0]    )
    self.play(Write(a    ,		run_time=3    )    ,		Write(a    ,		run_time=1    )    ,		Create(a    ,		run_time=1    )    )

    A__       =     []
    for i, rect in enumerate(a    ):
       A__       =     rect.copy()
       target.generate_target()
       target.target.move_to(disk_left_col_base[i]    ).scale(0.5    )
       animations.append(MoveToTarget(a    ,		run_time=1.5    )    )
    self.play(*a    )

    self.play(FadeOut(a    )    )

    A__       =     MarkupText(f"""Then, the checkpoint is removed from memory\nthrough garbage collection."""    ,		font_size=24    )
    step_a.move_to([2, 2, 0]    )

    self.play(Write(a    ,		run_time=3    )    )

    self.play(
        FadeOut(a    ,		a    ,		*a    ,		*a    )    ,		)

    self.wait()









"""simple docstring"""





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


SCREAMING_SNAKE_CASE__   =  logging.get_logger(__name__)

SCREAMING_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 						lowercase   (   _UpperCAmelCase   ):
      _SCREAMING_SNAKE_CASE							      = 'visual_bert'





      def __init__(			self ,		lowercase=30_522 ,		lowercase=768 ,		lowercase=512 ,		lowercase=12 ,		lowercase=12 ,		lowercase=3_072 ,		lowercase="gelu" ,		lowercase=0.1 ,		lowercase=0.1 ,		lowercase=512 ,		lowercase=2 ,		lowercase=0.02 ,		lowercase=1e-12 ,		lowercase=False ,		lowercase=True ,		lowercase=1 ,		lowercase=0 ,		lowercase=2 ,		**lowercase ,		)						->	int:
            super().__init__(pad_token_id=lowercase ,		bos_token_id=lowercase ,		eos_token_id=lowercase ,		**lowercase					)

            lowerCAmelCase    		=			vocab_size
            lowerCAmelCase    		=			max_position_embeddings
            lowerCAmelCase    		=			hidden_size
            lowerCAmelCase    		=			visual_embedding_dim
            lowerCAmelCase    		=			num_hidden_layers
            lowerCAmelCase    		=			num_attention_heads
            lowerCAmelCase    		=			intermediate_size
            lowerCAmelCase    		=			hidden_act
            lowerCAmelCase    		=			hidden_dropout_prob
            lowerCAmelCase    		=			attention_probs_dropout_prob
            lowerCAmelCase    		=			initializer_range
            lowerCAmelCase    		=			type_vocab_size
            lowerCAmelCase    		=			layer_norm_eps
            lowerCAmelCase    		=			bypass_transformer
            lowerCAmelCase    		=			special_visual_initialize






