



from typing import List, Optional, Union

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


lowerCAmelCase__					  =  logging.get_logger(__name__)

lowerCAmelCase__					  =  {
    '''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 				snake_case__(_UpperCamelCase      ):

					"""simple docstring"""






					lowercase_								=		"""informer"""
					lowercase_								=		{
					    """hidden_size""": """d_model""",
					    """num_attention_heads""": """encoder_attention_heads""",
					    """num_hidden_layers""": """encoder_layers""",
					}







					def __init__(							self :     List[Any]				,       SCREAMING_SNAKE_CASE :     Optional[int] = None				,       SCREAMING_SNAKE_CASE :     Optional[int] = None				,       SCREAMING_SNAKE_CASE :     str = "student_t"				,       SCREAMING_SNAKE_CASE :     str = "nll"				,       SCREAMING_SNAKE_CASE :     int = 1				,       SCREAMING_SNAKE_CASE :     List[int] = None				,       SCREAMING_SNAKE_CASE :     Optional[Union[str, bool]] = "mean"				,       SCREAMING_SNAKE_CASE :     int = 0				,       SCREAMING_SNAKE_CASE :     int = 0				,       SCREAMING_SNAKE_CASE :     int = 0				,       SCREAMING_SNAKE_CASE :     int = 0				,       SCREAMING_SNAKE_CASE :     Optional[List[int]] = None				,       SCREAMING_SNAKE_CASE :     Optional[List[int]] = None				,       SCREAMING_SNAKE_CASE :     int = 64				,       SCREAMING_SNAKE_CASE :     int = 32				,       SCREAMING_SNAKE_CASE :     int = 32				,       SCREAMING_SNAKE_CASE :     int = 2				,       SCREAMING_SNAKE_CASE :     int = 2				,       SCREAMING_SNAKE_CASE :     int = 2				,       SCREAMING_SNAKE_CASE :     int = 2				,       SCREAMING_SNAKE_CASE :     bool = True				,       SCREAMING_SNAKE_CASE :     str = "gelu"				,       SCREAMING_SNAKE_CASE :     float = 0.05				,       SCREAMING_SNAKE_CASE :     float = 0.1				,       SCREAMING_SNAKE_CASE :     float = 0.1				,       SCREAMING_SNAKE_CASE :     float = 0.1				,       SCREAMING_SNAKE_CASE :     float = 0.1				,       SCREAMING_SNAKE_CASE :     int = 100				,       SCREAMING_SNAKE_CASE :     float = 0.02				,       SCREAMING_SNAKE_CASE :     Any=True				,       SCREAMING_SNAKE_CASE :     str = "prob"				,       SCREAMING_SNAKE_CASE :     int = 5				,       SCREAMING_SNAKE_CASE :     bool = True				,       **SCREAMING_SNAKE_CASE :     Dict				,       ):
									# time series specific configuration
									lowercase__					:   Union[str, Any]													=					prediction_length
									lowercase__					:   int													=					context_length or prediction_length
									lowercase__					:   int													=					distribution_output
									lowercase__					:   Dict													=					loss
									lowercase__					:   List[Any]													=					input_size
									lowercase__					:   Dict													=					num_time_features
									lowercase__					:   Optional[Any]													=					lags_sequence if lags_sequence is not None else [1, 2, 3, 4, 5, 6, 7]
									lowercase__					:   List[Any]													=					scaling
									lowercase__					:   Any													=					num_dynamic_real_features
									lowercase__					:   Any													=					num_static_real_features
									lowercase__					:   List[Any]													=					num_static_categorical_features

									# set cardinality
									if cardinality and num_static_categorical_features > 0:
													if len(SCREAMING_SNAKE_CASE					) != num_static_categorical_features:
																	raise ValueError(
																	    "The cardinality should be a list of the same length as `num_static_categorical_features`"					)
													lowercase__					:   Optional[int]													=					cardinality
									else:
													lowercase__					:   List[Any]													=					[0]

									# set embedding_dimension
									if embedding_dimension and num_static_categorical_features > 0:
													if len(SCREAMING_SNAKE_CASE					) != num_static_categorical_features:
																	raise ValueError(
																	    "The embedding dimension should be a list of the same length as `num_static_categorical_features`"					)
													lowercase__					:   Tuple													=					embedding_dimension
									else:
													lowercase__					:   List[str]													=					[min(50				,       (cat + 1) // 2					) for cat in self.cardinality]

									lowercase__					:   Optional[int]													=					num_parallel_samples

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

									lowercase__					:   Dict													=					dropout
									lowercase__					:   Union[str, Any]													=					attention_dropout
									lowercase__					:   List[str]													=					activation_dropout
									lowercase__					:   Optional[int]													=					encoder_layerdrop
									lowercase__					:   int													=					decoder_layerdrop

									lowercase__					:   List[Any]													=					activation_function
									lowercase__					:   int													=					init_std

									lowercase__					:   List[str]													=					use_cache

									# Informer
									lowercase__					:   List[Any]													=					attention_type
									lowercase__					:   Optional[int]													=					sampling_factor
									lowercase__					:   Any													=					distil

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







					@property
					def 			snake_case					(							self :     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
									)









from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


lowerCAmelCase__					  =  {
    '''configuration_deberta''': ['''DEBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''DebertaConfig''', '''DebertaOnnxConfig'''],
    '''tokenization_deberta''': ['''DebertaTokenizer'''],
}

try:
				if not is_tokenizers_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				lowerCAmelCase__					  =  ['''DebertaTokenizerFast''']

try:
				if not is_torch_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				lowerCAmelCase__					  =  [
				    '''DEBERTA_PRETRAINED_MODEL_ARCHIVE_LIST''',
				    '''DebertaForMaskedLM''',
				    '''DebertaForQuestionAnswering''',
				    '''DebertaForSequenceClassification''',
				    '''DebertaForTokenClassification''',
				    '''DebertaModel''',
				    '''DebertaPreTrainedModel''',
				]

try:
				if not is_tf_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				lowerCAmelCase__					  =  [
				    '''TF_DEBERTA_PRETRAINED_MODEL_ARCHIVE_LIST''',
				    '''TFDebertaForMaskedLM''',
				    '''TFDebertaForQuestionAnswering''',
				    '''TFDebertaForSequenceClassification''',
				    '''TFDebertaForTokenClassification''',
				    '''TFDebertaModel''',
				    '''TFDebertaPreTrainedModel''',
				]


if TYPE_CHECKING:
				from .configuration_deberta import DEBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP, DebertaConfig, DebertaOnnxConfig
				from .tokenization_deberta import DebertaTokenizer

				try:
								if not is_tokenizers_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .tokenization_deberta_fast import DebertaTokenizerFast

				try:
								if not is_torch_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_deberta import (
								    DEBERTA_PRETRAINED_MODEL_ARCHIVE_LIST,
								    DebertaForMaskedLM,
								    DebertaForQuestionAnswering,
								    DebertaForSequenceClassification,
								    DebertaForTokenClassification,
								    DebertaModel,
								    DebertaPreTrainedModel,
								)

				try:
								if not is_tf_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_tf_deberta import (
								    TF_DEBERTA_PRETRAINED_MODEL_ARCHIVE_LIST,
								    TFDebertaForMaskedLM,
								    TFDebertaForQuestionAnswering,
								    TFDebertaForSequenceClassification,
								    TFDebertaForTokenClassification,
								    TFDebertaModel,
								    TFDebertaPreTrainedModel,
								)


else:
				import sys

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




