

"""simple docstring"""




from typing import List, Optional

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


_lowercase   :	str												=						logging.get_logger(__name__)

_lowercase   :	Optional[Any]												=						{
    'huggingface/autoformer-tourism-monthly': 'https://huggingface.co/huggingface/autoformer-tourism-monthly/resolve/main/config.json',
}
class      _UpperCAmelCase   (							_lowerCAmelCase       ):
	a__		: Tuple					=					"autoformer"
	a__		: Union[str, Any]					=					{
	    "hidden_size": "d_model",
	    "num_attention_heads": "encoder_attention_heads",
	    "num_hidden_layers": "encoder_layers",
	}



	def __init__(  self     :       Tuple			,    _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     :       bool = True			,    _lowercase     :       int = 0			,    _lowercase     :       int = 0			,    _lowercase     :       int = 0			,    _lowercase     :       int = 0			,    _lowercase     :       Optional[List[int]] = None			,    _lowercase     :       Optional[List[int]] = None			,    _lowercase     :       int = 64			,    _lowercase     :       int = 2			,    _lowercase     :       int = 2			,    _lowercase     :       int = 2			,    _lowercase     :       int = 2			,    _lowercase     :       int = 32			,    _lowercase     :       int = 32			,    _lowercase     :       str = "gelu"			,    _lowercase     :       float = 0.1			,    _lowercase     :       float = 0.1			,    _lowercase     :       float = 0.1			,    _lowercase     :       float = 0.1			,    _lowercase     :       float = 0.1			,    _lowercase     :       int = 1_00			,    _lowercase     :       float = 0.02			,    _lowercase     :       bool = True			,    _lowercase     :       Optional[Any]=True			,    _lowercase     :       int = 10			,    _lowercase     :       int = 25			,    _lowercase     :       int = 3			,    **_lowercase     :       List[Any]			,    ):
		# time series specific configuration
		__UpperCAmelCase      		= prediction_length
		__UpperCAmelCase      		= context_length if context_length is not None else prediction_length
		__UpperCAmelCase      		= distribution_output
		__UpperCAmelCase      		= loss
		__UpperCAmelCase      		= input_size
		__UpperCAmelCase      		= num_time_features
		__UpperCAmelCase      		= lags_sequence
		__UpperCAmelCase      		= scaling
		__UpperCAmelCase      		= num_dynamic_real_features
		__UpperCAmelCase      		= num_static_real_features
		__UpperCAmelCase      		= num_static_categorical_features
		if cardinality is not None 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`'''						)
			__UpperCAmelCase      		= cardinality
		else:
			__UpperCAmelCase      		= [0]
		if embedding_dimension is not None 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`'''						)
			__UpperCAmelCase      		= embedding_dimension
		else:
			__UpperCAmelCase      		= [min(50			,    (cat + 1) // 2						) for cat in self.cardinality]
		__UpperCAmelCase      		= num_parallel_samples

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

		__UpperCAmelCase      		= dropout
		__UpperCAmelCase      		= attention_dropout
		__UpperCAmelCase      		= activation_dropout
		__UpperCAmelCase      		= encoder_layerdrop
		__UpperCAmelCase      		= decoder_layerdrop

		__UpperCAmelCase      		= activation_function
		__UpperCAmelCase      		= init_std

		__UpperCAmelCase      		= use_cache

		# Autoformer
		__UpperCAmelCase      		= label_length
		__UpperCAmelCase      		= moving_average
		__UpperCAmelCase      		= autocorrelation_factor

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



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






from typing import TYPE_CHECKING

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


if is_sentencepiece_available():
   from ..ta.tokenization_ta import TaTokenizer
else:
   from ...utils.dummy_sentencepiece_objects import TaTokenizer

lowerCamelCase__					:  List[Any]      							=				TaTokenizer

if is_tokenizers_available():
   from ..ta.tokenization_ta_fast import TaTokenizerFast
else:
   from ...utils.dummy_tokenizers_objects import TaTokenizerFast

lowerCamelCase__					:  Union[str, Any]      							=				TaTokenizerFast

lowerCamelCase__					:  Dict      							=				{'configuration_mt5': ['MT5Config', 'MT5OnnxConfig']}

try:
   if not is_torch_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   lowerCamelCase__					:  Tuple      							=				[
       'MT5EncoderModel',
       'MT5ForConditionalGeneration',
       'MT5ForQuestionAnswering',
       'MT5Model',
       'MT5PreTrainedModel',
       'MT5Stack',
   ]

try:
   if not is_tf_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   lowerCamelCase__					:  Tuple      							=				['TFMT5EncoderModel', 'TFMT5ForConditionalGeneration', 'TFMT5Model']

try:
   if not is_flax_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   lowerCamelCase__					:  Tuple      							=				['FlaxMT5EncoderModel', 'FlaxMT5ForConditionalGeneration', 'FlaxMT5Model']


if TYPE_CHECKING:
   from .configuration_mta import MTaConfig, MTaOnnxConfig

   try:
      if not is_torch_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_mta import (
          MTaEncoderModel,
          MTaForConditionalGeneration,
          MTaForQuestionAnswering,
          MTaModel,
          MTaPreTrainedModel,
          MTaStack,
      )

   try:
      if not is_tf_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_tf_mta import TFMTaEncoderModel, TFMTaForConditionalGeneration, TFMTaModel

   try:
      if not is_flax_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_flax_mta import FlaxMTaEncoderModel, FlaxMTaForConditionalGeneration, FlaxMTaModel

else:
   import sys

   lowerCamelCase__					:  int      							=				_LazyModule(
       __name__,
       globals()['__file__'],
       _import_structure,
       extra_objects={'MT5Tokenizer': MTaTokenizer, 'MT5TokenizerFast': MTaTokenizerFast},
       module_spec=__spec__,
   )