

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 			A_						(			__snake_case							):
							_UpperCAmelCase       :    str		 = 'informer'
							_UpperCAmelCase       :    Tuple		 = {
							    'hidden_size': 'd_model',
							    'num_attention_heads': 'encoder_attention_heads',
							    'num_hidden_layers': 'encoder_layers',
							}
							def __init__(						self						:     Tuple  ,SCREAMING_SNAKE_CASE__						:     Dict = None  ,SCREAMING_SNAKE_CASE__						:     Optional[int] = None  ,SCREAMING_SNAKE_CASE__						:     Optional[Any] = "student_t"  ,SCREAMING_SNAKE_CASE__						:     int = "nll"  ,SCREAMING_SNAKE_CASE__						:     Dict = 1  ,SCREAMING_SNAKE_CASE__						:     Union[str, Any] = None  ,SCREAMING_SNAKE_CASE__						:     Optional[Any] = "mean"  ,SCREAMING_SNAKE_CASE__						:     Any = 0  ,SCREAMING_SNAKE_CASE__						:     Union[str, Any] = 0  ,SCREAMING_SNAKE_CASE__						:     Optional[Any] = 0  ,SCREAMING_SNAKE_CASE__						:     Optional[Any] = 0  ,SCREAMING_SNAKE_CASE__						:     int = None  ,SCREAMING_SNAKE_CASE__						:     int = None  ,SCREAMING_SNAKE_CASE__						:     Tuple = 6_4  ,SCREAMING_SNAKE_CASE__						:     List[str] = 3_2  ,SCREAMING_SNAKE_CASE__						:     Optional[int] = 3_2  ,SCREAMING_SNAKE_CASE__						:     List[str] = 2  ,SCREAMING_SNAKE_CASE__						:     Optional[int] = 2  ,SCREAMING_SNAKE_CASE__						:     Tuple = 2  ,SCREAMING_SNAKE_CASE__						:     Tuple = 2  ,SCREAMING_SNAKE_CASE__						:     Optional[int] = True  ,SCREAMING_SNAKE_CASE__						:     List[Any] = "gelu"  ,SCREAMING_SNAKE_CASE__						:     Any = 0.05  ,SCREAMING_SNAKE_CASE__						:     Union[str, Any] = 0.1  ,SCREAMING_SNAKE_CASE__						:     int = 0.1  ,SCREAMING_SNAKE_CASE__						:     Optional[Any] = 0.1  ,SCREAMING_SNAKE_CASE__						:     str = 0.1  ,SCREAMING_SNAKE_CASE__						:     List[Any] = 1_0_0  ,SCREAMING_SNAKE_CASE__						:     List[Any] = 0.02  ,SCREAMING_SNAKE_CASE__						:     str=True  ,SCREAMING_SNAKE_CASE__						:     Optional[Any] = "prob"  ,SCREAMING_SNAKE_CASE__						:     Union[str, Any] = 5  ,SCREAMING_SNAKE_CASE__						:     str = True  ,**SCREAMING_SNAKE_CASE__						:     List[Any]  ,):
								__lowerCamelCase							:							Optional[int]   			=					prediction_length
								__lowerCamelCase							:							int   			=					context_length or prediction_length
								__lowerCamelCase							:							Optional[int]   			=					distribution_output
								__lowerCamelCase							:							Any   			=					loss
								__lowerCamelCase							:							str   			=					input_size
								__lowerCamelCase							:							Optional[Any]   			=					num_time_features
								__lowerCamelCase							:							Tuple   			=					lags_sequence if lags_sequence is not None else [1, 2, 3, 4, 5, 6, 7]
								__lowerCamelCase							:							str   			=					scaling
								__lowerCamelCase							:							List[str]   			=					num_dynamic_real_features
								__lowerCamelCase							:							Tuple   			=					num_static_real_features
								__lowerCamelCase							:							int   			=					num_static_categorical_features

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

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

								__lowerCamelCase							:							Dict   			=					num_parallel_samples

								# Transformer architecture configuration
								__lowerCamelCase							:							Tuple   			=					input_size * len(self.lags_sequence) + self._number_of_features
								__lowerCamelCase							:							Union[str, Any]   			=					d_model
								__lowerCamelCase							:							Any   			=					encoder_attention_heads
								__lowerCamelCase							:							List[str]   			=					decoder_attention_heads
								__lowerCamelCase							:							int   			=					encoder_ffn_dim
								__lowerCamelCase							:							str   			=					decoder_ffn_dim
								__lowerCamelCase							:							List[str]   			=					encoder_layers
								__lowerCamelCase							:							Union[str, Any]   			=					decoder_layers

								__lowerCamelCase							:							List[Any]   			=					dropout
								__lowerCamelCase							:							Any   			=					attention_dropout
								__lowerCamelCase							:							Any   			=					activation_dropout
								__lowerCamelCase							:							str   			=					encoder_layerdrop
								__lowerCamelCase							:							str   			=					decoder_layerdrop

								__lowerCamelCase							:							List[str]   			=					activation_function
								__lowerCamelCase							:							Optional[int]   			=					init_std

								__lowerCamelCase							:							Dict   			=					use_cache

								# Informer
								__lowerCamelCase							:							Optional[int]   			=					attention_type
								__lowerCamelCase							:							int   			=					sampling_factor
								__lowerCamelCase							:							Optional[int]   			=					distil

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


							@property
							def        lowerCAmelCase	(						self						:     List[Any]):
								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
								)











__lowerCamelCase			:	str					    =	6_5521



def 						A_							(	_lowerCAmelCase	)		->					int:
 UpperCamelCase      :   Any			      =  1
 UpperCamelCase      :   str			      =  0
 for plain_chr in plain_text:
  UpperCamelCase      :   List[Any]			      =  (a + ord(_lowerCAmelCase	)) % MOD_ADLER
  UpperCamelCase      :   List[Any]			      =  (b + a) % MOD_ADLER
 return (b << 16) | a
