


from manim import *


class        _a							(			_UpperCamelCase			):

							def       lowerCamelCase_ (							self:	Dict							)			->   Optional[int]:





									"""simple docstring"""







									lowercase__            =      Rectangle(height=0.5    ,						width=0.5							)
									lowercase__            =      Rectangle(height=0.46    ,						width=0.46							).set_stroke(width=0							)

									lowercase__            =      [mem.copy() for i in range(6							)]
									lowercase__            =      [mem.copy() for i in range(6							)]
									lowercase__            =      VGroup(*lowerCAmelCase_							).arrange(lowerCAmelCase_    ,						buff=0							)
									lowercase__            =      VGroup(*lowerCAmelCase_							).arrange(lowerCAmelCase_    ,						buff=0							)
									lowercase__            =      VGroup(lowerCAmelCase_    ,						lowerCAmelCase_							).arrange(lowerCAmelCase_    ,						buff=0							)
									lowercase__            =      Text('''CPU'''    ,						font_size=24							)
									lowercase__            =      Group(lowerCAmelCase_    ,						lowerCAmelCase_							).arrange(lowerCAmelCase_    ,						buff=0.5    ,						aligned_edge=lowerCAmelCase_							)
									cpu.move_to([-2.5, -0.5, 0]							)
									self.add(lowerCAmelCase_							)

									lowercase__            =      [mem.copy() for i in range(4							)]
									lowercase__            =      VGroup(*lowerCAmelCase_							).arrange(lowerCAmelCase_    ,						buff=0							)
									lowercase__            =      Text('''GPU'''    ,						font_size=24							)
									lowercase__            =      Group(lowerCAmelCase_    ,						lowerCAmelCase_							).arrange(lowerCAmelCase_    ,						buff=0.5    ,						aligned_edge=lowerCAmelCase_							)
									gpu.move_to([-1, -1, 0]							)
									self.add(lowerCAmelCase_							)

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

									lowercase__            =      Text('''Model'''    ,						font_size=24							)
									lowercase__            =      Group(lowerCAmelCase_    ,						lowerCAmelCase_							).arrange(lowerCAmelCase_    ,						buff=0.5    ,						aligned_edge=lowerCAmelCase_							)
									model.move_to([3, -1.0, 0]							)
									self.add(lowerCAmelCase_							)

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

											lowercase__            =      Rectangle(height=0.46 / 4    ,						width=0.46 / 3							).set_stroke(width=0.0							).set_fill(lowerCAmelCase_    ,						opacity=0.7							)

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

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

									lowercase__            =      Text('''Loaded Checkpoint'''    ,						font_size=24							)
									lowercase__            =      Group(lowerCAmelCase_    ,						lowerCAmelCase_							).arrange(lowerCAmelCase_    ,						aligned_edge=lowerCAmelCase_    ,						buff=0.4							)
									checkpoint.move_to([3, 0.5, 0]							)

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

									lowercase__            =      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(lowerCAmelCase_    ,						lowerCAmelCase_							)

									lowercase__            =      MarkupText(
									    f'<span fgcolor=\'{BLUE}\'>●</span> Checkpoint'    ,						font_size=18    ,						)

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

									lowercase__            =      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(lowerCAmelCase_							)    ,						Write(lowerCAmelCase_							)							)

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

									lowercase__            =      []
									lowercase__            =      []
									for i, rect in enumerate(lowerCAmelCase_							):
											lowercase__            =      fill.copy().set_fill(lowerCAmelCase_    ,						opacity=0.7							)
											target.move_to(lowerCAmelCase_							)
											first_animations.append(GrowFromCenter(lowerCAmelCase_    ,						run_time=1							)							)

											lowercase__            =      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(lowerCAmelCase_    ,						run_time=1.5							)							)

									self.play(*lowerCAmelCase_							)
									self.play(*lowerCAmelCase_							)
									self.wait()









from ..utils import (
    OptionalDependencyNotAvailable,
    is_flax_available,
    is_scipy_available,
    is_torch_available,
    is_torchsde_available,
)


try:
     if not is_torch_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     from ..utils.dummy_pt_objects import *  # noqa F403
else:
     from .scheduling_consistency_models import CMStochasticIterativeScheduler
     from .scheduling_ddim import DDIMScheduler
     from .scheduling_ddim_inverse import DDIMInverseScheduler
     from .scheduling_ddim_parallel import DDIMParallelScheduler
     from .scheduling_ddpm import DDPMScheduler
     from .scheduling_ddpm_parallel import DDPMParallelScheduler
     from .scheduling_deis_multistep import DEISMultistepScheduler
     from .scheduling_dpmsolver_multistep import DPMSolverMultistepScheduler
     from .scheduling_dpmsolver_multistep_inverse import DPMSolverMultistepInverseScheduler
     from .scheduling_dpmsolver_singlestep import DPMSolverSinglestepScheduler
     from .scheduling_euler_ancestral_discrete import EulerAncestralDiscreteScheduler
     from .scheduling_euler_discrete import EulerDiscreteScheduler
     from .scheduling_heun_discrete import HeunDiscreteScheduler
     from .scheduling_ipndm import IPNDMScheduler
     from .scheduling_k_dpm_2_ancestral_discrete import KDPMaAncestralDiscreteScheduler
     from .scheduling_k_dpm_2_discrete import KDPMaDiscreteScheduler
     from .scheduling_karras_ve import KarrasVeScheduler
     from .scheduling_pndm import PNDMScheduler
     from .scheduling_repaint import RePaintScheduler
     from .scheduling_sde_ve import ScoreSdeVeScheduler
     from .scheduling_sde_vp import ScoreSdeVpScheduler
     from .scheduling_unclip import UnCLIPScheduler
     from .scheduling_unipc_multistep import UniPCMultistepScheduler
     from .scheduling_utils import KarrasDiffusionSchedulers, SchedulerMixin
     from .scheduling_vq_diffusion import VQDiffusionScheduler

try:
     if not is_flax_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     from ..utils.dummy_flax_objects import *  # noqa F403
else:
     from .scheduling_ddim_flax import FlaxDDIMScheduler
     from .scheduling_ddpm_flax import FlaxDDPMScheduler
     from .scheduling_dpmsolver_multistep_flax import FlaxDPMSolverMultistepScheduler
     from .scheduling_karras_ve_flax import FlaxKarrasVeScheduler
     from .scheduling_lms_discrete_flax import FlaxLMSDiscreteScheduler
     from .scheduling_pndm_flax import FlaxPNDMScheduler
     from .scheduling_sde_ve_flax import FlaxScoreSdeVeScheduler
     from .scheduling_utils_flax import (
         FlaxKarrasDiffusionSchedulers,
         FlaxSchedulerMixin,
         FlaxSchedulerOutput,
         broadcast_to_shape_from_left,
     )


try:
     if not (is_torch_available() and is_scipy_available()):
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     from ..utils.dummy_torch_and_scipy_objects import *  # noqa F403
else:
     from .scheduling_lms_discrete import LMSDiscreteScheduler

try:
     if not (is_torch_available() and is_torchsde_available()):
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     from ..utils.dummy_torch_and_torchsde_objects import *  # noqa F403
else:
     from .scheduling_dpmsolver_sde import DPMSolverSDEScheduler

