



'''simple docstring'''




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


a   :			Tuple					  =    logging.get_logger(__name__)

a   :			List[str]					  =    {
    """facebook/nllb-moe-54B""": """https://huggingface.co/facebook/nllb-moe-54b/resolve/main/config.json""",
}

class 			UpperCamelCase_ (							__magic_name__			):
	lowercase          = "nllb-moe"
	lowercase          = ["past_key_values"]
	lowercase          = {"num_attention_heads": "encoder_attention_heads", "hidden_size": "d_model"}





	def __init__(  self		,		A=128112		,		A=1024		,		A=12		,		A=4096		,		A=16		,		A=12		,		A=4096		,		A=16		,		A=0.0_5		,		A=0.0_5		,		A=True		,		A=True		,		A="relu"		,		A=1024		,		A=0.1		,		A=0.1		,		A=0.0		,		A=0.0_2		,		A=2		,		A=True		,		A=False		,		A="float32"		,		A=False		,		A=128		,		A=64		,		A=4		,		A=4		,		A=0.0_0_1		,		A=0.0_0_1		,		A="all"		,		A=False		,		A=False		,		A=1.0		,		A=0.2		,		A=1		,		A=0		,		A=2		,		A=False		,		**A		,		)			->			List[str]:
								UpperCAmelCase     :		Union[str, Any]							     =		vocab_size
								UpperCAmelCase     :		Union[str, Any]							     =		max_position_embeddings
								UpperCAmelCase     :		int							     =		d_model
								UpperCAmelCase     :		int							     =		encoder_ffn_dim
								UpperCAmelCase     :		int							     =		encoder_layers
								UpperCAmelCase     :		int							     =		encoder_attention_heads
								UpperCAmelCase     :		int							     =		decoder_ffn_dim
								UpperCAmelCase     :		Tuple							     =		decoder_layers
								UpperCAmelCase     :		Union[str, Any]							     =		decoder_attention_heads
								UpperCAmelCase     :		Optional[int]							     =		dropout
								UpperCAmelCase     :		Any							     =		attention_dropout
								UpperCAmelCase     :		List[str]							     =		activation_dropout
								UpperCAmelCase     :		Union[str, Any]							     =		activation_function
								UpperCAmelCase     :		Dict							     =		init_std
								UpperCAmelCase     :		List[str]							     =		encoder_layerdrop
								UpperCAmelCase     :		Optional[Any]							     =		decoder_layerdrop
								UpperCAmelCase     :		str							     =		use_cache
								UpperCAmelCase     :		Dict							     =		encoder_layers
								UpperCAmelCase     :		Tuple							     =		scale_embedding  # scale factor will be sqrt(d_model) if True
								UpperCAmelCase     :		List[Any]							     =		router_z_loss_coef
								UpperCAmelCase     :		str							     =		router_aux_loss_coef
								UpperCAmelCase     :		List[str]							     =		decoder_sparse_step
								UpperCAmelCase     :		Optional[int]							     =		encoder_sparse_step
								UpperCAmelCase     :		List[str]							     =		num_experts
								UpperCAmelCase     :		Dict							     =		expert_capacity
								UpperCAmelCase     :		int							     =		router_bias
								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     :		Optional[Any]							     =		router_dtype

								UpperCAmelCase     :		Union[str, Any]							     =		router_ignore_padding_tokens
								UpperCAmelCase     :		Tuple							     =		batch_prioritized_routing
								UpperCAmelCase     :		Optional[Any]							     =		second_expert_policy
								UpperCAmelCase     :		Optional[int]							     =		normalize_router_prob_before_dropping
								UpperCAmelCase     :		str							     =		moe_eval_capacity_token_fraction
								UpperCAmelCase     :		Any							     =		moe_token_dropout
								UpperCAmelCase     :		Optional[Any]							     =		output_router_logits
								super().__init__(
								    pad_token_id=UpperCAmelCase__		,		bos_token_id=UpperCAmelCase__		,		eos_token_id=UpperCAmelCase__		,		is_encoder_decoder=UpperCAmelCase__		,		decoder_start_token_id=UpperCAmelCase__		,		**UpperCAmelCase__		,		)




"""simple docstring"""





from typing import List, Optional, Union

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


_a       =							logging.get_logger(__name__)

_a       =							{
    '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  (	lowercase   ):







 """simple docstring"""







 __UpperCAmelCase	:					int   		=	"time_series_transformer"
 __UpperCAmelCase	:					Any   		=	{
     "hidden_size": "d_model",
     "num_attention_heads": "encoder_attention_heads",
     "num_hidden_layers": "encoder_layers",
 }


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

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

    __lowercase								=						dropout
    __lowercase								=						attention_dropout
    __lowercase								=						activation_dropout
    __lowercase								=						encoder_layerdrop
    __lowercase								=						decoder_layerdrop

    __lowercase								=						activation_function
    __lowercase								=						init_std

    __lowercase								=						use_cache

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



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




