




'''simple docstring'''
from typing import List, Optional, Union

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


_SCREAMING_SNAKE_CASE			=						logging.get_logger(__name__)

_SCREAMING_SNAKE_CASE			=						{
    "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   __UpperCAmelCase				(     lowerCAmelCase				):



					'''simple docstring'''





					_UpperCamelCase							=		"""time_series_transformer"""
					_UpperCamelCase							=		{
					    """hidden_size""": """d_model""",
					    """num_attention_heads""": """encoder_attention_heads""",
					    """num_hidden_layers""": """encoder_layers""",
					}



					def __init__(	self     :						Optional[int]      ,       _lowercase     :						Optional[int] = None      ,       _lowercase     :						Optional[int] = None      ,       _lowercase     :						str = "student_t"      ,       _lowercase     :						str = "nll"      ,       _lowercase     :						int = 1      ,       _lowercase     :						List[int] = [1, 2, 3, 4, 5, 6, 7]      ,       _lowercase     :						Optional[Union[str, bool]] = "mean"      ,       _lowercase     :						int = 0      ,       _lowercase     :						int = 0      ,       _lowercase     :						int = 0      ,       _lowercase     :						int = 0      ,       _lowercase     :						Optional[List[int]] = None      ,       _lowercase     :						Optional[List[int]] = None      ,       _lowercase     :						int = 32      ,       _lowercase     :						int = 32      ,       _lowercase     :						int = 2      ,       _lowercase     :						int = 2      ,       _lowercase     :						int = 2      ,       _lowercase     :						int = 2      ,       _lowercase     :						bool = True      ,       _lowercase     :						str = "gelu"      ,       _lowercase     :						int = 64      ,       _lowercase     :						float = 0.1      ,       _lowercase     :						float = 0.1      ,       _lowercase     :						float = 0.1      ,       _lowercase     :						float = 0.1      ,       _lowercase     :						float = 0.1      ,       _lowercase     :						int = 100      ,       _lowercase     :						float = 0.02      ,       _lowercase     :						Tuple=True      ,       **_lowercase     :						List[Any]      ,       )    ->							Dict:
								# time series specific configuration
								A_									= prediction_length
								A_									= context_length or prediction_length
								A_									= distribution_output
								A_									= loss
								A_									= input_size
								A_									= num_time_features
								A_									= lags_sequence
								A_									= scaling
								A_									= num_dynamic_real_features
								A_									= num_static_real_features
								A_									= num_static_categorical_features
								if cardinality and num_static_categorical_features > 0:
											if len(_lowercase) != num_static_categorical_features:
														raise ValueError(
														    'The cardinality should be a list of the same length as `num_static_categorical_features`')
											A_									= cardinality
								else:
											A_									= [0]
								if embedding_dimension and num_static_categorical_features > 0:
											if len(_lowercase) != num_static_categorical_features:
														raise ValueError(
														    'The embedding dimension should be a list of the same length as `num_static_categorical_features`')
											A_									= embedding_dimension
								else:
											A_									= [min(50      ,       (cat + 1) // 2) for cat in self.cardinality]
								A_									= num_parallel_samples

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

								A_									= dropout
								A_									= attention_dropout
								A_									= activation_dropout
								A_									= encoder_layerdrop
								A_									= decoder_layerdrop

								A_									= activation_function
								A_									= init_std

								A_									= use_cache

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



					@property
					def     __snake_case						(	self     :						int)    ->							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'''
import warnings

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


_SCREAMING_SNAKE_CASE			=						logging.get_logger(__name__)

_SCREAMING_SNAKE_CASE			=						{
    "RUCAIBox/mvp": "https://huggingface.co/RUCAIBox/mvp/resolve/main/config.json",
}
class   __UpperCAmelCase				(     lowerCAmelCase				):



					'''simple docstring'''





					_UpperCamelCase							=		"""mvp"""
					_UpperCamelCase							=		["""past_key_values"""]
					_UpperCamelCase							=		{"""num_attention_heads""": """encoder_attention_heads""", """hidden_size""": """d_model"""}



					def __init__(	self     :						List[str]      ,       _lowercase     :						int=50_267      ,       _lowercase     :						str=1_024      ,       _lowercase     :						int=12      ,       _lowercase     :						int=4_096      ,       _lowercase     :						Tuple=16      ,       _lowercase     :						Optional[Any]=12      ,       _lowercase     :						Union[str, Any]=4_096      ,       _lowercase     :						List[Any]=16      ,       _lowercase     :						str=0.0      ,       _lowercase     :						List[str]=0.0      ,       _lowercase     :						Dict="gelu"      ,       _lowercase     :						Union[str, Any]=1_024      ,       _lowercase     :						str=0.1      ,       _lowercase     :						List[Any]=0.0      ,       _lowercase     :						Any=0.0      ,       _lowercase     :						List[str]=0.02      ,       _lowercase     :						List[Any]=0.0      ,       _lowercase     :						List[str]=False      ,       _lowercase     :						Tuple=True      ,       _lowercase     :						Any=1      ,       _lowercase     :						Optional[Any]=0      ,       _lowercase     :						Dict=2      ,       _lowercase     :						int=True      ,       _lowercase     :						Any=2      ,       _lowercase     :						Tuple=2      ,       _lowercase     :						Optional[Any]=False      ,       _lowercase     :						List[str]=100      ,       _lowercase     :						List[str]=800      ,       **_lowercase     :						Dict      ,       )    ->							Dict:
								A_									= vocab_size
								A_									= max_position_embeddings
								A_									= d_model
								A_									= encoder_ffn_dim
								A_									= encoder_layers
								A_									= encoder_attention_heads
								A_									= decoder_ffn_dim
								A_									= decoder_layers
								A_									= decoder_attention_heads
								A_									= dropout
								A_									= attention_dropout
								A_									= activation_dropout
								A_									= activation_function
								A_									= init_std
								A_									= encoder_layerdrop
								A_									= decoder_layerdrop
								A_									= classifier_dropout
								A_									= use_cache
								A_									= encoder_layers
								A_									= scale_embedding  # scale factor will be sqrt(d_model) if True
								A_									= use_prompt
								A_									= prompt_length
								A_									= prompt_mid_dim

								super().__init__(
								    pad_token_id=_lowercase      ,       bos_token_id=_lowercase      ,       eos_token_id=_lowercase      ,       is_encoder_decoder=_lowercase      ,       decoder_start_token_id=_lowercase      ,       forced_eos_token_id=_lowercase      ,       **_lowercase      ,       )

								if self.forced_bos_token_id is None and kwargs.get('force_bos_token_to_be_generated'      ,       _lowercase):
											A_									= self.bos_token_id
											warnings.warn(
											    F'Please make sure the config includes `forced_bos_token_id={self.bos_token_id}` in future versions. '
											    'The config can simply be saved and uploaded again to be fixed.')




