
'''simple docstring'''

from manim import *




class    lowerCAmelCase       (     UpperCamelCase_  ):


 def    _A	(    self  : Dict    ):
  '''simple docstring'''

  lowerCAmelCase__     :   Optional[int]     		=	Rectangle(height=0.5			,							width=0.5    )
  lowerCAmelCase__     :   List[Any]     		=	Rectangle(height=0.25			,							width=0.25    )
  lowerCAmelCase__     :   Any     		=	Rectangle(height=0.46			,							width=0.46    ).set_stroke(width=0    )

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

  lowerCAmelCase__     :   int     		=	[mem.copy() for i in range(4    )]
  lowerCAmelCase__     :   Dict     		=	VGroup(*a__    ).arrange(a__			,							buff=0    )
  lowerCAmelCase__     :   Tuple     		=	Text("GPU"			,							font_size=24    )
  lowerCAmelCase__     :   List[str]     		=	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__     :   List[str]     		=	VGroup(*a__    ).arrange(a__			,							buff=0    )

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

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

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

   lowerCAmelCase__     :   Optional[Any]     		=	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__     :   List[str]     		=	[mem.copy() for i in range(6    )]
  lowerCAmelCase__     :   List[str]     		=	VGroup(*a__    ).arrange(a__			,							buff=0    )

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

  self.add(a__    )

  lowerCAmelCase__     :   Any     		=	[]
  lowerCAmelCase__     :   List[str]     		=	[]

  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__     :   Union[str, 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(a__    )
  self.add(*a__			,							*a__    )

  lowerCAmelCase__     :   Any     		=	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(a__			,							a__    )

  lowerCAmelCase__     :   Tuple     		=	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__     :   Dict     		=	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__     :   int     		=	[meta_mem.copy() for i in range(6    )]
  lowerCAmelCase__     :   str     		=	[meta_mem.copy() for i in range(6    )]
  lowerCAmelCase__     :   Dict     		=	VGroup(*a__    ).arrange(a__			,							buff=0    )
  lowerCAmelCase__     :   Union[str, Any]     		=	VGroup(*a__    ).arrange(a__			,							buff=0    )
  lowerCAmelCase__     :   str     		=	VGroup(a__			,							a__    ).arrange(a__			,							buff=0    )
  lowerCAmelCase__     :   Optional[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__     :   int     		=	[]
  for i, rect in enumerate(a__    ):
   lowerCAmelCase__     :   List[str]     		=	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__     :   int     		=	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'''

import os


# All paths are set with the intent you should run this script from the root of the repo with the command
# python utils/check_doctest_list.py
snake_case									=    """."""


if __name__ == "__main__":
     snake_case									=    os.path.join(REPO_PATH, """utils/documentation_tests.txt""")
     snake_case									=    []
     snake_case									=    []
     with open(doctest_file_path) as fp:
          for line in fp:
               snake_case									=    line.strip()
               snake_case									=    os.path.join(REPO_PATH, line)
               if not (os.path.isfile(path) or os.path.isdir(path)):
                    non_existent_paths.append(line)
               all_paths.append(path)
     if len(non_existent_paths) > 0:
          snake_case									=    """\n""".join(non_existent_paths)
          raise ValueError(f'`utils/documentation_tests.txt` contains non-existent paths:\n{non_existent_paths}')
     if all_paths != sorted(all_paths):
          raise ValueError("""Files in `utils/documentation_tests.txt` are not in alphabetical order.""")





