





from typing import List, Optional, Union

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


_snake_case           =			logging.get_logger(__name__)

_snake_case           =			{
    """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							(       lowercase_ ):
  __lowerCamelCase		=      'informer'
  __lowerCamelCase		=      {
      'hidden_size': 'd_model',
      'num_attention_heads': 'encoder_attention_heads',
      'num_hidden_layers': 'encoder_layers',
  }







  def __init__(      self  :Union[str, Any]   ,							_lowercase  :Optional[int] = None   ,							_lowercase  :Optional[int] = None   ,							_lowercase  :str = "student_t"   ,							_lowercase  :str = "nll"   ,							_lowercase  :int = 1   ,							_lowercase  :List[int] = None   ,							_lowercase  :Optional[Union[str, bool]] = "mean"   ,							_lowercase  :int = 0   ,							_lowercase  :int = 0   ,							_lowercase  :int = 0   ,							_lowercase  :int = 0   ,							_lowercase  :Optional[List[int]] = None   ,							_lowercase  :Optional[List[int]] = None   ,							_lowercase  :int = 64   ,							_lowercase  :int = 32   ,							_lowercase  :int = 32   ,							_lowercase  :int = 2   ,							_lowercase  :int = 2   ,							_lowercase  :int = 2   ,							_lowercase  :int = 2   ,							_lowercase  :bool = True   ,							_lowercase  :str = "gelu"   ,							_lowercase  :float = 0.05   ,							_lowercase  :float = 0.1   ,							_lowercase  :float = 0.1   ,							_lowercase  :float = 0.1   ,							_lowercase  :float = 0.1   ,							_lowercase  :int = 1_00   ,							_lowercase  :float = 0.02   ,							_lowercase  :Union[str, Any]=True   ,							_lowercase  :str = "prob"   ,							_lowercase  :int = 5   ,							_lowercase  :bool = True   ,							**_lowercase  :List[str]   ,							):






     '''simple docstring'''





     lowercase__			       =  prediction_length
     lowercase__			       =  context_length or prediction_length
     lowercase__			       =  distribution_output
     lowercase__			       =  loss
     lowercase__			       =  input_size
     lowercase__			       =  num_time_features
     lowercase__			       =  lags_sequence if lags_sequence is not None else [1, 2, 3, 4, 5, 6, 7]
     lowercase__			       =  scaling
     lowercase__			       =  num_dynamic_real_features
     lowercase__			       =  num_static_real_features
     lowercase__			       =  num_static_categorical_features

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

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

     lowercase__			       =  num_parallel_samples

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

     lowercase__			       =  dropout
     lowercase__			       =  attention_dropout
     lowercase__			       =  activation_dropout
     lowercase__			       =  encoder_layerdrop
     lowercase__			       =  decoder_layerdrop

     lowercase__			       =  activation_function
     lowercase__			       =  init_std

     lowercase__			       =  use_cache

     # Informer
     lowercase__			       =  attention_type
     lowercase__			       =  sampling_factor
     lowercase__			       =  distil

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







  @property
  def   UpperCAmelCase					(      self  :str ):






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













from typing import TYPE_CHECKING

# rely on isort to merge the imports
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


_snake_case           =			{
    """configuration_autoformer""": [
        """AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""",
        """AutoformerConfig""",
    ],
}

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  _snake_case           =			[
      """AUTOFORMER_PRETRAINED_MODEL_ARCHIVE_LIST""",
      """AutoformerForPrediction""",
      """AutoformerModel""",
      """AutoformerPreTrainedModel""",
  ]


if TYPE_CHECKING:
  from .configuration_autoformer import (
      AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP,
      AutoformerConfig,
  )

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_autoformer import (
        AUTOFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
        AutoformerForPrediction,
        AutoformerModel,
        AutoformerPreTrainedModel,
    )

else:
  import sys

  _snake_case           =			_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)






