



"""simple docstring"""


from manim import *
class 			_a (					lowerCAmelCase):
			"""simple docstring"""



			def  lowercase__						(		self     :    Dict   )->Tuple:
							_UpperCAmelCase					=    Rectangle(height=0.5				,   width=0.5   )
							_UpperCAmelCase					=    Rectangle(height=0.4_6				,   width=0.4_6   ).set_stroke(width=0   )

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

							_UpperCAmelCase					=    [mem.copy() for i in range(1   )]
							_UpperCAmelCase					=    VGroup(*__UpperCamelCase   ).arrange(__UpperCamelCase				,   buff=0   )
							_UpperCAmelCase					=    Text('''GPU'''				,   font_size=2_4   )
							_UpperCAmelCase					=    Group(__UpperCamelCase				,   __UpperCamelCase   ).arrange(__UpperCamelCase				,   buff=0.5				,   aligned_edge=__UpperCamelCase   )
							gpu.align_to(__UpperCamelCase				,   __UpperCamelCase   )
							gpu.set_x(gpu.get_x() - 1   )

							self.add(__UpperCamelCase   )

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

							_UpperCAmelCase					=    Text('''Model'''				,   font_size=2_4   )
							_UpperCAmelCase					=    Group(__UpperCamelCase				,   __UpperCamelCase   ).arrange(__UpperCamelCase				,   buff=0.5				,   aligned_edge=__UpperCamelCase   )
							model.move_to([3, -1.0, 0]   )

							self.play(
							    Create(__UpperCamelCase				,   run_time=1   )				,   Create(__UpperCamelCase				,   run_time=1   )				,   Create(__UpperCamelCase				,   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=2_4				,   )

							_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=1_8				,   )

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

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

							self.add(__UpperCamelCase   )

							_UpperCAmelCase					=    []
							_UpperCAmelCase					=    []
							_UpperCAmelCase					=    []
							for i, rect in enumerate(__UpperCamelCase   ):
											_UpperCAmelCase					=    Rectangle(height=0.4_6				,   width=0.4_6   ).set_stroke(width=0.0   ).set_fill(__UpperCamelCase				,   opacity=0.7   )
											cpu_target.move_to(__UpperCamelCase   )
											cpu_target.generate_target()
											_UpperCAmelCase					=    0.4_6 / 4
											_UpperCAmelCase					=    0.4_6 / 3

											if i == 0:
															cpu_target.target.next_to(cpu_left_col_base[0].get_corner(DOWN + LEFT   )				,   buff=0.0_2				,   direction=__UpperCamelCase   )
															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=__UpperCamelCase				,   buff=0.0   )
											else:
															cpu_target.target.next_to(cpu_targs[i - 1].target				,   direction=__UpperCamelCase				,   buff=0.0   )
											cpu_targs.append(__UpperCamelCase   )

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

							self.play(*__UpperCamelCase   )
							self.play(*__UpperCamelCase   )

							self.wait()








"""simple docstring"""


from typing import List, Optional, Union

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


__A   :							Any										=   logging.get_logger(__name__)

__A   :							Dict										=   {
    "huggingface/informer-tourism-monthly": (
        "https://huggingface.co/huggingface/informer-tourism-monthly/resolve/main/config.json"
    ),
    # See all Informer models at https://huggingface.co/models?filter=informer
}
class 			_a (					lowerCAmelCase):
			"""simple docstring"""
			UpperCamelCase__			      =	"""informer"""
			UpperCamelCase__			      =	{
			    """hidden_size""": """d_model""",
			    """num_attention_heads""": """encoder_attention_heads""",
			    """num_hidden_layers""": """encoder_layers""",
			}



			def __init__(		self     :    List[str]				,   __UpperCamelCase     :    Optional[int] = None				,   __UpperCamelCase     :    Optional[int] = None				,   __UpperCamelCase     :    str = "student_t"				,   __UpperCamelCase     :    str = "nll"				,   __UpperCamelCase     :    int = 1				,   __UpperCamelCase     :    List[int] = None				,   __UpperCamelCase     :    Optional[Union[str, bool]] = "mean"				,   __UpperCamelCase     :    int = 0				,   __UpperCamelCase     :    int = 0				,   __UpperCamelCase     :    int = 0				,   __UpperCamelCase     :    int = 0				,   __UpperCamelCase     :    Optional[List[int]] = None				,   __UpperCamelCase     :    Optional[List[int]] = None				,   __UpperCamelCase     :    int = 6_4				,   __UpperCamelCase     :    int = 3_2				,   __UpperCamelCase     :    int = 3_2				,   __UpperCamelCase     :    int = 2				,   __UpperCamelCase     :    int = 2				,   __UpperCamelCase     :    int = 2				,   __UpperCamelCase     :    int = 2				,   __UpperCamelCase     :    bool = True				,   __UpperCamelCase     :    str = "gelu"				,   __UpperCamelCase     :    float = 0.0_5				,   __UpperCamelCase     :    float = 0.1				,   __UpperCamelCase     :    float = 0.1				,   __UpperCamelCase     :    float = 0.1				,   __UpperCamelCase     :    float = 0.1				,   __UpperCamelCase     :    int = 1_0_0				,   __UpperCamelCase     :    float = 0.0_2				,   __UpperCamelCase     :    Optional[Any]=True				,   __UpperCamelCase     :    str = "prob"				,   __UpperCamelCase     :    int = 5				,   __UpperCamelCase     :    bool = True				,   **__UpperCamelCase     :    Union[str, Any]				,   )->Dict:
							# time series specific configuration
							_UpperCAmelCase					=    prediction_length
							_UpperCAmelCase					=    context_length or prediction_length
							_UpperCAmelCase					=    distribution_output
							_UpperCAmelCase					=    loss
							_UpperCAmelCase					=    input_size
							_UpperCAmelCase					=    num_time_features
							_UpperCAmelCase					=    lags_sequence if lags_sequence is not None else [1, 2, 3, 4, 5, 6, 7]
							_UpperCAmelCase					=    scaling
							_UpperCAmelCase					=    num_dynamic_real_features
							_UpperCAmelCase					=    num_static_real_features
							_UpperCAmelCase					=    num_static_categorical_features

							# set cardinality
							if cardinality and num_static_categorical_features > 0:
											if len(__UpperCamelCase   ) != num_static_categorical_features:
															raise ValueError(
															    '''The cardinality should be a list of the same length as `num_static_categorical_features`'''   )
											_UpperCAmelCase					=    cardinality
							else:
											_UpperCAmelCase					=    [0]

							# set embedding_dimension
							if embedding_dimension and num_static_categorical_features > 0:
											if len(__UpperCamelCase   ) != num_static_categorical_features:
															raise ValueError(
															    '''The embedding dimension should be a list of the same length as `num_static_categorical_features`'''   )
											_UpperCAmelCase					=    embedding_dimension
							else:
											_UpperCAmelCase					=    [min(5_0				,   (cat + 1) // 2   ) for cat in self.cardinality]

							_UpperCAmelCase					=    num_parallel_samples

							# Transformer architecture configuration
							_UpperCAmelCase					=    input_size * len(self.lags_sequence   ) + self._number_of_features
							_UpperCAmelCase					=    d_model
							_UpperCAmelCase					=    encoder_attention_heads
							_UpperCAmelCase					=    decoder_attention_heads
							_UpperCAmelCase					=    encoder_ffn_dim
							_UpperCAmelCase					=    decoder_ffn_dim
							_UpperCAmelCase					=    encoder_layers
							_UpperCAmelCase					=    decoder_layers

							_UpperCAmelCase					=    dropout
							_UpperCAmelCase					=    attention_dropout
							_UpperCAmelCase					=    activation_dropout
							_UpperCAmelCase					=    encoder_layerdrop
							_UpperCAmelCase					=    decoder_layerdrop

							_UpperCAmelCase					=    activation_function
							_UpperCAmelCase					=    init_std

							_UpperCAmelCase					=    use_cache

							# Informer
							_UpperCAmelCase					=    attention_type
							_UpperCAmelCase					=    sampling_factor
							_UpperCAmelCase					=    distil

							super().__init__(is_encoder_decoder=__UpperCamelCase				,   **__UpperCamelCase   )



			@property
			def  lowercase__						(		self     :    Optional[int]   )->int:
							return (
							    sum(self.embedding_dimension   )
							    + self.num_dynamic_real_features
							    + self.num_time_features
							    + self.num_static_real_features
							    + self.input_size * 2  # the log1p(abs(loc)) and log(scale) features
							)



