






from typing import List, Optional, Union

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


SCREAMING_SNAKE_CASE__		:							str 				=				logging.get_logger(__name__)

SCREAMING_SNAKE_CASE__		:							Any 				=				{
    """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 				UpperCAmelCase_  (		__lowerCamelCase		):
     __lowerCamelCase      				=  'informer'
     __lowerCamelCase      				=  {
         '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.0_5	,						_lowerCAmelCase = 0.1	,						_lowerCAmelCase = 0.1	,						_lowerCAmelCase = 0.1	,						_lowerCAmelCase = 0.1	,						_lowerCAmelCase = 100	,						_lowerCAmelCase = 0.0_2	,						_lowerCAmelCase=True	,						_lowerCAmelCase = "prob"	,						_lowerCAmelCase = 5	,						_lowerCAmelCase = True	,						**_lowerCAmelCase	,						):
          # time series specific configuration
          UpperCAmelCase__      :  List[str]				      =			prediction_length
          UpperCAmelCase__      :  Optional[Any]				      =			context_length or prediction_length
          UpperCAmelCase__      :  str				      =			distribution_output
          UpperCAmelCase__      :  int				      =			loss
          UpperCAmelCase__      :  Optional[Any]				      =			input_size
          UpperCAmelCase__      :  Any				      =			num_time_features
          UpperCAmelCase__      :  int				      =			lags_sequence if lags_sequence is not None else [1, 2, 3, 4, 5, 6, 7]
          UpperCAmelCase__      :  Union[str, Any]				      =			scaling
          UpperCAmelCase__      :  Optional[Any]				      =			num_dynamic_real_features
          UpperCAmelCase__      :  List[str]				      =			num_static_real_features
          UpperCAmelCase__      :  str				      =			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`"""		)
               UpperCAmelCase__      :  List[str]				      =			cardinality
          else:
               UpperCAmelCase__      :  Optional[Any]				      =			[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`"""		)
               UpperCAmelCase__      :  str				      =			embedding_dimension
          else:
               UpperCAmelCase__      :  List[str]				      =			[min(50	,						(cat + 1) // 2		) for cat in self.cardinality]

          UpperCAmelCase__      :  Union[str, Any]				      =			num_parallel_samples

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

          UpperCAmelCase__      :  Tuple				      =			dropout
          UpperCAmelCase__      :  int				      =			attention_dropout
          UpperCAmelCase__      :  List[str]				      =			activation_dropout
          UpperCAmelCase__      :  Any				      =			encoder_layerdrop
          UpperCAmelCase__      :  Union[str, Any]				      =			decoder_layerdrop

          UpperCAmelCase__      :  Tuple				      =			activation_function
          UpperCAmelCase__      :  Dict				      =			init_std

          UpperCAmelCase__      :  str				      =			use_cache

          # Informer
          UpperCAmelCase__      :  Union[str, Any]				      =			attention_type
          UpperCAmelCase__      :  int				      =			sampling_factor
          UpperCAmelCase__      :  Any				      =			distil

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




     @property
     def   __UpperCAmelCase  (				self		):
          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
          )














import warnings


warnings.warn(
    'memory_utils has been reorganized to utils.memory. Import `find_executable_batchsize` from the main `__init__`: '
    '`from accelerate import find_executable_batch_size` to avoid this warning.',
    FutureWarning,
)



