




from manim import *




class       __lowerCAmelCase				(							lowerCAmelCase):






       def     SCREAMING_SNAKE_CASE			(      self:    Tuple ):
         lowercase			:Tuple							=  Rectangle(height=0.5				,    width=0.5 )
         lowercase			:Tuple							=  Rectangle(height=0.46				,    width=0.46 ).set_stroke(width=0 )

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

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

         lowercase			:int							=  [mem.copy() for i in range(6 )]
         lowercase			:Optional[Any]							=  VGroup(*_lowerCAmelCase ).arrange(_lowerCAmelCase				,    buff=0 )

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

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

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

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

         lowercase			:Any							=  Text("Loaded Checkpoint"				,    font_size=24 )
         lowercase			:Optional[Any]							=  Group(_lowerCAmelCase				,    _lowerCAmelCase ).arrange(_lowerCAmelCase				,    aligned_edge=_lowerCAmelCase				,    buff=0.4 )
         checkpoint.move_to([3, 0.5, 0] )

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

         lowercase			:Optional[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 )

         lowercase			:int							=  MarkupText(
             F"<span fgcolor='{BLUE}'>●</span> Checkpoint"				,    font_size=18				,    )

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

         lowercase			:List[str]							=  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(_lowerCAmelCase )				,    Write(_lowerCAmelCase ) )

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

         lowercase			:List[str]							=  []
         lowercase			:Dict							=  []
         for i, rect in enumerate(_lowerCAmelCase ):
           lowercase			:Any							=  fill.copy().set_fill(_lowerCAmelCase				,    opacity=0.7 )
           target.move_to(_lowerCAmelCase )
           first_animations.append(GrowFromCenter(_lowerCAmelCase				,    run_time=1 ) )

           lowercase			:Dict							=  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(_lowerCAmelCase				,    run_time=1.5 ) )

         self.play(*_lowerCAmelCase )
         self.play(*_lowerCAmelCase )
         self.wait()









from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


_UpperCAmelCase		:  List[str]	=   {
    "configuration_blenderbot": [
        "BLENDERBOT_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "BlenderbotConfig",
        "BlenderbotOnnxConfig",
    ],
    "tokenization_blenderbot": ["BlenderbotTokenizer"],
}

try:
     if not is_tokenizers_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     _UpperCAmelCase		:  Optional[int]	=   ["BlenderbotTokenizerFast"]

try:
     if not is_torch_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     _UpperCAmelCase		:  int	=   [
         "BLENDERBOT_PRETRAINED_MODEL_ARCHIVE_LIST",
         "BlenderbotForCausalLM",
         "BlenderbotForConditionalGeneration",
         "BlenderbotModel",
         "BlenderbotPreTrainedModel",
     ]


try:
     if not is_tf_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     _UpperCAmelCase		:  Any	=   [
         "TFBlenderbotForConditionalGeneration",
         "TFBlenderbotModel",
         "TFBlenderbotPreTrainedModel",
     ]


try:
     if not is_flax_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     _UpperCAmelCase		:  Optional[int]	=   [
         "FlaxBlenderbotForConditionalGeneration",
         "FlaxBlenderbotModel",
         "FlaxBlenderbotPreTrainedModel",
     ]


if TYPE_CHECKING:
     from .configuration_blenderbot import (
         BLENDERBOT_PRETRAINED_CONFIG_ARCHIVE_MAP,
         BlenderbotConfig,
         BlenderbotOnnxConfig,
     )
     from .tokenization_blenderbot import BlenderbotTokenizer

     try:
          if not is_tokenizers_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .tokenization_blenderbot_fast import BlenderbotTokenizerFast

     try:
          if not is_torch_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_blenderbot import (
              BLENDERBOT_PRETRAINED_MODEL_ARCHIVE_LIST,
              BlenderbotForCausalLM,
              BlenderbotForConditionalGeneration,
              BlenderbotModel,
              BlenderbotPreTrainedModel,
          )

     try:
          if not is_tf_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_tf_blenderbot import (
              TFBlenderbotForConditionalGeneration,
              TFBlenderbotModel,
              TFBlenderbotPreTrainedModel,
          )

     try:
          if not is_flax_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_flax_blenderbot import (
              FlaxBlenderbotForConditionalGeneration,
              FlaxBlenderbotModel,
              FlaxBlenderbotPreTrainedModel,
          )

else:
     import sys

     _UpperCAmelCase		:  Union[str, Any]	=   _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)



