






from manim import *




class 							snake_case_       (    __UpperCamelCase      ):

						"""simple docstring"""



						def        UpperCAmelCase__					(self:					List[Any]   )    ->     Optional[int]:




											'''simple docstring'''



											__a					:						Union[str, Any]      =					Rectangle(height=0.5 ,					width=0.5   )
											__a					:						Optional[int]      =					Rectangle(height=0.25 ,					width=0.25   )
											__a					:						str      =					Rectangle(height=0.46 ,					width=0.46   ).set_stroke(width=0   )

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

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

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

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

											__a					:						Any      =					[]
											__a					:						List[Any]      =					[]
											__a					:						int      =					[]

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

																__a					:						str      =					Rectangle(height=0.46 / 4 ,					width=0.46 / 3   ).set_stroke(width=0.0   ).set_fill(__UpperCAmelCase ,					opacity=0.7   )

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

											self.add(*__UpperCAmelCase ,					*__UpperCAmelCase ,					*__UpperCAmelCase   )

											__a					:						Tuple      =					[mem.copy() for i in range(6   )]
											__a					:						str      =					VGroup(*__UpperCAmelCase   ).arrange(__UpperCAmelCase ,					buff=0   )

											__a					:						Optional[int]      =					Text("Loaded Checkpoint" ,					font_size=24   )
											__a					:						int      =					Group(__UpperCAmelCase ,					__UpperCAmelCase   ).arrange(__UpperCAmelCase ,					buff=0.5 ,					aligned_edge=__UpperCAmelCase   )
											checkpoint.move_to([3, 0.5, 0]   )

											self.add(__UpperCAmelCase   )

											__a					:						Union[str, Any]      =					[]
											__a					:						str      =					[]

											for i, rect in enumerate(__UpperCAmelCase   ):
																__a					:						Optional[Any]      =					fill.copy().set_fill(__UpperCAmelCase ,					opacity=0.7   )
																target.move_to(__UpperCAmelCase   )
																ckpt_arr.append(__UpperCAmelCase   )

																__a					:						Optional[int]      =					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(__UpperCAmelCase   )
											self.add(*__UpperCAmelCase ,					*__UpperCAmelCase   )

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

											__a					:						str      =					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(__UpperCAmelCase ,					__UpperCAmelCase   )

											__a					:						Optional[int]      =					MarkupText(
											    f'<span fgcolor=\'{BLUE}\'>●</span> Checkpoint' ,					font_size=18 ,					)

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

											__a					:						Tuple      =					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]   )

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

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

											self.play(FadeOut(__UpperCAmelCase   )   )

											__a					:						Optional[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(__UpperCAmelCase ,					run_time=3   )   )

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

											self.wait()













UpperCAmelCase__      			=						'''Input must be a string of 8 numbers plus letter'''
UpperCAmelCase__      			=						'''TRWAGMYFPDXBNJZSQVHLCKE'''







def     a_   (__A      )				->						bool:



					"""simple docstring"""

					if not isinstance(__A				,       __A      ):
										__a					:						Any      =					f'Expected string as input, found {type(__A      ).__name__}'
										raise TypeError(__A      )

					__a					:						int      =					spanish_id.replace("-"				,       ""      ).upper()
					if len(__A      ) != 9:
										raise ValueError(__A      )

					try:
										__a					:						Tuple      =					int(spanish_id_clean[0:8]      )
										__a					:						Optional[int]      =					spanish_id_clean[8]
					except ValueError as ex:
										raise ValueError(__A      ) from ex

					if letter.isdigit():
										raise ValueError(__A      )

					return letter == LOOKUP_LETTERS[number % 23]


if __name__ == "__main__":
			import doctest

			doctest.testmod()





