

"""simple docstring"""


from typing import List, Optional

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


UpperCAmelCase													=logging.get_logger(__name__)

UpperCAmelCase													={
    "huggingface/autoformer-tourism-monthly": "https://huggingface.co/huggingface/autoformer-tourism-monthly/resolve/main/config.json",
}





class lowerCamelCase__   (				SCREAMING_SNAKE_CASE    ):



    '''simple docstring'''




    _lowerCamelCase					=   '''autoformer'''
    _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_ = [1, 2, 3, 4, 5, 6, 7] ,lowerCamelCase_ = True ,lowerCamelCase_ = 0 ,lowerCamelCase_ = 0 ,lowerCamelCase_ = 0 ,lowerCamelCase_ = 0 ,lowerCamelCase_ = None ,lowerCamelCase_ = None ,lowerCamelCase_ = 6_4 ,lowerCamelCase_ = 2 ,lowerCamelCase_ = 2 ,lowerCamelCase_ = 2 ,lowerCamelCase_ = 2 ,lowerCamelCase_ = 3_2 ,lowerCamelCase_ = 3_2 ,lowerCamelCase_ = "gelu" ,lowerCamelCase_ = 0.1 ,lowerCamelCase_ = 0.1 ,lowerCamelCase_ = 0.1 ,lowerCamelCase_ = 0.1 ,lowerCamelCase_ = 0.1 ,lowerCamelCase_ = 1_0_0 ,lowerCamelCase_ = 0.02 ,lowerCamelCase_ = True ,lowerCamelCase_=True ,lowerCamelCase_ = 1_0 ,lowerCamelCase_ = 2_5 ,lowerCamelCase_ = 3 ,**lowerCamelCase_ ,)    ->      Dict:
          # time series specific configuration
          A				  =		prediction_length
          A				  =		context_length if context_length is not None else prediction_length
          A				  =		distribution_output
          A				  =		loss
          A				  =		input_size
          A				  =		num_time_features
          A				  =		lags_sequence
          A				  =		scaling
          A				  =		num_dynamic_real_features
          A				  =		num_static_real_features
          A				  =		num_static_categorical_features
          if cardinality is not None 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`"""    )
                A				  =		cardinality
          else:
                A				  =		[0]
          if embedding_dimension is not None 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`"""    )
                A				  =		embedding_dimension
          else:
                A				  =		[min(5_0 ,(cat + 1) // 2    ) for cat in self.cardinality]
          A				  =		num_parallel_samples

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

          A				  =		dropout
          A				  =		attention_dropout
          A				  =		activation_dropout
          A				  =		encoder_layerdrop
          A				  =		decoder_layerdrop

          A				  =		activation_function
          A				  =		init_std

          A				  =		use_cache

          # Autoformer
          A				  =		label_length
          A				  =		moving_average
          A				  =		autocorrelation_factor

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




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







"""simple docstring"""


from typing import TYPE_CHECKING

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


UpperCAmelCase													={
    "configuration_informer": [
        "INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "InformerConfig",
    ],
}

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  UpperCAmelCase													=[
      "INFORMER_PRETRAINED_MODEL_ARCHIVE_LIST",
      "InformerForPrediction",
      "InformerModel",
      "InformerPreTrainedModel",
  ]


if TYPE_CHECKING:
  from .configuration_informer import INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, InformerConfig

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_informer import (
        INFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
        InformerForPrediction,
        InformerModel,
        InformerPreTrainedModel,
    )

else:
  import sys

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




