





"""simple docstring"""





from manim import *





class        _lowerCamelCase      (       _lowercase ):


						def     snake_case_   (self		) ->   Dict:
								UpperCamelCase   =	Rectangle(height=0.5   ,							width=0.5		)
								UpperCamelCase   =	Rectangle(height=0.46   ,							width=0.46		).set_stroke(width=0		)

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

								UpperCamelCase   =	[mem.copy() for i in range(1		)]
								UpperCamelCase   =	VGroup(*__a		).arrange(__a   ,							buff=0		)
								UpperCamelCase   =	Text("GPU"   ,							font_size=24		)
								UpperCamelCase   =	Group(__a   ,							__a		).arrange(__a   ,							buff=0.5   ,							aligned_edge=__a		)
								gpu.align_to(__a   ,							__a		)
								gpu.set_x(gpu.get_x() - 1		)

								self.add(__a		)

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

								UpperCamelCase   =	Text("Model"   ,							font_size=24		)
								UpperCamelCase   =	Group(__a   ,							__a		).arrange(__a   ,							buff=0.5   ,							aligned_edge=__a		)
								model.move_to([3, -1.0, 0]		)

								self.play(
								    Create(__a   ,							run_time=1		)   ,							Create(__a   ,							run_time=1		)   ,							Create(__a   ,							run_time=1		)   ,							)

								UpperCamelCase   =	MarkupText(
								    F"First, an empty model skeleton is loaded\ninto <span fgcolor='{YELLOW}'>memory</span> without using much RAM."   ,							font_size=24   ,							)

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

								UpperCamelCase   =	MarkupText(
								    F"<b>Key:</b>\n\n<span fgcolor='{YELLOW}'>●</span> Empty Model"   ,							font_size=18   ,							)

								key_text.move_to([-5, 2.4, 0]		)

								step_a.move_to([2, 2, 0]		)
								self.play(Write(__a   ,							run_time=2.5		)   ,							Write(__a		)   ,							Write(__a		)		)

								self.add(__a		)

								UpperCamelCase   =	[]
								UpperCamelCase   =	[]
								UpperCamelCase   =	[]
								for i, rect in enumerate(__a		):
										UpperCamelCase   =	Rectangle(height=0.46   ,							width=0.46		).set_stroke(width=0.0		).set_fill(__a   ,							opacity=0.7		)
										cpu_target.move_to(__a		)
										cpu_target.generate_target()
										UpperCamelCase   =	0.46 / 4
										UpperCamelCase   =	0.46 / 3

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

										first_animations.append(rect.animate(run_time=0.5		).set_stroke(__a		)		)
										second_animations.append(MoveToTarget(__a   ,							run_time=1.5		)		)

								self.play(*__a		)
								self.play(*__a		)

								self.wait()













"""simple docstring"""





from ...configuration_utils import PretrainedConfig
from ...utils import logging


lowerCAmelCase__     			=			logging.get_logger(__name__)

lowerCAmelCase__     			=			{
    '''microsoft/swinv2-tiny-patch4-window8-256''': (
        '''https://huggingface.co/microsoft/swinv2-tiny-patch4-window8-256/resolve/main/config.json'''
    ),
}





class        _lowerCamelCase      (       _lowercase ):
						UpperCAmelCase_ =			"swinv2"

						UpperCAmelCase_ =			{
						    "num_attention_heads": "num_heads",
						    "num_hidden_layers": "num_layers",
						}


						def __init__(self   ,							__a=2_24   ,							__a=4   ,							__a=3   ,							__a=96   ,							__a=[2, 2, 6, 2]   ,							__a=[3, 6, 12, 24]   ,							__a=7   ,							__a=4.0   ,							__a=True   ,							__a=0.0   ,							__a=0.0   ,							__a=0.1   ,							__a="gelu"   ,							__a=False   ,							__a=0.02   ,							__a=1e-5   ,							__a=32   ,							**__a   ,							) ->   Optional[Any]:
								super().__init__(**__a		)

								UpperCamelCase   =	image_size
								UpperCamelCase   =	patch_size
								UpperCamelCase   =	num_channels
								UpperCamelCase   =	embed_dim
								UpperCamelCase   =	depths
								UpperCamelCase   =	len(__a		)
								UpperCamelCase   =	num_heads
								UpperCamelCase   =	window_size
								UpperCamelCase   =	mlp_ratio
								UpperCamelCase   =	qkv_bias
								UpperCamelCase   =	hidden_dropout_prob
								UpperCamelCase   =	attention_probs_dropout_prob
								UpperCamelCase   =	drop_path_rate
								UpperCamelCase   =	hidden_act
								UpperCamelCase   =	use_absolute_embeddings
								UpperCamelCase   =	layer_norm_eps
								UpperCamelCase   =	initializer_range
								UpperCamelCase   =	encoder_stride
								# we set the hidden_size attribute in order to make Swinv2 work with VisionEncoderDecoderModel
								# this indicates the channel dimension after the last stage of the model
								UpperCamelCase   =	int(embed_dim * 2 ** (len(__a		) - 1)		)
								UpperCamelCase   =	(0, 0, 0, 0)






