



'''simple docstring'''





from manim import *






class    lowerCamelCase_       (							SCREAMING_SNAKE_CASE_	):
  """simple docstring"""




  def 		_lowercase	(					self :      str  )   ->   Dict:
    __lowerCamelCase			:			Optional[Any]       			=					Rectangle(height=0.5     ,      width=0.5  )
    __lowerCamelCase			:			Dict       			=					Rectangle(height=0.25     ,      width=0.25  )
    __lowerCamelCase			:			Optional[int]       			=					Rectangle(height=0.46     ,      width=0.46  ).set_stroke(width=0  )

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

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

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

    __lowerCamelCase			:			Dict       			=					Text('Model'     ,      font_size=24  )
    __lowerCamelCase			:			Tuple       			=					Group(_a     ,      _a  ).arrange(_a     ,      buff=0.5     ,      aligned_edge=_a  )
    model.move_to([3, -1.0, 0]  )
    self.add(_a  )

    __lowerCamelCase			:			Optional[int]       			=					[]
    __lowerCamelCase			:			Dict       			=					[]
    __lowerCamelCase			:			Optional[int]       			=					[]

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

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

    self.add(*_a     ,      *_a     ,      *_a  )

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

    __lowerCamelCase			:			Tuple       			=					Text('Loaded Checkpoint'     ,      font_size=24  )
    __lowerCamelCase			:			str       			=					Group(_a     ,      _a  ).arrange(_a     ,      buff=0.5     ,      aligned_edge=_a  )
    checkpoint.move_to([3, 0.5, 0]  )

    self.add(_a  )

    __lowerCamelCase			:			Any       			=					[]
    __lowerCamelCase			:			Dict       			=					[]

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

      __lowerCamelCase			:			Dict       			=					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(_a  )
    self.add(*_a     ,      *_a  )

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

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

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

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

    __lowerCamelCase			:			int       			=					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			:			str       			=					[meta_mem.copy() for i in range(6  )]
    __lowerCamelCase			:			Tuple       			=					[meta_mem.copy() for i in range(6  )]
    __lowerCamelCase			:			int       			=					VGroup(*_a  ).arrange(_a     ,      buff=0  )
    __lowerCamelCase			:			Any       			=					VGroup(*_a  ).arrange(_a     ,      buff=0  )
    __lowerCamelCase			:			Optional[Any]       			=					VGroup(_a     ,      _a  ).arrange(_a     ,      buff=0  )
    __lowerCamelCase			:			int       			=					Text('Disk'     ,      font_size=24  )
    __lowerCamelCase			:			Any       			=					Group(_a     ,      _a  ).arrange(_a     ,      buff=0.5     ,      aligned_edge=_a  )
    disk.move_to([-4.0, -1.25, 0]  )
    self.play(Write(_a     ,      run_time=3  )     ,      Write(_a     ,      run_time=1  )     ,      Create(_a     ,      run_time=1  )  )

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

    self.play(FadeOut(_a  )  )

    __lowerCamelCase			:			Tuple       			=					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(_a     ,      run_time=3  )  )

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

    self.wait()











'''simple docstring'''





from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


_UpperCamelCase											=		{'configuration_ibert': ['IBERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'IBertConfig', 'IBertOnnxConfig']}

try:
   if not is_torch_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   _UpperCamelCase											=		[
       'IBERT_PRETRAINED_MODEL_ARCHIVE_LIST',
       'IBertForMaskedLM',
       'IBertForMultipleChoice',
       'IBertForQuestionAnswering',
       'IBertForSequenceClassification',
       'IBertForTokenClassification',
       'IBertModel',
       'IBertPreTrainedModel',
   ]

if TYPE_CHECKING:
   from .configuration_ibert import IBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, IBertConfig, IBertOnnxConfig

   try:
      if not is_torch_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_ibert import (
          IBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
          IBertForMaskedLM,
          IBertForMultipleChoice,
          IBertForQuestionAnswering,
          IBertForSequenceClassification,
          IBertForTokenClassification,
          IBertModel,
          IBertPreTrainedModel,
      )

else:
   import sys

   _UpperCamelCase											=		_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)






