






from typing import List, Optional, Union

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


A_						:						List[Any]						      =					logging.get_logger(__name__)

A_						:						Any						      =					{
    'huggingface/time-series-transformer-tourism-monthly': (
        'https://huggingface.co/huggingface/time-series-transformer-tourism-monthly/resolve/main/config.json'
    ),
    # See all TimeSeriesTransformer models at https://huggingface.co/models?filter=time_series_transformer
}




class 							_lowerCAmelCase(			UpperCAmelCase_   ):





       """simple docstring"""







       a							:						Dict										='''time_series_transformer'''
       a							:						Any										={
           '''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 = "mean"    ,     _lowerCamelCase = 0    ,     _lowerCamelCase = 0    ,     _lowerCamelCase = 0    ,     _lowerCamelCase = 0    ,     _lowerCamelCase = None    ,     _lowerCamelCase = None    ,     _lowerCamelCase = 3_2    ,     _lowerCamelCase = 3_2    ,     _lowerCamelCase = 2    ,     _lowerCamelCase = 2    ,     _lowerCamelCase = 2    ,     _lowerCamelCase = 2    ,     _lowerCamelCase = True    ,     _lowerCamelCase = "gelu"    ,     _lowerCamelCase = 6_4    ,     _lowerCamelCase = 0.1    ,     _lowerCamelCase = 0.1    ,     _lowerCamelCase = 0.1    ,     _lowerCamelCase = 0.1    ,     _lowerCamelCase = 0.1    ,     _lowerCamelCase = 1_0_0    ,     _lowerCamelCase = 0.0_2    ,     _lowerCamelCase=True    ,     **_lowerCamelCase    ,     ):
         # time series specific configuration
         UpperCamelCase_:   Union[str, Any]        =							prediction_length
         UpperCamelCase_:   int        =							context_length or prediction_length
         UpperCamelCase_:   str        =							distribution_output
         UpperCamelCase_:   List[str]        =							loss
         UpperCamelCase_:   Tuple        =							input_size
         UpperCamelCase_:   Dict        =							num_time_features
         UpperCamelCase_:   Tuple        =							lags_sequence
         UpperCamelCase_:   Any        =							scaling
         UpperCamelCase_:   int        =							num_dynamic_real_features
         UpperCamelCase_:   Optional[Any]        =							num_static_real_features
         UpperCamelCase_:   List[Any]        =							num_static_categorical_features
         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`'				)
           UpperCamelCase_:   Tuple        =							cardinality
         else:
           UpperCamelCase_:   Optional[int]        =							[0]
         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`'				)
           UpperCamelCase_:   str        =							embedding_dimension
         else:
           UpperCamelCase_:   int        =							[min(5_0    ,     (cat + 1) // 2				) for cat in self.cardinality]
         UpperCamelCase_:   Optional[Any]        =							num_parallel_samples

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

         UpperCamelCase_:   Any        =							dropout
         UpperCamelCase_:   Optional[int]        =							attention_dropout
         UpperCamelCase_:   List[Any]        =							activation_dropout
         UpperCamelCase_:   int        =							encoder_layerdrop
         UpperCamelCase_:   List[Any]        =							decoder_layerdrop

         UpperCamelCase_:   int        =							activation_function
         UpperCamelCase_:   List[str]        =							init_std

         UpperCamelCase_:   str        =							use_cache

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





       @property
       def      _a       (   self				):
         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 ..utils import DummyObject, requires_backends




class 					UpperCAmelCase	(     metaclass=snake_case_  ):
      _lowercase:     List[Any]			=  ['''torch''', '''scipy''']




      def __init__(     self     :					Tuple     ,     *__snake_case     :					Dict     ,     **__snake_case     :					List[str]    )							-> str:
            requires_backends(self     ,     ["""torch""", """scipy"""]    )




      @classmethod
      def 							lowercase__       (     cls     :					str     ,     *__snake_case     :					List[str]     ,     **__snake_case     :					str    )							-> Tuple:
            requires_backends(cls     ,     ["""torch""", """scipy"""]    )




      @classmethod
      def 							lowercase__       (     cls     :					Optional[int]     ,     *__snake_case     :					int     ,     **__snake_case     :					Union[str, Any]    )							-> Optional[int]:
            requires_backends(cls     ,     ["""torch""", """scipy"""]    )






