
from manim import *

class        _UpperCamelCase				(					_A  ):






			'''simple docstring'''

			def       lowerCAmelCase__	(       self :       Union[str, Any]      ):
							UpperCamelCase_:							Tuple	=						Rectangle(height=0.5						,	width=0.5      )
							UpperCamelCase_:							Dict	=						Rectangle(height=0.46						,	width=0.46      ).set_stroke(width=0      )

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

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

							UpperCamelCase_:							Optional[Any]	=						[mem.copy() for i in range(6      )]
							UpperCamelCase_:							Union[str, Any]	=						VGroup(*snake_case_      ).arrange(snake_case_						,	buff=0      )

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

							UpperCamelCase_:							str	=						[]
							for i, rect in enumerate(snake_case_      ):
											rect.set_stroke(snake_case_      )
											# target = fill.copy().set_fill(YELLOW, opacity=0.7)
											# target.move_to(rect)
											# self.add(target)

											UpperCamelCase_:							List[Any]	=						Rectangle(height=0.46 / 4						,	width=0.46 / 3      ).set_stroke(width=0.0      ).set_fill(snake_case_						,	opacity=0.7      )

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

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

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

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

							UpperCamelCase_:							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(snake_case_						,	snake_case_      )

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

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

							UpperCamelCase_:							int	=						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(snake_case_      )						,	Write(snake_case_      )      )

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

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

											UpperCamelCase_:							int	=						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(snake_case_						,	run_time=1.5      )      )

							self.play(*snake_case_      )
							self.play(*snake_case_      )
							self.wait()








import os

from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE, hf_cache_home


lowerCamelCase_						: Optional[int]         =  HUGGINGFACE_HUB_CACHE


lowerCamelCase_						: List[str]         =  """config.json"""
lowerCamelCase_						: Any         =  """diffusion_pytorch_model.bin"""
lowerCamelCase_						: Union[str, Any]         =  """diffusion_flax_model.msgpack"""
lowerCamelCase_						: Dict         =  """model.onnx"""
lowerCamelCase_						: List[Any]         =  """diffusion_pytorch_model.safetensors"""
lowerCamelCase_						: Optional[Any]         =  """weights.pb"""
lowerCamelCase_						: Optional[Any]         =  """https://huggingface.co"""
lowerCamelCase_						: Union[str, Any]         =  default_cache_path
lowerCamelCase_						: Tuple         =  """diffusers_modules"""
lowerCamelCase_						: Optional[Any]         =  os.getenv("""HF_MODULES_CACHE""", os.path.join(hf_cache_home, """modules"""))
lowerCamelCase_						: str         =  ["""fp16""", """non-ema"""]
lowerCamelCase_						: List[Any]         =  """.self_attn"""






