





'''simple docstring'''






from manim import *







class 		UpperCAmelCase   (				lowercase_):


  """simple docstring"""







  def   UpperCamelCase__      (				self    :					List[str]  )     ->						str:
    _UpperCamelCase       			=Rectangle(height=0.5							,	width=0.5  )
    _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(*UpperCamelCase__  ).arrange(UpperCamelCase__							,	buff=0  )
    _UpperCamelCase       			=VGroup(*UpperCamelCase__  ).arrange(UpperCamelCase__							,	buff=0  )
    _UpperCamelCase       			=VGroup(UpperCamelCase__							,	UpperCamelCase__  ).arrange(UpperCamelCase__							,	buff=0  )
    _UpperCamelCase       			=Text('''CPU'''							,	font_size=24  )
    _UpperCamelCase       			=Group(UpperCamelCase__							,	UpperCamelCase__  ).arrange(UpperCamelCase__							,	buff=0.5							,	aligned_edge=UpperCamelCase__  )
    cpu.move_to([-2.5, -0.5, 0]  )
    self.add(UpperCamelCase__  )

    _UpperCamelCase       			=[mem.copy() for i in range(1  )]
    _UpperCamelCase       			=VGroup(*UpperCamelCase__  ).arrange(UpperCamelCase__							,	buff=0  )
    _UpperCamelCase       			=Text('''GPU'''							,	font_size=24  )
    _UpperCamelCase       			=Group(UpperCamelCase__							,	UpperCamelCase__  ).arrange(UpperCamelCase__							,	buff=0.5							,	aligned_edge=UpperCamelCase__  )
    gpu.align_to(UpperCamelCase__							,	UpperCamelCase__  )
    gpu.set_x(gpu.get_x() - 1  )

    self.add(UpperCamelCase__  )

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

    _UpperCamelCase       			=Text('''Model'''							,	font_size=24  )
    _UpperCamelCase       			=Group(UpperCamelCase__							,	UpperCamelCase__  ).arrange(UpperCamelCase__							,	buff=0.5							,	aligned_edge=UpperCamelCase__  )
    model.move_to([3, -1.0, 0]  )

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

    _UpperCamelCase       			=MarkupText(
        F'''First, an empty model skeleton is loaded\ninto <span fgcolor=\'{YELLOW}\'>memory</span> without using much RAM.'''							,	font_size=24							,	)

    _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]  )

    step_a.move_to([2, 2, 0]  )
    self.play(Write(UpperCamelCase__							,	run_time=2.5  )							,	Write(UpperCamelCase__  )							,	Write(UpperCamelCase__  )  )

    self.add(UpperCamelCase__  )

    _UpperCamelCase       			=[]
    _UpperCamelCase       			=[]
    _UpperCamelCase       			=[]
    for i, rect in enumerate(UpperCamelCase__  ):
      _UpperCamelCase       			=Rectangle(height=0.46							,	width=0.46  ).set_stroke(width=0.0  ).set_fill(UpperCamelCase__							,	opacity=0.7  )
      cpu_target.move_to(UpperCamelCase__  )
      cpu_target.generate_target()
      _UpperCamelCase       			=0.46 / 4
      _UpperCamelCase       			=0.46 / 3

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

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

    self.play(*UpperCamelCase__  )
    self.play(*UpperCamelCase__  )

    self.wait()













'''simple docstring'''






# Copyright 2023 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


__lowerCamelCase						: Optional[int]		=   {
    'configuration_xmod': [
        'XMOD_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'XmodConfig',
        'XmodOnnxConfig',
    ],
}

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      __lowerCamelCase						: int		=   [
          'XMOD_PRETRAINED_MODEL_ARCHIVE_LIST',
          'XmodForCausalLM',
          'XmodForMaskedLM',
          'XmodForMultipleChoice',
          'XmodForQuestionAnswering',
          'XmodForSequenceClassification',
          'XmodForTokenClassification',
          'XmodModel',
          'XmodPreTrainedModel',
      ]

if TYPE_CHECKING:
      from .configuration_xmod import XMOD_PRETRAINED_CONFIG_ARCHIVE_MAP, XmodConfig, XmodOnnxConfig

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_xmod import (
                XMOD_PRETRAINED_MODEL_ARCHIVE_LIST,
                XmodForCausalLM,
                XmodForMaskedLM,
                XmodForMultipleChoice,
                XmodForQuestionAnswering,
                XmodForSequenceClassification,
                XmodForTokenClassification,
                XmodModel,
                XmodPreTrainedModel,
            )

else:
      import sys

      __lowerCamelCase						: Dict		=   _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)






