






"""simple docstring"""



from manim import *







class    lowercase__			(							SCREAMING_SNAKE_CASE__   ):


			def 	UpperCAmelCase__						(      self     :  List[str]					):
										lowerCamelCase_       :							Union[str, Any]									=Rectangle(height=0.5   ,       width=0.5					)
										lowerCamelCase_       :							Optional[int]									=Rectangle(height=0.25   ,       width=0.25					)
										lowerCamelCase_       :							Optional[Any]									=Rectangle(height=0.46   ,       width=0.46					).set_stroke(width=0					)

										lowerCamelCase_       :							List[str]									=[mem.copy() for i in range(6					)]
										lowerCamelCase_       :							Any									=[mem.copy() for i in range(6					)]
										lowerCamelCase_       :							int									=VGroup(*lowerCamelCase__					).arrange(lowerCamelCase__   ,       buff=0					)
										lowerCamelCase_       :							Tuple									=VGroup(*lowerCamelCase__					).arrange(lowerCamelCase__   ,       buff=0					)
										lowerCamelCase_       :							str									=VGroup(lowerCamelCase__   ,       lowerCamelCase__					).arrange(lowerCamelCase__   ,       buff=0					)
										lowerCamelCase_       :							List[Any]									=Text("CPU"   ,       font_size=24					)
										lowerCamelCase_       :							Optional[int]									=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(4					)]
										lowerCamelCase_       :							Optional[Any]									=VGroup(*lowerCamelCase__					).arrange(lowerCamelCase__   ,       buff=0					)
										lowerCamelCase_       :							Dict									=Text("GPU"   ,       font_size=24					)
										lowerCamelCase_       :							Any									=Group(lowerCamelCase__   ,       lowerCamelCase__					).arrange(lowerCamelCase__   ,       buff=0.5   ,       aligned_edge=lowerCamelCase__					)
										gpu.move_to([-1, -1, 0]					)
										self.add(lowerCamelCase__					)

										lowerCamelCase_       :							Optional[int]									=[mem.copy() for i in range(6					)]
										lowerCamelCase_       :							List[str]									=VGroup(*lowerCamelCase__					).arrange(lowerCamelCase__   ,       buff=0					)

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

										lowerCamelCase_       :							Tuple									=[]
										lowerCamelCase_       :							Tuple									=[]
										lowerCamelCase_       :							Any									=[]

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

																	lowerCamelCase_       :							Any									=Rectangle(height=0.46 / 4   ,       width=0.46 / 3					).set_stroke(width=0.0					).set_fill(lowerCamelCase__   ,       opacity=0.7					)

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

										self.add(*lowerCamelCase__   ,       *lowerCamelCase__   ,       *lowerCamelCase__					)

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

										lowerCamelCase_       :							str									=Text("Loaded Checkpoint"   ,       font_size=24					)
										lowerCamelCase_       :							List[str]									=Group(lowerCamelCase__   ,       lowerCamelCase__					).arrange(lowerCamelCase__   ,       buff=0.5   ,       aligned_edge=lowerCamelCase__					)
										checkpoint.move_to([3, 0.5, 0]					)

										self.add(lowerCamelCase__					)

										lowerCamelCase_       :							Optional[int]									=[]
										lowerCamelCase_       :							List[Any]									=[]

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

																	lowerCamelCase_       :							List[Any]									=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(lowerCamelCase__					)
										self.add(*lowerCamelCase__   ,       *lowerCamelCase__					)

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

										lowerCamelCase_       :							List[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]					)

										self.add(lowerCamelCase__   ,       lowerCamelCase__					)

										lowerCamelCase_       :							Union[str, Any]									=MarkupText(
										    F"""<span fgcolor=\'{BLUE}\'>●</span> Checkpoint"""   ,       font_size=18   ,       )

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

										lowerCamelCase_       :							List[str]									=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]					)

										lowerCamelCase_       :							List[str]									=[meta_mem.copy() for i in range(6					)]
										lowerCamelCase_       :							List[Any]									=[meta_mem.copy() for i in range(6					)]
										lowerCamelCase_       :							List[Any]									=VGroup(*lowerCamelCase__					).arrange(lowerCamelCase__   ,       buff=0					)
										lowerCamelCase_       :							List[str]									=VGroup(*lowerCamelCase__					).arrange(lowerCamelCase__   ,       buff=0					)
										lowerCamelCase_       :							Dict									=VGroup(lowerCamelCase__   ,       lowerCamelCase__					).arrange(lowerCamelCase__   ,       buff=0					)
										lowerCamelCase_       :							Optional[Any]									=Text("Disk"   ,       font_size=24					)
										lowerCamelCase_       :							List[str]									=Group(lowerCamelCase__   ,       lowerCamelCase__					).arrange(lowerCamelCase__   ,       buff=0.5   ,       aligned_edge=lowerCamelCase__					)
										disk.move_to([-4.0, -1.25, 0]					)
										self.play(Write(lowerCamelCase__   ,       run_time=3					)   ,       Write(lowerCamelCase__   ,       run_time=1					)   ,       Create(lowerCamelCase__   ,       run_time=1					)					)

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

										self.play(FadeOut(lowerCamelCase__					)					)

										lowerCamelCase_       :							List[str]									=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(lowerCamelCase__   ,       run_time=3					)					)

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

										self.wait()








from collections import OrderedDict
from typing import Mapping

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


SCREAMING_SNAKE_CASE_:Optional[Any]             =						logging.get_logger(__name__)

SCREAMING_SNAKE_CASE_:Dict             =						{
    """camembert-base""": """https://huggingface.co/camembert-base/resolve/main/config.json""",
    """umberto-commoncrawl-cased-v1""": (
        """https://huggingface.co/Musixmatch/umberto-commoncrawl-cased-v1/resolve/main/config.json"""
    ),
    """umberto-wikipedia-uncased-v1""": (
        """https://huggingface.co/Musixmatch/umberto-wikipedia-uncased-v1/resolve/main/config.json"""
    ),
}






class SCREAMING_SNAKE_CASE__     (		SCREAMING_SNAKE_CASE__    ):




    '''simple docstring'''






    __lowerCamelCase			: Optional[int]					=      "camembert"






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

        A :       List[Any]          =   vocab_size
        A :       Dict          =   hidden_size
        A :       str          =   num_hidden_layers
        A :       List[Any]          =   num_attention_heads
        A :       List[str]          =   hidden_act
        A :       Tuple          =   intermediate_size
        A :       Tuple          =   hidden_dropout_prob
        A :       List[Any]          =   attention_probs_dropout_prob
        A :       Optional[int]          =   max_position_embeddings
        A :       Tuple          =   type_vocab_size
        A :       List[Any]          =   initializer_range
        A :       str          =   layer_norm_eps
        A :       Tuple          =   position_embedding_type
        A :       str          =   use_cache
        A :       Any          =   classifier_dropout






class SCREAMING_SNAKE_CASE__     (		SCREAMING_SNAKE_CASE__    ):




    '''simple docstring'''






    @property
    def 			_lowerCAmelCase					(       self		):
        if self.task == "multiple-choice":
            A :       int          =   {0: """batch""", 1: """choice""", 2: """sequence"""}
        else:
            A :       Tuple          =   {0: """batch""", 1: """sequence"""}
        return OrderedDict(
            [
                ("""input_ids""", dynamic_axis),
                ("""attention_mask""", dynamic_axis),
            ]		)


