






from manim import *

class 		lowerCAmelCase     ( __a			):

					'''simple docstring'''

					def       lowerCAmelCase				(  self				:	Optional[int]							)			->  int:


												"""simple docstring"""

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

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

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

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

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

												__lowercase      :							List[str]				=     []
												__lowercase      :							Dict				=     []
												__lowercase      :							Tuple				=     []

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

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

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

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

												self.add(__a							)

												__lowercase      :							List[Any]				=     []
												__lowercase      :							str				=     []

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

																			__lowercase      :							str				=     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							)

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

												__lowercase      :							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(__a		,     __a							)

												__lowercase      :							Union[str, Any]				=     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							)

												__lowercase      :							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]							)

												__lowercase      :							Any				=     [meta_mem.copy() for i in range(6							)]
												__lowercase      :							List[str]				=     [meta_mem.copy() for i in range(6							)]
												__lowercase      :							List[Any]				=     VGroup(*__a							).arrange(__a		,     buff=0							)
												__lowercase      :							List[Any]				=     VGroup(*__a							).arrange(__a		,     buff=0							)
												__lowercase      :							List[Any]				=     VGroup(__a		,     __a							).arrange(__a		,     buff=0							)
												__lowercase      :							Dict				=     Text("""Disk"""		,     font_size=24							)
												__lowercase      :							Union[str, 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							)							)

												__lowercase      :							Optional[int]				=     []
												for i, rect in enumerate(__a							):
																			__lowercase      :							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							)							)

												__lowercase      :							Dict				=     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()







lowerCamelCase : List[str]						   =       '''0.18.2'''

from .configuration_utils import ConfigMixin
from .utils import (
    OptionalDependencyNotAvailable,
    is_flax_available,
    is_inflect_available,
    is_invisible_watermark_available,
    is_k_diffusion_available,
    is_k_diffusion_version,
    is_librosa_available,
    is_note_seq_available,
    is_onnx_available,
    is_scipy_available,
    is_torch_available,
    is_torchsde_available,
    is_transformers_available,
    is_transformers_version,
    is_unidecode_available,
    logging,
)


try:
	if not is_onnx_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	from .utils.dummy_onnx_objects import *  # noqa F403
else:
	from .pipelines import OnnxRuntimeModel

try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	from .utils.dummy_pt_objects import *  # noqa F403
else:
	from .models import (
	    AutoencoderKL,
	    ControlNetModel,
	    ModelMixin,
	    PriorTransformer,
	    TaFilmDecoder,
	    TransformeraDModel,
	    UNetaDModel,
	    UNetaDConditionModel,
	    UNetaDModel,
	    UNetaDConditionModel,
	    VQModel,
	)
	from .optimization import (
	    get_constant_schedule,
	    get_constant_schedule_with_warmup,
	    get_cosine_schedule_with_warmup,
	    get_cosine_with_hard_restarts_schedule_with_warmup,
	    get_linear_schedule_with_warmup,
	    get_polynomial_decay_schedule_with_warmup,
	    get_scheduler,
	)
	from .pipelines import (
	    AudioPipelineOutput,
	    ConsistencyModelPipeline,
	    DanceDiffusionPipeline,
	    DDIMPipeline,
	    DDPMPipeline,
	    DiffusionPipeline,
	    DiTPipeline,
	    ImagePipelineOutput,
	    KarrasVePipeline,
	    LDMPipeline,
	    LDMSuperResolutionPipeline,
	    PNDMPipeline,
	    RePaintPipeline,
	    ScoreSdeVePipeline,
	)
	from .schedulers import (
	    CMStochasticIterativeScheduler,
	    DDIMInverseScheduler,
	    DDIMParallelScheduler,
	    DDIMScheduler,
	    DDPMParallelScheduler,
	    DDPMScheduler,
	    DEISMultistepScheduler,
	    DPMSolverMultistepInverseScheduler,
	    DPMSolverMultistepScheduler,
	    DPMSolverSinglestepScheduler,
	    EulerAncestralDiscreteScheduler,
	    EulerDiscreteScheduler,
	    HeunDiscreteScheduler,
	    IPNDMScheduler,
	    KarrasVeScheduler,
	    KDPMaAncestralDiscreteScheduler,
	    KDPMaDiscreteScheduler,
	    PNDMScheduler,
	    RePaintScheduler,
	    SchedulerMixin,
	    ScoreSdeVeScheduler,
	    UnCLIPScheduler,
	    UniPCMultistepScheduler,
	    VQDiffusionScheduler,
	)
	from .training_utils import EMAModel

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 .schedulers 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 .schedulers import DPMSolverSDEScheduler

try:
	if not (is_torch_available() and is_transformers_available()):
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	from .utils.dummy_torch_and_transformers_objects import *  # noqa F403
else:
	from .pipelines import (
	    AltDiffusionImgaImgPipeline,
	    AltDiffusionPipeline,
	    AudioLDMPipeline,
	    CycleDiffusionPipeline,
	    IFImgaImgPipeline,
	    IFImgaImgSuperResolutionPipeline,
	    IFInpaintingPipeline,
	    IFInpaintingSuperResolutionPipeline,
	    IFPipeline,
	    IFSuperResolutionPipeline,
	    ImageTextPipelineOutput,
	    KandinskyImgaImgPipeline,
	    KandinskyInpaintPipeline,
	    KandinskyPipeline,
	    KandinskyPriorPipeline,
	    KandinskyVaaControlnetImgaImgPipeline,
	    KandinskyVaaControlnetPipeline,
	    KandinskyVaaImgaImgPipeline,
	    KandinskyVaaInpaintPipeline,
	    KandinskyVaaPipeline,
	    KandinskyVaaPriorEmbaEmbPipeline,
	    KandinskyVaaPriorPipeline,
	    LDMTextToImagePipeline,
	    PaintByExamplePipeline,
	    SemanticStableDiffusionPipeline,
	    ShapEImgaImgPipeline,
	    ShapEPipeline,
	    StableDiffusionAttendAndExcitePipeline,
	    StableDiffusionControlNetImgaImgPipeline,
	    StableDiffusionControlNetInpaintPipeline,
	    StableDiffusionControlNetPipeline,
	    StableDiffusionDepthaImgPipeline,
	    StableDiffusionDiffEditPipeline,
	    StableDiffusionImageVariationPipeline,
	    StableDiffusionImgaImgPipeline,
	    StableDiffusionInpaintPipeline,
	    StableDiffusionInpaintPipelineLegacy,
	    StableDiffusionInstructPixaPixPipeline,
	    StableDiffusionLatentUpscalePipeline,
	    StableDiffusionLDMaDPipeline,
	    StableDiffusionModelEditingPipeline,
	    StableDiffusionPanoramaPipeline,
	    StableDiffusionParadigmsPipeline,
	    StableDiffusionPipeline,
	    StableDiffusionPipelineSafe,
	    StableDiffusionPixaPixZeroPipeline,
	    StableDiffusionSAGPipeline,
	    StableDiffusionUpscalePipeline,
	    StableUnCLIPImgaImgPipeline,
	    StableUnCLIPPipeline,
	    TextToVideoSDPipeline,
	    TextToVideoZeroPipeline,
	    UnCLIPImageVariationPipeline,
	    UnCLIPPipeline,
	    UniDiffuserModel,
	    UniDiffuserPipeline,
	    UniDiffuserTextDecoder,
	    VersatileDiffusionDualGuidedPipeline,
	    VersatileDiffusionImageVariationPipeline,
	    VersatileDiffusionPipeline,
	    VersatileDiffusionTextToImagePipeline,
	    VideoToVideoSDPipeline,
	    VQDiffusionPipeline,
	)

try:
	if not (is_torch_available() and is_transformers_available() and is_invisible_watermark_available()):
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	from .utils.dummy_torch_and_transformers_and_invisible_watermark_objects import *  # noqa F403
else:
	from .pipelines import StableDiffusionXLImgaImgPipeline, StableDiffusionXLPipeline

try:
	if not (is_torch_available() and is_transformers_available() and is_k_diffusion_available()):
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	from .utils.dummy_torch_and_transformers_and_k_diffusion_objects import *  # noqa F403
else:
	from .pipelines import StableDiffusionKDiffusionPipeline

try:
	if not (is_torch_available() and is_transformers_available() and is_onnx_available()):
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	from .utils.dummy_torch_and_transformers_and_onnx_objects import *  # noqa F403
else:
	from .pipelines import (
	    OnnxStableDiffusionImgaImgPipeline,
	    OnnxStableDiffusionInpaintPipeline,
	    OnnxStableDiffusionInpaintPipelineLegacy,
	    OnnxStableDiffusionPipeline,
	    OnnxStableDiffusionUpscalePipeline,
	    StableDiffusionOnnxPipeline,
	)

try:
	if not (is_torch_available() and is_librosa_available()):
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	from .utils.dummy_torch_and_librosa_objects import *  # noqa F403
else:
	from .pipelines import AudioDiffusionPipeline, Mel

try:
	if not (is_transformers_available() and is_torch_available() and is_note_seq_available()):
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	from .utils.dummy_transformers_and_torch_and_note_seq_objects import *  # noqa F403
else:
	from .pipelines import SpectrogramDiffusionPipeline

try:
	if not is_flax_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	from .utils.dummy_flax_objects import *  # noqa F403
else:
	from .models.controlnet_flax import FlaxControlNetModel
	from .models.modeling_flax_utils import FlaxModelMixin
	from .models.unet_ad_condition_flax import FlaxUNetaDConditionModel
	from .models.vae_flax import FlaxAutoencoderKL
	from .pipelines import FlaxDiffusionPipeline
	from .schedulers import (
	    FlaxDDIMScheduler,
	    FlaxDDPMScheduler,
	    FlaxDPMSolverMultistepScheduler,
	    FlaxKarrasVeScheduler,
	    FlaxLMSDiscreteScheduler,
	    FlaxPNDMScheduler,
	    FlaxSchedulerMixin,
	    FlaxScoreSdeVeScheduler,
	)


try:
	if not (is_flax_available() and is_transformers_available()):
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	from .utils.dummy_flax_and_transformers_objects import *  # noqa F403
else:
	from .pipelines import (
	    FlaxStableDiffusionControlNetPipeline,
	    FlaxStableDiffusionImgaImgPipeline,
	    FlaxStableDiffusionInpaintPipeline,
	    FlaxStableDiffusionPipeline,
	)

try:
	if not (is_note_seq_available()):
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	from .utils.dummy_note_seq_objects import *  # noqa F403
else:
	from .pipelines import MidiProcessor