






"""simple docstring"""







from manim import *





class   UpperCamelCase_ (       a_  ):



  def 		UpperCamelCase_				(      self				)			->			Optional[int]:



         """simple docstring"""





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

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

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

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

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

         UpperCAmelCase	    =			[]
         UpperCAmelCase	    =			[]
         UpperCAmelCase	    =			[]

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

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

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

         self.add(*snake_case__ ,		*snake_case__ ,		*snake_case__				)

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

         UpperCAmelCase	    =			Text("""Loaded Checkpoint""" ,		font_size=24				)
         UpperCAmelCase	    =			Group(snake_case__ ,		snake_case__				).arrange(snake_case__ ,		buff=0.5 ,		aligned_edge=snake_case__				)
         checkpoint.move_to([3, 0.5, 0]				)

         self.add(snake_case__				)

         UpperCAmelCase	    =			[]
         UpperCAmelCase	    =			[]

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

                UpperCAmelCase	    =			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(snake_case__				)
         self.add(*snake_case__ ,		*snake_case__				)

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

         UpperCAmelCase	    =			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(snake_case__ ,		snake_case__				)

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

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

         UpperCAmelCase	    =			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]				)

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

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

         self.play(FadeOut(snake_case__				)				)

         UpperCAmelCase	    =			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(snake_case__ ,		run_time=3				)				)

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

         self.wait()








"""simple docstring"""







from collections import OrderedDict
from typing import Mapping

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


lowerCAmelCase_	:    int            =      logging.get_logger(__name__)

lowerCAmelCase_	:    List[Any]            =      {
    '''facebook/xlm-roberta-xl''': '''https://huggingface.co/facebook/xlm-roberta-xl/resolve/main/config.json''',
    '''facebook/xlm-roberta-xxl''': '''https://huggingface.co/facebook/xlm-roberta-xxl/resolve/main/config.json''',
    # See all XLM-RoBERTa-XL models at https://huggingface.co/models?filter=xlm-roberta-xl
}





class   UpperCamelCase_ (       a_  ):
  _A       :					int				=	'xlm-roberta-xl'



  def __init__(      self ,		snake_case__=25_08_80 ,		snake_case__=25_60 ,		snake_case__=36 ,		snake_case__=32 ,		snake_case__=1_02_40 ,		snake_case__="gelu" ,		snake_case__=0.1 ,		snake_case__=0.1 ,		snake_case__=5_14 ,		snake_case__=1 ,		snake_case__=0.02 ,		snake_case__=1e-05 ,		snake_case__=1 ,		snake_case__=0 ,		snake_case__=2 ,		snake_case__="absolute" ,		snake_case__=True ,		snake_case__=None ,		**snake_case__ ,		)			->			Union[str, Any]:



         """simple docstring"""





         super().__init__(pad_token_id=snake_case__ ,		bos_token_id=snake_case__ ,		eos_token_id=snake_case__ ,		**snake_case__				)
         UpperCAmelCase	    =			vocab_size
         UpperCAmelCase	    =			hidden_size
         UpperCAmelCase	    =			num_hidden_layers
         UpperCAmelCase	    =			num_attention_heads
         UpperCAmelCase	    =			hidden_act
         UpperCAmelCase	    =			intermediate_size
         UpperCAmelCase	    =			hidden_dropout_prob
         UpperCAmelCase	    =			attention_probs_dropout_prob
         UpperCAmelCase	    =			max_position_embeddings
         UpperCAmelCase	    =			type_vocab_size
         UpperCAmelCase	    =			initializer_range
         UpperCAmelCase	    =			layer_norm_eps
         UpperCAmelCase	    =			position_embedding_type
         UpperCAmelCase	    =			use_cache
         UpperCAmelCase	    =			classifier_dropout





class   UpperCamelCase_ (       a_  ):



  @property
  def 		UpperCamelCase_				(      self				)			->			Mapping[str, Mapping[int, str]]:



         """simple docstring"""





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