
"""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/informer-tourism-monthly''': (
        '''https://huggingface.co/huggingface/informer-tourism-monthly/resolve/main/config.json'''
    ),
    # See all Informer models at https://huggingface.co/models?filter=informer
}
class       lowerCAmelCase_		(				_UpperCamelCase ):



							'''simple docstring'''





							_snake_case						      =		'informer'
							_snake_case						      =		{
							    'hidden_size': 'd_model',
							    'num_attention_heads': 'encoder_attention_heads',
							    'num_hidden_layers': 'encoder_layers',
							}




							def __init__( self    ,				snake_case_ = None    ,				snake_case_ = None    ,				snake_case_ = "student_t"    ,				snake_case_ = "nll"    ,				snake_case_ = 1    ,				snake_case_ = None    ,				snake_case_ = "mean"    ,				snake_case_ = 0    ,				snake_case_ = 0    ,				snake_case_ = 0    ,				snake_case_ = 0    ,				snake_case_ = None    ,				snake_case_ = None    ,				snake_case_ = 64    ,				snake_case_ = 32    ,				snake_case_ = 32    ,				snake_case_ = 2    ,				snake_case_ = 2    ,				snake_case_ = 2    ,				snake_case_ = 2    ,				snake_case_ = True    ,				snake_case_ = "gelu"    ,				snake_case_ = 0.05    ,				snake_case_ = 0.1    ,				snake_case_ = 0.1    ,				snake_case_ = 0.1    ,				snake_case_ = 0.1    ,				snake_case_ = 100    ,				snake_case_ = 0.02    ,				snake_case_=True    ,				snake_case_ = "prob"    ,				snake_case_ = 5    ,				snake_case_ = True    ,				**snake_case_    ,				)       ->  Tuple:
													# time series specific configuration
													__lowerCAmelCase     =  prediction_length
													__lowerCAmelCase     =  context_length or prediction_length
													__lowerCAmelCase     =  distribution_output
													__lowerCAmelCase     =  loss
													__lowerCAmelCase     =  input_size
													__lowerCAmelCase     =  num_time_features
													__lowerCAmelCase     =  lags_sequence if lags_sequence is not None else [1, 2, 3, 4, 5, 6, 7]
													__lowerCAmelCase     =  scaling
													__lowerCAmelCase     =  num_dynamic_real_features
													__lowerCAmelCase     =  num_static_real_features
													__lowerCAmelCase     =  num_static_categorical_features

													# set cardinality
													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`"""				)
																			__lowerCAmelCase     =  cardinality
													else:
																			__lowerCAmelCase     =  [0]

													# set embedding_dimension
													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`"""				)
																			__lowerCAmelCase     =  embedding_dimension
													else:
																			__lowerCAmelCase     =  [min(50    ,				(cat + 1) // 2				) for cat in self.cardinality]

													__lowerCAmelCase     =  num_parallel_samples

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

													__lowerCAmelCase     =  dropout
													__lowerCAmelCase     =  attention_dropout
													__lowerCAmelCase     =  activation_dropout
													__lowerCAmelCase     =  encoder_layerdrop
													__lowerCAmelCase     =  decoder_layerdrop

													__lowerCAmelCase     =  activation_function
													__lowerCAmelCase     =  init_std

													__lowerCAmelCase     =  use_cache

													# Informer
													__lowerCAmelCase     =  attention_type
													__lowerCAmelCase     =  sampling_factor
													__lowerCAmelCase     =  distil

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




							@property
							def    A__						( self				)       ->  Tuple:
													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 typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tensorflow_text_available, is_torch_available


__lowerCAmelCase		     =  {
    '''configuration_ernie''': ['''ERNIE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ErnieConfig''', '''ErnieOnnxConfig'''],
}

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							__lowerCAmelCase		     =  [
							    '''ERNIE_PRETRAINED_MODEL_ARCHIVE_LIST''',
							    '''ErnieForCausalLM''',
							    '''ErnieForMaskedLM''',
							    '''ErnieForMultipleChoice''',
							    '''ErnieForNextSentencePrediction''',
							    '''ErnieForPreTraining''',
							    '''ErnieForQuestionAnswering''',
							    '''ErnieForSequenceClassification''',
							    '''ErnieForTokenClassification''',
							    '''ErnieModel''',
							    '''ErniePreTrainedModel''',
							]

if TYPE_CHECKING:
							from .configuration_ernie import ERNIE_PRETRAINED_CONFIG_ARCHIVE_MAP, ErnieConfig, ErnieOnnxConfig

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_ernie import (
														    ERNIE_PRETRAINED_MODEL_ARCHIVE_LIST,
														    ErnieForCausalLM,
														    ErnieForMaskedLM,
														    ErnieForMultipleChoice,
														    ErnieForNextSentencePrediction,
														    ErnieForPreTraining,
														    ErnieForQuestionAnswering,
														    ErnieForSequenceClassification,
														    ErnieForTokenClassification,
														    ErnieModel,
														    ErniePreTrainedModel,
														)

else:
							import sys

							__lowerCAmelCase		     =  _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)




