'''simple docstring'''

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


UpperCamelCase__     :	Dict				=			logging.get_logger(__name__)

UpperCamelCase__     :	Union[str, Any]				=			{
    'google/switch-base-8': 'https://huggingface.co/google/switch-base-8/blob/main/config.json',
}


class 				_lowercase	(      lowercase__   ):
      '''simple docstring'''


      UpperCAmelCase_      :      int      							=   '''switch_transformers'''
      UpperCAmelCase_      :      int      							=   ['''past_key_values''']
      UpperCAmelCase_      :      List[Any]      							=   {'''hidden_size''': '''d_model''', '''num_attention_heads''': '''num_heads''', '''num_hidden_layers''': '''num_layers'''}




      def __init__(				self					,lowerCamelCase_=32128					,lowerCamelCase_=768					,lowerCamelCase_=64					,lowerCamelCase_=2048					,lowerCamelCase_=64					,lowerCamelCase_=12					,lowerCamelCase_=3					,lowerCamelCase_=12					,lowerCamelCase_=3					,lowerCamelCase_=12					,lowerCamelCase_=8					,lowerCamelCase_=False					,lowerCamelCase_=0.01					,lowerCamelCase_="float32"					,lowerCamelCase_=False					,lowerCamelCase_=32					,lowerCamelCase_=128					,lowerCamelCase_=0.1					,lowerCamelCase_=1e-6					,lowerCamelCase_=0.001					,lowerCamelCase_=0.001					,lowerCamelCase_=1.0					,lowerCamelCase_="relu"					,lowerCamelCase_=True					,lowerCamelCase_=False					,lowerCamelCase_=True					,lowerCamelCase_=0					,lowerCamelCase_=1					,**lowerCamelCase_					,)			->			Tuple:



         '''simple docstring'''



         UpperCAmelCase__							:				Union[str, Any]   				=  vocab_size
         UpperCAmelCase__							:				Optional[Any]   				=  d_model
         UpperCAmelCase__							:				int   				=  d_kv
         UpperCAmelCase__							:				Optional[int]   				=  d_ff

         UpperCAmelCase__							:				Union[str, Any]   				=  num_sparse_encoder_layers

         UpperCAmelCase__							:				List[Any]   				=  num_layers
         UpperCAmelCase__							:				List[Any]   				=  (
             num_decoder_layers if num_decoder_layers is not None else self.num_layers
         )  # default = symmetry
         UpperCAmelCase__							:				Optional[int]   				=  num_sparse_decoder_layers

         # This tells us, each how many encoder layer we'll have to set a sparse layer.
         if self.num_sparse_encoder_layers > 0:
            UpperCAmelCase__							:				int   				=  self.num_layers // self.num_sparse_encoder_layers
         else:
            UpperCAmelCase__							:				List[Any]   				=  self.num_layers  # HACK: this will create 0 sparse layers

         # This tells us, each how many encoder layer we'll have to set a sparse layer.
         if self.num_sparse_decoder_layers > 0:
            UpperCAmelCase__							:				Any   				=  self.num_decoder_layers // self.num_sparse_decoder_layers
         else:
            UpperCAmelCase__							:				Union[str, Any]   				=  self.num_decoder_layers  # HACK: this will create 0 sparse layers

         UpperCAmelCase__							:				Dict   				=  num_heads
         UpperCAmelCase__							:				Union[str, Any]   				=  num_experts
         UpperCAmelCase__							:				List[Any]   				=  expert_capacity
         UpperCAmelCase__							:				List[str]   				=  router_bias
         UpperCAmelCase__							:				Tuple   				=  router_jitter_noise
         if router_dtype not in ["float32", "float16", "bfloat16"]:
            raise ValueError(f'''`router_dtype` must be one of \'float32\', \'float16\' or \'bfloat16\', got {router_dtype}'''							)
         UpperCAmelCase__							:				str   				=  router_dtype

         UpperCAmelCase__							:				List[str]   				=  router_ignore_padding_tokens
         UpperCAmelCase__							:				List[str]   				=  relative_attention_num_buckets
         UpperCAmelCase__							:				Optional[Any]   				=  relative_attention_max_distance

         UpperCAmelCase__							:				Optional[int]   				=  dropout_rate
         UpperCAmelCase__							:				Any   				=  layer_norm_epsilon
         UpperCAmelCase__							:				Union[str, Any]   				=  initializer_factor
         UpperCAmelCase__							:				Dict   				=  feed_forward_proj
         UpperCAmelCase__							:				Union[str, Any]   				=  use_cache
         UpperCAmelCase__							:				Union[str, Any]   				=  add_router_probs

         UpperCAmelCase__							:				str   				=  router_z_loss_coef
         UpperCAmelCase__							:				Optional[int]   				=  router_aux_loss_coef

         UpperCAmelCase__							:				Union[str, Any]   				=  self.feed_forward_proj.split('''-'''							)
         UpperCAmelCase__							:				Optional[int]   				=  act_info[-1]
         UpperCAmelCase__							:				Tuple   				=  act_info[0] == '''gated'''

         if len(UpperCAmelCase__							) > 1 and act_info[0] != "gated" or len(UpperCAmelCase__							) > 2:
            raise ValueError(
                f'''`feed_forward_proj`: {feed_forward_proj} is not a valid activation function of the dense layer.'''
                '''Please make sure `feed_forward_proj` is of the format `gated-{ACT_FN}` or `{ACT_FN}`, e.g. '''
                '''\'gated-gelu\' or \'relu\''''							)

         # for backwards compatibility
         if feed_forward_proj == "gated-gelu":
            UpperCAmelCase__							:				Dict   				=  '''gelu_new'''

         super().__init__(
             pad_token_id=UpperCAmelCase__					,eos_token_id=UpperCAmelCase__					,is_encoder_decoder=UpperCAmelCase__					,**UpperCAmelCase__					,)





'''simple docstring'''

from typing import List, Optional, Union

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


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

UpperCamelCase__     :	Optional[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 				_lowercase	(      lowerCAmelCase   ):
      '''simple docstring'''


      UpperCAmelCase_      :      Any      							=   '''time_series_transformer'''
      UpperCAmelCase_      :      List[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_ = 32					,lowerCamelCase_ = 32					,lowerCamelCase_ = 2					,lowerCamelCase_ = 2					,lowerCamelCase_ = 2					,lowerCamelCase_ = 2					,lowerCamelCase_ = True					,lowerCamelCase_ = "gelu"					,lowerCamelCase_ = 64					,lowerCamelCase_ = 0.1					,lowerCamelCase_ = 0.1					,lowerCamelCase_ = 0.1					,lowerCamelCase_ = 0.1					,lowerCamelCase_ = 0.1					,lowerCamelCase_ = 100					,lowerCamelCase_ = 0.02					,lowerCamelCase_=True					,**lowerCamelCase_					,)			->			Tuple:



         '''simple docstring'''



         UpperCAmelCase__							:				Dict   				=  prediction_length
         UpperCAmelCase__							:				Optional[Any]   				=  context_length or prediction_length
         UpperCAmelCase__							:				Union[str, Any]   				=  distribution_output
         UpperCAmelCase__							:				List[Any]   				=  loss
         UpperCAmelCase__							:				Optional[int]   				=  input_size
         UpperCAmelCase__							:				Tuple   				=  num_time_features
         UpperCAmelCase__							:				str   				=  lags_sequence
         UpperCAmelCase__							:				Union[str, Any]   				=  scaling
         UpperCAmelCase__							:				Optional[int]   				=  num_dynamic_real_features
         UpperCAmelCase__							:				Optional[Any]   				=  num_static_real_features
         UpperCAmelCase__							:				str   				=  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__							:				Union[str, Any]   				=  cardinality
         else:
            UpperCAmelCase__							:				List[str]   				=  [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__							:				int   				=  embedding_dimension
         else:
            UpperCAmelCase__							:				Union[str, Any]   				=  [min(50					,(cat + 1) // 2							) for cat in self.cardinality]
         UpperCAmelCase__							:				Dict   				=  num_parallel_samples

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

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

         UpperCAmelCase__							:				List[Any]   				=  activation_function
         UpperCAmelCase__							:				List[Any]   				=  init_std

         UpperCAmelCase__							:				Optional[Any]   				=  use_cache

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




      @property
      def 		lowerCAmelCase__					(				self							)			->			int:



         '''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
         )




