

from typing import List, Optional

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


a_     =			logging.get_logger(__name__)

a_     =			{
    """huggingface/autoformer-tourism-monthly""": """https://huggingface.co/huggingface/autoformer-tourism-monthly/resolve/main/config.json""",
}






class _UpperCamelCase							(							_UpperCAmelCase      ):
			'''simple docstring'''







			lowerCamelCase__							='autoformer'
			lowerCamelCase__							={
			    'hidden_size': 'd_model',
			    'num_attention_heads': 'encoder_attention_heads',
			    'num_hidden_layers': 'encoder_layers',
			}
			def __init__(	self							:       Tuple					,					a							:       Any = None					,					a							:       Optional[int] = None					,					a							:       List[Any] = "student_t"					,					a							:       Dict = "nll"					,					a							:       str = 1					,					a							:       Dict = [1, 2, 3, 4, 5, 6, 7]					,					a							:       List[str] = True					,					a							:       str = 0					,					a							:       Dict = 0					,					a							:       str = 0					,					a							:       str = 0					,					a							:       Tuple = None					,					a							:       Dict = None					,					a							:       Dict = 64					,					a							:       Optional[int] = 2					,					a							:       List[str] = 2					,					a							:       Optional[Any] = 2					,					a							:       Optional[int] = 2					,					a							:       Tuple = 32					,					a							:       Optional[int] = 32					,					a							:       Any = "gelu"					,					a							:       Tuple = 0.1					,					a							:       int = 0.1					,					a							:       Dict = 0.1					,					a							:       Optional[Any] = 0.1					,					a							:       str = 0.1					,					a							:       Optional[int] = 100					,					a							:       List[str] = 0.02					,					a							:       Tuple = True					,					a							:       Any=True					,					a							:       Optional[Any] = 10					,					a							:       List[str] = 25					,					a							:       Optional[int] = 3					,					**a							:       Union[str, Any]					,					)							->				Any:

				"""simple docstring"""

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

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

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

				SCREAMING_SNAKE_CASE      :					int    =				activation_function
				SCREAMING_SNAKE_CASE      :					str    =				init_std

				SCREAMING_SNAKE_CASE      :					Dict    =				use_cache

				# Autoformer
				SCREAMING_SNAKE_CASE      :					Optional[Any]    =				label_length
				SCREAMING_SNAKE_CASE      :					List[str]    =				moving_average
				SCREAMING_SNAKE_CASE      :					Dict    =				autocorrelation_factor

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






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



'''simple docstring'''



from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


A__		:					List[Any]												=  {
    """configuration_megatron_bert""": ["""MEGATRON_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MegatronBertConfig"""],
}

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      A__		:					int												=  [
          """MEGATRON_BERT_PRETRAINED_MODEL_ARCHIVE_LIST""",
          """MegatronBertForCausalLM""",
          """MegatronBertForMaskedLM""",
          """MegatronBertForMultipleChoice""",
          """MegatronBertForNextSentencePrediction""",
          """MegatronBertForPreTraining""",
          """MegatronBertForQuestionAnswering""",
          """MegatronBertForSequenceClassification""",
          """MegatronBertForTokenClassification""",
          """MegatronBertModel""",
          """MegatronBertPreTrainedModel""",
      ]

if TYPE_CHECKING:
      from .configuration_megatron_bert import MEGATRON_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, MegatronBertConfig

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_megatron_bert import (
                MEGATRON_BERT_PRETRAINED_MODEL_ARCHIVE_LIST,
                MegatronBertForCausalLM,
                MegatronBertForMaskedLM,
                MegatronBertForMultipleChoice,
                MegatronBertForNextSentencePrediction,
                MegatronBertForPreTraining,
                MegatronBertForQuestionAnswering,
                MegatronBertForSequenceClassification,
                MegatronBertForTokenClassification,
                MegatronBertModel,
                MegatronBertPreTrainedModel,
            )

else:
      import sys

      A__		:					List[Any]												=  _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)






