


from manim import *







class     _lowercase				(							lowercase__):


       """simple docstring"""




       def 		lowerCAmelCase  (     self							:    List[str] ):


             '''simple docstring'''



             lowerCamelCase__	:       str					=						Rectangle(height=0.5      ,   width=0.5 )
             lowerCamelCase__	:       Union[str, Any]					=						Rectangle(height=0.4_6      ,   width=0.4_6 ).set_stroke(width=0 )

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

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

             self.add(__lowerCamelCase )

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

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

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

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

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

             lowerCamelCase__	:       Tuple					=						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(__lowerCamelCase      ,   run_time=2.5 )      ,   Write(__lowerCamelCase )      ,   Write(__lowerCamelCase ) )

             self.add(__lowerCamelCase )

             lowerCamelCase__	:       List[str]					=						[]
             lowerCamelCase__	:       List[str]					=						[]
             lowerCamelCase__	:       List[Any]					=						[]
             for i, rect in enumerate(__lowerCamelCase ):
                   lowerCamelCase__	:       Dict					=						Rectangle(height=0.4_6      ,   width=0.4_6 ).set_stroke(width=0.0 ).set_fill(__lowerCamelCase      ,   opacity=0.7 )
                   cpu_target.move_to(__lowerCamelCase )
                   cpu_target.generate_target()
                   lowerCamelCase__	:       Any					=						0.4_6 / 4
                   lowerCamelCase__	:       str					=						0.4_6 / 3

                   if i == 0:
                         cpu_target.target.next_to(cpu_left_col_base[0].get_corner(DOWN + LEFT )      ,   buff=0.0_2      ,   direction=__lowerCamelCase )
                         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=__lowerCamelCase      ,   buff=0.0 )
                   else:
                         cpu_target.target.next_to(cpu_targs[i - 1].target      ,   direction=__lowerCamelCase      ,   buff=0.0 )
                   cpu_targs.append(__lowerCamelCase )

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

             self.play(*__lowerCamelCase )
             self.play(*__lowerCamelCase )

             self.wait()






from collections import OrderedDict
from typing import Mapping

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


A   :					int	=      logging.get_logger(__name__)

A   :					Optional[int]	=      {
    "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				(							lowercase__):


       """simple docstring"""




       A__      		=    "xmod"





       def __init__(     self							:    int      ,   __lowerCamelCase							:    Any=30522      ,   __lowerCamelCase							:    Any=768      ,   __lowerCamelCase							:    str=12      ,   __lowerCamelCase							:    Any=12      ,   __lowerCamelCase							:    List[str]=3072      ,   __lowerCamelCase							:    List[Any]="gelu"      ,   __lowerCamelCase							:    Union[str, Any]=0.1      ,   __lowerCamelCase							:    int=0.1      ,   __lowerCamelCase							:    Tuple=512      ,   __lowerCamelCase							:    str=2      ,   __lowerCamelCase							:    List[str]=0.0_2      ,   __lowerCamelCase							:    List[str]=1E-1_2      ,   __lowerCamelCase							:    str=1      ,   __lowerCamelCase							:    Optional[int]=0      ,   __lowerCamelCase							:    Optional[Any]=2      ,   __lowerCamelCase							:    str="absolute"      ,   __lowerCamelCase							:    List[str]=True      ,   __lowerCamelCase							:    Dict=None      ,   __lowerCamelCase							:    Optional[Any]=False      ,   __lowerCamelCase							:    Optional[Any]=2      ,   __lowerCamelCase							:    Tuple=False      ,   __lowerCamelCase							:    Tuple=True      ,   __lowerCamelCase							:    Union[str, Any]=True      ,   __lowerCamelCase							:    str=("en_XX",)      ,   __lowerCamelCase							:    Union[str, Any]=None      ,   **__lowerCamelCase							:    Optional[int]      ,   ):


             '''simple docstring'''



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

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







class     _lowercase				(							lowercase__):


       """simple docstring"""




       @property
       def 		lowerCAmelCase  (     self							:    Tuple ):


             '''simple docstring'''



             if self.task == "multiple-choice":
                   lowerCamelCase__	:       Dict					=						{0: "batch", 1: "choice", 2: "sequence"}
             else:
                   lowerCamelCase__	:       List[str]					=						{0: "batch", 1: "sequence"}
             return OrderedDict(
                 [
                     ("input_ids", dynamic_axis),
                     ("attention_mask", dynamic_axis),
                 ] )


