





'''simple docstring'''

from typing import List, Optional

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


a   	=    logging.get_logger(__name__)

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







class __a			( _snake_case      ):
   __UpperCamelCase :			Optional[int]						   =						'autoformer'
   __UpperCamelCase :			int						   =						{
       'hidden_size': 'd_model',
       'num_attention_heads': 'encoder_attention_heads',
       'num_hidden_layers': 'encoder_layers',
   }





   def __init__(       self					:      Optional[int]					,lowerCamelCase					:      Optional[int] = None					,lowerCamelCase					:      Optional[int] = None					,lowerCamelCase					:      str = "student_t"					,lowerCamelCase					:      str = "nll"					,lowerCamelCase					:      int = 1					,lowerCamelCase					:      List[int] = [1, 2, 3, 4, 5, 6, 7]					,lowerCamelCase					:      bool = True					,lowerCamelCase					:      int = 0					,lowerCamelCase					:      int = 0					,lowerCamelCase					:      int = 0					,lowerCamelCase					:      int = 0					,lowerCamelCase					:      Optional[List[int]] = None					,lowerCamelCase					:      Optional[List[int]] = None					,lowerCamelCase					:      int = 64					,lowerCamelCase					:      int = 2					,lowerCamelCase					:      int = 2					,lowerCamelCase					:      int = 2					,lowerCamelCase					:      int = 2					,lowerCamelCase					:      int = 32					,lowerCamelCase					:      int = 32					,lowerCamelCase					:      str = "gelu"					,lowerCamelCase					:      float = 0.1					,lowerCamelCase					:      float = 0.1					,lowerCamelCase					:      float = 0.1					,lowerCamelCase					:      float = 0.1					,lowerCamelCase					:      float = 0.1					,lowerCamelCase					:      int = 100					,lowerCamelCase					:      float = 0.02					,lowerCamelCase					:      bool = True					,lowerCamelCase					:      str=True					,lowerCamelCase					:      int = 10					,lowerCamelCase					:      int = 25					,lowerCamelCase					:      int = 3					,**lowerCamelCase					:      Dict					,):

      '''simple docstring'''

      __SCREAMING_SNAKE_CASE   				=							prediction_length
      __SCREAMING_SNAKE_CASE   				=							context_length if context_length is not None else prediction_length
      __SCREAMING_SNAKE_CASE   				=							distribution_output
      __SCREAMING_SNAKE_CASE   				=							loss
      __SCREAMING_SNAKE_CASE   				=							input_size
      __SCREAMING_SNAKE_CASE   				=							num_time_features
      __SCREAMING_SNAKE_CASE   				=							lags_sequence
      __SCREAMING_SNAKE_CASE   				=							scaling
      __SCREAMING_SNAKE_CASE   				=							num_dynamic_real_features
      __SCREAMING_SNAKE_CASE   				=							num_static_real_features
      __SCREAMING_SNAKE_CASE   				=							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`"""     )
         __SCREAMING_SNAKE_CASE   				=							cardinality
      else:
         __SCREAMING_SNAKE_CASE   				=							[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`"""     )
         __SCREAMING_SNAKE_CASE   				=							embedding_dimension
      else:
         __SCREAMING_SNAKE_CASE   				=							[min(50					,(cat + 1) // 2     ) for cat in self.cardinality]
      __SCREAMING_SNAKE_CASE   				=							num_parallel_samples

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

      __SCREAMING_SNAKE_CASE   				=							dropout
      __SCREAMING_SNAKE_CASE   				=							attention_dropout
      __SCREAMING_SNAKE_CASE   				=							activation_dropout
      __SCREAMING_SNAKE_CASE   				=							encoder_layerdrop
      __SCREAMING_SNAKE_CASE   				=							decoder_layerdrop

      __SCREAMING_SNAKE_CASE   				=							activation_function
      __SCREAMING_SNAKE_CASE   				=							init_std

      __SCREAMING_SNAKE_CASE   				=							use_cache

      # Autoformer
      __SCREAMING_SNAKE_CASE   				=							label_length
      __SCREAMING_SNAKE_CASE   				=							moving_average
      __SCREAMING_SNAKE_CASE   				=							autocorrelation_factor

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





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










'''simple docstring'''





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


_UpperCamelCase											=		logging.get_logger(__name__)

_UpperCamelCase											=		{
    'google/pegasus-large': 'https://huggingface.co/google/pegasus-large/resolve/main/config.json',
    # See all PEGASUS models at https://huggingface.co/models?filter=pegasus
}






class    lowerCamelCase_       (							SCREAMING_SNAKE_CASE_	):
  """simple docstring"""




  a_				   ="""pegasus"""
  a_				   =["""past_key_values"""]
  a_				   ={"""num_attention_heads""": """encoder_attention_heads""", """hidden_size""": """d_model"""}




  def __init__(					self :      Any     ,      _a :      int=5_0265     ,      _a :      Tuple=1024     ,      _a :      Optional[Any]=12     ,      _a :      int=4096     ,      _a :      str=16     ,      _a :      Union[str, Any]=12     ,      _a :      Optional[Any]=4096     ,      _a :      Optional[int]=16     ,      _a :      Union[str, Any]=0.0     ,      _a :      str=0.0     ,      _a :      List[Any]=True     ,      _a :      Optional[int]=True     ,      _a :      Tuple="gelu"     ,      _a :      Dict=1024     ,      _a :      int=0.1     ,      _a :      Any=0.0     ,      _a :      Union[str, Any]=0.0     ,      _a :      Any=0.02     ,      _a :      Optional[Any]=0     ,      _a :      str=False     ,      _a :      Tuple=0     ,      _a :      Optional[int]=1     ,      _a :      Union[str, Any]=1     ,      **_a :      Optional[int]     ,      )   ->   Any:
    __lowerCamelCase			:			Union[str, Any]       			=					vocab_size
    __lowerCamelCase			:			int       			=					max_position_embeddings
    __lowerCamelCase			:			Union[str, Any]       			=					d_model
    __lowerCamelCase			:			Union[str, Any]       			=					encoder_ffn_dim
    __lowerCamelCase			:			Union[str, Any]       			=					encoder_layers
    __lowerCamelCase			:			List[Any]       			=					encoder_attention_heads
    __lowerCamelCase			:			Optional[int]       			=					decoder_ffn_dim
    __lowerCamelCase			:			int       			=					decoder_layers
    __lowerCamelCase			:			Tuple       			=					decoder_attention_heads
    __lowerCamelCase			:			Optional[Any]       			=					dropout
    __lowerCamelCase			:			Tuple       			=					attention_dropout
    __lowerCamelCase			:			int       			=					activation_dropout
    __lowerCamelCase			:			Dict       			=					activation_function
    __lowerCamelCase			:			List[Any]       			=					init_std
    __lowerCamelCase			:			List[str]       			=					encoder_layerdrop
    __lowerCamelCase			:			Union[str, Any]       			=					decoder_layerdrop
    __lowerCamelCase			:			Union[str, Any]       			=					use_cache
    __lowerCamelCase			:			Tuple       			=					encoder_layers
    __lowerCamelCase			:			int       			=					scale_embedding  # scale factor will be sqrt(d_model) if True
    super().__init__(
        pad_token_id=_a     ,      eos_token_id=_a     ,      is_encoder_decoder=_a     ,      decoder_start_token_id=_a     ,      forced_eos_token_id=_a     ,      **_a     ,      )




  @property
  def 		_lowercase	(					self :      Optional[int]  )   ->   int:
    return self.encoder_attention_heads




  @property
  def 		_lowercase	(					self :      Any  )   ->   int:
    return self.d_model






