




from manim import *







class 						lowercase							(   UpperCamelCase__		):

     def 					a__	(  self				)						->							Dict:
           _A							:     List[Any]			=						Rectangle(height=0.5		,     width=0.5				)
           _A							:     Optional[int]			=						Rectangle(height=0.46		,     width=0.46				).set_stroke(width=0				)

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

           _A							:     Optional[Any]			=						[mem.copy() for i in range(4				)]
           _A							:     Optional[int]			=						VGroup(*_a				).arrange(_a		,     buff=0				)
           _A							:     Optional[Any]			=						Text("""GPU"""		,     font_size=24				)
           _A							:     Union[str, Any]			=						Group(_a		,     _a				).arrange(_a		,     buff=0.5		,     aligned_edge=_a				)
           gpu.move_to([-1, -1, 0]				)
           self.add(_a				)

           _A							:     str			=						[mem.copy() for i in range(6				)]
           _A							:     int			=						VGroup(*_a				).arrange(_a		,     buff=0				)

           _A							:     str			=						Text("""Model"""		,     font_size=24				)
           _A							:     List[Any]			=						Group(_a		,     _a				).arrange(_a		,     buff=0.5		,     aligned_edge=_a				)
           model.move_to([3, -1.0, 0]				)
           self.add(_a				)

           _A							:     List[str]			=						[]
           for i, rect in enumerate(_a				):
                 rect.set_stroke(_a				)
                 # target = fill.copy().set_fill(YELLOW, opacity=0.7)
                 # target.move_to(rect)
                 # self.add(target)

                 _A							:     str			=						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(cpu_targs[0]		,     direction=_a		,     buff=0.0				)
                 else:
                       cpu_target.next_to(cpu_targs[i - 1]		,     direction=_a		,     buff=0.0				)
                 self.add(_a				)
                 cpu_targs.append(_a				)

           _A							:     Union[str, Any]			=						[mem.copy() for i in range(6				)]
           _A							:     str			=						VGroup(*_a				).arrange(_a		,     buff=0				)

           _A							:     List[str]			=						Text("""Loaded Checkpoint"""		,     font_size=24				)
           _A							:     Optional[int]			=						Group(_a		,     _a				).arrange(_a		,     aligned_edge=_a		,     buff=0.4				)
           checkpoint.move_to([3, 0.5, 0]				)

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

           _A							:     int			=						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							:     List[str]			=						MarkupText(
               F'''<span fgcolor=\'{BLUE}\'>●</span> Checkpoint'''		,     font_size=18		,     )

           blue_text.next_to(_a		,     DOWN * 2.4		,     aligned_edge=key_text.get_left()				)

           _A							:     Optional[int]			=						MarkupText(
               F'''Next, a <i><span fgcolor="{BLUE}">second</span></i> model is loaded into memory,\nwith the weights of a <span fgcolor="{BLUE}">single shard</span>.'''		,     font_size=24		,     )
           step_a.move_to([2, 2, 0]				)
           self.play(Write(_a				)		,     Write(_a				)				)

           self.play(Write(_a		,     run_time=1				)		,     Create(_a		,     run_time=1				)				)

           _A							:     Optional[int]			=						[]
           _A							:     Dict			=						[]
           for i, rect in enumerate(_a				):
                 _A							:     int			=						fill.copy().set_fill(_a		,     opacity=0.7				)
                 target.move_to(_a				)
                 first_animations.append(GrowFromCenter(_a		,     run_time=1				)				)

                 _A							:     Optional[Any]			=						target.copy()
                 cpu_target.generate_target()
                 if i < 5:
                       cpu_target.target.move_to(cpu_left_col_base[i + 1]				)
                 else:
                       cpu_target.target.move_to(cpu_right_col_base[i - 5]				)
                 second_animations.append(MoveToTarget(_a		,     run_time=1.5				)				)

           self.play(*_a				)
           self.play(*_a				)
           self.wait()







from collections import OrderedDict
from typing import Mapping

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


_snake_case										=       logging.get_logger(__name__)

_snake_case										=       {
    "facebook/xmod-base": "https://huggingface.co/facebook/xmod-base/resolve/main/config.json",
    "facebook/xmod-large-prenorm": "https://huggingface.co/facebook/xmod-large-prenorm/resolve/main/config.json",
    "facebook/xmod-base-13-125k": "https://huggingface.co/facebook/xmod-base-13-125k/resolve/main/config.json",
    "facebook/xmod-base-30-125k": "https://huggingface.co/facebook/xmod-base-30-125k/resolve/main/config.json",
    "facebook/xmod-base-30-195k": "https://huggingface.co/facebook/xmod-base-30-195k/resolve/main/config.json",
    "facebook/xmod-base-60-125k": "https://huggingface.co/facebook/xmod-base-60-125k/resolve/main/config.json",
    "facebook/xmod-base-60-265k": "https://huggingface.co/facebook/xmod-base-60-265k/resolve/main/config.json",
    "facebook/xmod-base-75-125k": "https://huggingface.co/facebook/xmod-base-75-125k/resolve/main/config.json",
    "facebook/xmod-base-75-269k": "https://huggingface.co/facebook/xmod-base-75-269k/resolve/main/config.json",
}







class 						lowercase							(   UpperCamelCase__		):
     _a							 =						"xmod"

     def __init__(  self		,     _a=3_0522		,     _a=768		,     _a=12		,     _a=12		,     _a=3072		,     _a="gelu"		,     _a=0.1		,     _a=0.1		,     _a=512		,     _a=2		,     _a=0.02		,     _a=1e-12		,     _a=1		,     _a=0		,     _a=2		,     _a="absolute"		,     _a=True		,     _a=None		,     _a=False		,     _a=2		,     _a=False		,     _a=True		,     _a=True		,     _a=("en_XX",)		,     _a=None		,     **_a		,     )						->							str:
           super().__init__(pad_token_id=_a		,     bos_token_id=_a		,     eos_token_id=_a		,     **_a				)

           _A							:     Tuple			=						vocab_size
           _A							:     Union[str, Any]			=						hidden_size
           _A							:     Dict			=						num_hidden_layers
           _A							:     Dict			=						num_attention_heads
           _A							:     List[Any]			=						hidden_act
           _A							:     Optional[Any]			=						intermediate_size
           _A							:     Any			=						hidden_dropout_prob
           _A							:     str			=						attention_probs_dropout_prob
           _A							:     Dict			=						max_position_embeddings
           _A							:     Any			=						type_vocab_size
           _A							:     List[Any]			=						initializer_range
           _A							:     int			=						layer_norm_eps
           _A							:     int			=						position_embedding_type
           _A							:     Any			=						use_cache
           _A							:     int			=						classifier_dropout
           _A							:     int			=						pre_norm
           _A							:     Optional[Any]			=						adapter_reduction_factor
           _A							:     List[Any]			=						adapter_layer_norm
           _A							:     Optional[int]			=						adapter_reuse_layer_norm
           _A							:     Any			=						ln_before_adapter
           _A							:     Union[str, Any]			=						list(_a				)
           _A							:     List[Any]			=						default_language







class 						lowercase							(   UpperCamelCase__		):

     @property
     def 					a__	(  self				)						->							Mapping[str, Mapping[int, str]]:
           if self.task == "multiple-choice":
                 _A							:     Dict			=						{0: """batch""", 1: """choice""", 2: """sequence"""}
           else:
                 _A							:     Dict			=						{0: """batch""", 1: """sequence"""}
           return OrderedDict(
               [
                   ("""input_ids""", dynamic_axis),
                   ("""attention_mask""", dynamic_axis),
               ]				)

