




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  _lowerCamelCase						(			_SCREAMING_SNAKE_CASE   ):

      """simple docstring"""

      lowerCAmelCase__			: List[str]    =					"informer"
      lowerCAmelCase__			: Dict    =					{
          "hidden_size": "d_model",
          "num_attention_heads": "encoder_attention_heads",
          "num_hidden_layers": "encoder_layers",
      }







      def __init__(     self					: str ,       snake_case					: Union[str, Any] = None ,       snake_case					: Tuple = None ,       snake_case					: Tuple = "student_t" ,       snake_case					: Any = "nll" ,       snake_case					: Any = 1 ,       snake_case					: List[Any] = None ,       snake_case					: Union[str, Any] = "mean" ,       snake_case					: Any = 0 ,       snake_case					: Dict = 0 ,       snake_case					: Any = 0 ,       snake_case					: str = 0 ,       snake_case					: Tuple = None ,       snake_case					: Tuple = None ,       snake_case					: int = 64 ,       snake_case					: Union[str, Any] = 32 ,       snake_case					: Optional[int] = 32 ,       snake_case					: int = 2 ,       snake_case					: Any = 2 ,       snake_case					: Tuple = 2 ,       snake_case					: Optional[int] = 2 ,       snake_case					: Optional[int] = True ,       snake_case					: List[str] = "gelu" ,       snake_case					: int = 0.05 ,       snake_case					: List[str] = 0.1 ,       snake_case					: Optional[Any] = 0.1 ,       snake_case					: List[Any] = 0.1 ,       snake_case					: Any = 0.1 ,       snake_case					: str = 100 ,       snake_case					: int = 0.02 ,       snake_case					: Optional[int]=True ,       snake_case					: Optional[int] = "prob" ,       snake_case					: List[str] = 5 ,       snake_case					: int = True ,       **snake_case					: int ,       ):
          # time series specific configuration
          __UpperCamelCase  		=						prediction_length
          __UpperCamelCase  		=						context_length or prediction_length
          __UpperCamelCase  		=						distribution_output
          __UpperCamelCase  		=						loss
          __UpperCamelCase  		=						input_size
          __UpperCamelCase  		=						num_time_features
          __UpperCamelCase  		=						lags_sequence if lags_sequence is not None else [1, 2, 3, 4, 5, 6, 7]
          __UpperCamelCase  		=						scaling
          __UpperCamelCase  		=						num_dynamic_real_features
          __UpperCamelCase  		=						num_static_real_features
          __UpperCamelCase  		=						num_static_categorical_features

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

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

          __UpperCamelCase  		=						num_parallel_samples

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

          __UpperCamelCase  		=						dropout
          __UpperCamelCase  		=						attention_dropout
          __UpperCamelCase  		=						activation_dropout
          __UpperCamelCase  		=						encoder_layerdrop
          __UpperCamelCase  		=						decoder_layerdrop

          __UpperCamelCase  		=						activation_function
          __UpperCamelCase  		=						init_std

          __UpperCamelCase  		=						use_cache

          # Informer
          __UpperCamelCase  		=						attention_type
          __UpperCamelCase  		=						sampling_factor
          __UpperCamelCase  		=						distil

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







      @property
      def       snake_case	(     self					: Optional[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
          )












from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


a_   		=     {
    "configuration_longformer": [
        "LONGFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "LongformerConfig",
        "LongformerOnnxConfig",
    ],
    "tokenization_longformer": ["LongformerTokenizer"],
}

try:
 if not is_tokenizers_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 a_   		=     ["LongformerTokenizerFast"]

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 a_   		=     [
     "LONGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST",
     "LongformerForMaskedLM",
     "LongformerForMultipleChoice",
     "LongformerForQuestionAnswering",
     "LongformerForSequenceClassification",
     "LongformerForTokenClassification",
     "LongformerModel",
     "LongformerPreTrainedModel",
     "LongformerSelfAttention",
 ]

try:
 if not is_tf_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 a_   		=     [
     "TF_LONGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST",
     "TFLongformerForMaskedLM",
     "TFLongformerForMultipleChoice",
     "TFLongformerForQuestionAnswering",
     "TFLongformerForSequenceClassification",
     "TFLongformerForTokenClassification",
     "TFLongformerModel",
     "TFLongformerPreTrainedModel",
     "TFLongformerSelfAttention",
 ]


if TYPE_CHECKING:
 from .configuration_longformer import (
     LONGFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP,
     LongformerConfig,
     LongformerOnnxConfig,
 )
 from .tokenization_longformer import LongformerTokenizer

 try:
  if not is_tokenizers_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .tokenization_longformer_fast import LongformerTokenizerFast

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_longformer import (
      LONGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
      LongformerForMaskedLM,
      LongformerForMultipleChoice,
      LongformerForQuestionAnswering,
      LongformerForSequenceClassification,
      LongformerForTokenClassification,
      LongformerModel,
      LongformerPreTrainedModel,
      LongformerSelfAttention,
  )

 try:
  if not is_tf_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_tf_longformer import (
      TF_LONGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
      TFLongformerForMaskedLM,
      TFLongformerForMultipleChoice,
      TFLongformerForQuestionAnswering,
      TFLongformerForSequenceClassification,
      TFLongformerForTokenClassification,
      TFLongformerModel,
      TFLongformerPreTrainedModel,
      TFLongformerSelfAttention,
  )

else:
 import sys

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






