'''simple docstring'''

from typing import List, Optional, Union

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


__a: Optional[Any]          =   logging.get_logger(__name__)

__a: List[str]          =   {
    """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  (						a__					):





       '''simple docstring'''



       SCREAMING_SNAKE_CASE							=    "informer"
       SCREAMING_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.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	,   )  ->  Dict:
        # time series specific configuration
        lowercase__				:    List[Any]  =					prediction_length
        lowercase__				:    int  =					context_length or prediction_length
        lowercase__				:    Union[str, Any]  =					distribution_output
        lowercase__				:    List[str]  =					loss
        lowercase__				:    Optional[int]  =					input_size
        lowercase__				:    Optional[Any]  =					num_time_features
        lowercase__				:    Optional[int]  =					lags_sequence if lags_sequence is not None else [1, 2, 3, 4, 5, 6, 7]
        lowercase__				:    List[str]  =					scaling
        lowercase__				:    Any  =					num_dynamic_real_features
        lowercase__				:    int  =					num_static_real_features
        lowercase__				:    Optional[int]  =					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`''' )
         lowercase__				:    List[Any]  =					cardinality
        else:
         lowercase__				:    Optional[int]  =					[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`''' )
         lowercase__				:    List[str]  =					embedding_dimension
        else:
         lowercase__				:    Optional[int]  =					[min(50	,   (cat + 1) // 2 ) for cat in self.cardinality]

        lowercase__				:    Any  =					num_parallel_samples

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

        lowercase__				:    Tuple  =					dropout
        lowercase__				:    Optional[Any]  =					attention_dropout
        lowercase__				:    Dict  =					activation_dropout
        lowercase__				:    List[str]  =					encoder_layerdrop
        lowercase__				:    Union[str, Any]  =					decoder_layerdrop

        lowercase__				:    int  =					activation_function
        lowercase__				:    Union[str, Any]  =					init_std

        lowercase__				:    List[Any]  =					use_cache

        # Informer
        lowercase__				:    Any  =					attention_type
        lowercase__				:    List[str]  =					sampling_factor
        lowercase__				:    List[str]  =					distil

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


       @property
       def _lowerCAmelCase(						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

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available


__a: Dict          =   {
    """configuration_ctrl""": ["""CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP""", """CTRLConfig"""],
    """tokenization_ctrl""": ["""CTRLTokenizer"""],
}

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  __a: int          =   [
      """CTRL_PRETRAINED_MODEL_ARCHIVE_LIST""",
      """CTRLForSequenceClassification""",
      """CTRLLMHeadModel""",
      """CTRLModel""",
      """CTRLPreTrainedModel""",
  ]

try:
  if not is_tf_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  __a: int          =   [
      """TF_CTRL_PRETRAINED_MODEL_ARCHIVE_LIST""",
      """TFCTRLForSequenceClassification""",
      """TFCTRLLMHeadModel""",
      """TFCTRLModel""",
      """TFCTRLPreTrainedModel""",
  ]


if TYPE_CHECKING:
  from .configuration_ctrl import CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP, CTRLConfig
  from .tokenization_ctrl import CTRLTokenizer

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_ctrl import (
        CTRL_PRETRAINED_MODEL_ARCHIVE_LIST,
        CTRLForSequenceClassification,
        CTRLLMHeadModel,
        CTRLModel,
        CTRLPreTrainedModel,
    )

  try:
    if not is_tf_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_tf_ctrl import (
        TF_CTRL_PRETRAINED_MODEL_ARCHIVE_LIST,
        TFCTRLForSequenceClassification,
        TFCTRLLMHeadModel,
        TFCTRLModel,
        TFCTRLPreTrainedModel,
    )

else:
  import sys

  __a: Dict          =   _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)

