




from typing import List, Optional, Union

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


__A        =    logging.get_logger(__name__)

__A        =    {
    "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     __lowerCAmelCase (       __magic_name__ ):

			"""simple docstring"""







			snake_case_   		=       '''informer'''
			snake_case_   		=       {
			    '''hidden_size''': '''d_model''',
			    '''num_attention_heads''': '''encoder_attention_heads''',
			    '''num_hidden_layers''': '''encoder_layers''',
			}


			def __init__(      self			,						lowerCamelCase__ = None			,						lowerCamelCase__ = None			,						lowerCamelCase__ = "student_t"			,						lowerCamelCase__ = "nll"			,						lowerCamelCase__ = 1			,						lowerCamelCase__ = None			,						lowerCamelCase__ = "mean"			,						lowerCamelCase__ = 0			,						lowerCamelCase__ = 0			,						lowerCamelCase__ = 0			,						lowerCamelCase__ = 0			,						lowerCamelCase__ = None			,						lowerCamelCase__ = None			,						lowerCamelCase__ = 64			,						lowerCamelCase__ = 32			,						lowerCamelCase__ = 32			,						lowerCamelCase__ = 2			,						lowerCamelCase__ = 2			,						lowerCamelCase__ = 2			,						lowerCamelCase__ = 2			,						lowerCamelCase__ = True			,						lowerCamelCase__ = "gelu"			,						lowerCamelCase__ = 0.05			,						lowerCamelCase__ = 0.1			,						lowerCamelCase__ = 0.1			,						lowerCamelCase__ = 0.1			,						lowerCamelCase__ = 0.1			,						lowerCamelCase__ = 100			,						lowerCamelCase__ = 0.02			,						lowerCamelCase__=True			,						lowerCamelCase__ = "prob"			,						lowerCamelCase__ = 5			,						lowerCamelCase__ = True			,						**lowerCamelCase__			,						)    ->      Any:



							'''simple docstring'''
							# time series specific configuration
							__lowerCamelCase		       =    prediction_length
							__lowerCamelCase		       =    context_length or prediction_length
							__lowerCamelCase		       =    distribution_output
							__lowerCamelCase		       =    loss
							__lowerCamelCase		       =    input_size
							__lowerCamelCase		       =    num_time_features
							__lowerCamelCase		       =    lags_sequence if lags_sequence is not None else [1, 2, 3, 4, 5, 6, 7]
							__lowerCamelCase		       =    scaling
							__lowerCamelCase		       =    num_dynamic_real_features
							__lowerCamelCase		       =    num_static_real_features
							__lowerCamelCase		       =    num_static_categorical_features

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

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

							__lowerCamelCase		       =    num_parallel_samples

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

							__lowerCamelCase		       =    dropout
							__lowerCamelCase		       =    attention_dropout
							__lowerCamelCase		       =    activation_dropout
							__lowerCamelCase		       =    encoder_layerdrop
							__lowerCamelCase		       =    decoder_layerdrop

							__lowerCamelCase		       =    activation_function
							__lowerCamelCase		       =    init_std

							__lowerCamelCase		       =    use_cache

							# Informer
							__lowerCamelCase		       =    attention_type
							__lowerCamelCase		       =    sampling_factor
							__lowerCamelCase		       =    distil

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






			@property
			def       lowercase_    (      self							)    ->      int:



							'''simple docstring'''
							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
							)








def 			lowerCamelCase_		(       UpperCamelCase__				:      int      )     ->       bool:





				"""simple docstring"""


				return number & 1 == 0


if __name__ == "__main__":
					import doctest

					doctest.testmod()


