



"""simple docstring"""
from manim import *
class     lowerCamelCase  (      lowerCAmelCase_    ):






     '''simple docstring'''





     def        lowerCAmelCase_    (	self:							List[Any]						)       ->     Dict:
           snake_case_			:str						=      Rectangle(height=0.5						,					width=0.5						)
           snake_case_			:str						=      Rectangle(height=0.4_6						,					width=0.4_6						).set_stroke(width=0						)
           snake_case_			:List[Any]						=      Rectangle(height=0.2_5						,					width=0.2_5						)

           snake_case_			:Any						=      [mem.copy() for i in range(6						)]
           snake_case_			:Optional[Any]						=      [mem.copy() for i in range(6						)]
           snake_case_			:int						=      VGroup(*_snake_case						).arrange(_snake_case						,					buff=0						)
           snake_case_			:Optional[int]						=      VGroup(*_snake_case						).arrange(_snake_case						,					buff=0						)
           snake_case_			:Any						=      VGroup(_snake_case						,					_snake_case						).arrange(_snake_case						,					buff=0						)
           snake_case_			:Optional[Any]						=      Text("""CPU"""						,					font_size=24						)
           snake_case_			:str						=      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						)

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

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

           snake_case_			:int						=      Text("""Model"""						,					font_size=24						)
           snake_case_			:List[Any]						=      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						)

           snake_case_			:Any						=      []
           snake_case_			:Optional[int]						=      []

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

                 snake_case_			:Union[str, Any]						=      Rectangle(height=0.4_6 / 4						,					width=0.4_6 / 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.0_2						,					direction=_snake_case						)
                       cpu_target.set_x(cpu_target.get_x() + 0.1						)
                 elif i == 3:
                       cpu_target.next_to(model_cpu_arr[0]						,					direction=_snake_case						,					buff=0.0						)
                 else:
                       cpu_target.next_to(model_cpu_arr[i - 1]						,					direction=_snake_case						,					buff=0.0						)
                 self.add(_snake_case						)
                 model_cpu_arr.append(_snake_case						)

           self.add(*_snake_case						,					*_snake_case						)

           snake_case_			:Optional[Any]						=      [meta_mem.copy() for i in range(6						)]
           snake_case_			:List[Any]						=      [meta_mem.copy() for i in range(6						)]
           snake_case_			:Dict						=      VGroup(*_snake_case						).arrange(_snake_case						,					buff=0						)
           snake_case_			:Tuple						=      VGroup(*_snake_case						).arrange(_snake_case						,					buff=0						)
           snake_case_			:int						=      VGroup(_snake_case						,					_snake_case						).arrange(_snake_case						,					buff=0						)
           snake_case_			:Union[str, Any]						=      Text("""Disk"""						,					font_size=24						)
           snake_case_			:int						=      Group(_snake_case						,					_snake_case						).arrange(_snake_case						,					buff=0.5						,					aligned_edge=_snake_case						)
           disk.move_to([-4.0, -1.2_5, 0]						)
           self.add(_snake_case						,					_snake_case						)

           snake_case_			:str						=      []

           for i in range(6						):
                 snake_case_			:str						=      fill.copy().set_fill(_snake_case						,					opacity=0.8						)
                 target.move_to(disk_left_col_base[i]						).scale(0.5						)
                 cpu_disk_arr.append(_snake_case						)

           self.add(*_snake_case						)

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

           snake_case_			: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						)

           snake_case_			: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()						)
           self.add(_snake_case						)

           snake_case_			:Optional[int]						=      MarkupText(f"""The offloaded weights are all sent to the CPU."""						,					font_size=24						)
           step_a.move_to([2, 2, 0]						)

           self.play(Write(_snake_case						,					run_time=3						)						)

           for i in range(6						):
                 snake_case_			:int						=      cpu_disk_arr[i]
                 snake_case_			:Optional[Any]						=      rect.copy().set_fill(_snake_case						,					opacity=0.8						).scale(2.0						)
                 cpa.generate_target()
                 cpa.target.move_to(model_base[i]						)

                 if i == 0:
                       rect.set_fill(_snake_case						,					opacity=0.8						)
                       rect.generate_target()
                       rect.target.move_to(cpu_left_col_base[0]						).scale(2.0						)

                       self.remove(
                           *_snake_case						,					*_snake_case						,					)

                 else:
                       rect.generate_target()
                       rect.target.move_to(cpu_left_col_base[i]						).scale(2.0						)
                 self.play(MoveToTarget(_snake_case						)						,					MoveToTarget(_snake_case						)						,					model_base[i].animate.set_stroke(_snake_case						)						)
           self.play(FadeOut(_snake_case						)						)

           snake_case_			:Optional[Any]						=      MarkupText(
               f"""Finally, hooks are added to each weight in the model\nto transfer the weights from CPU to GPU\n\t\tand back when needed."""						,					font_size=24						,					)
           step_a.move_to([2, 2, 0]						)

           self.play(Write(_snake_case						,					run_time=3						)						)

           snake_case_			:str						=      []
           snake_case_			:Optional[Any]						=      []
           for i in range(6						):
                 snake_case_			:List[Any]						=      Arrow(start=_snake_case						,					end=_snake_case						,					color=_snake_case						,					buff=0.5						)
                 a.next_to(model_base[i].get_left()						,					_snake_case						,					buff=0.2						)
                 arrows.append(_snake_case						)
                 animations.append(Write(_snake_case						)						)
           self.play(*_snake_case						)
           self.wait()





"""simple docstring"""
import unittest
from pathlib import Path
from tempfile import TemporaryDirectory
from unittest.mock import Mock, patch

import diffusers.utils.hub_utils
class     lowerCamelCase  (      unittest.TestCase    ):






					'''simple docstring'''





					@patch("""diffusers.utils.hub_utils.get_full_repo_name"""						)
					def        lowerCAmelCase_    (	self:							int						,					snake_case:							Mock						)       ->     None:
											snake_case_			:str						=      """full_repo_name"""
											with TemporaryDirectory() as tmpdir:
																	# Dummy args values
																	snake_case_			:int						=      Mock()
																	snake_case_			:Any						=      tmpdir
																	snake_case_			:int						=      0
																	snake_case_			:Optional[int]						=      """hub_token"""
																	snake_case_			:str						=      """dataset_name"""
																	snake_case_			:List[str]						=      0.0_1
																	snake_case_			:Dict						=      100_000
																	snake_case_			:Optional[Any]						=      10_000
																	snake_case_			:Optional[Any]						=      0.0_1
																	snake_case_			:Dict						=      0.0_2
																	snake_case_			:Dict						=      0.0_3
																	snake_case_			:Union[str, Any]						=      0.0_0_0_5
																	snake_case_			:Optional[Any]						=      0.0_0_0_0_0_1
																	snake_case_			:List[Any]						=      1
																	snake_case_			:Optional[Any]						=      10
																	snake_case_			:Dict						=      0.0_0_1
																	snake_case_			:Any						=      0.1
																	snake_case_			:List[Any]						=      0.2
																	snake_case_			:Any						=      True

																	# Model card mush be rendered and saved
																	diffusers.utils.hub_utils.create_model_card(snake_case						,					model_name="""model_name"""						)
																	self.assertTrue((Path(snake_case						) / """README.md""").is_file()						)
