



"""simple docstring"""
from typing import List, Optional

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


__SCREAMING_SNAKE_CASE  :						Union[str, Any]    							=      logging.get_logger(__name__)

__SCREAMING_SNAKE_CASE  :						Optional[Any]    							=      {
    '''huggingface/autoformer-tourism-monthly''': '''https://huggingface.co/huggingface/autoformer-tourism-monthly/resolve/main/config.json''',
}


class 							lowerCamelCase_(   A__    ):





					'''simple docstring'''



					lowercase__   :       str										= 'autoformer'
					lowercase__   :       List[Any]										= {
					    'hidden_size': 'd_model',
					    'num_attention_heads': 'encoder_attention_heads',
					    'num_hidden_layers': 'encoder_layers',
					}

					def __init__(    self				,       lowerCamelCase__ = None				,       lowerCamelCase__ = None				,       lowerCamelCase__ = "student_t"				,       lowerCamelCase__ = "nll"				,       lowerCamelCase__ = 1				,       lowerCamelCase__ = [1, 2, 3, 4, 5, 6, 7]				,       lowerCamelCase__ = True				,       lowerCamelCase__ = 0				,       lowerCamelCase__ = 0				,       lowerCamelCase__ = 0				,       lowerCamelCase__ = 0				,       lowerCamelCase__ = None				,       lowerCamelCase__ = None				,       lowerCamelCase__ = 6_4				,       lowerCamelCase__ = 2				,       lowerCamelCase__ = 2				,       lowerCamelCase__ = 2				,       lowerCamelCase__ = 2				,       lowerCamelCase__ = 3_2				,       lowerCamelCase__ = 3_2				,       lowerCamelCase__ = "gelu"				,       lowerCamelCase__ = 0.1				,       lowerCamelCase__ = 0.1				,       lowerCamelCase__ = 0.1				,       lowerCamelCase__ = 0.1				,       lowerCamelCase__ = 0.1				,       lowerCamelCase__ = 1_0_0				,       lowerCamelCase__ = 0.0_2				,       lowerCamelCase__ = True				,       lowerCamelCase__=True				,       lowerCamelCase__ = 1_0				,       lowerCamelCase__ = 2_5				,       lowerCamelCase__ = 3				,       **lowerCamelCase__				,       ):
									# time series specific configuration
									_lowerCamelCase        =				prediction_length
									_lowerCamelCase        =				context_length if context_length is not None else prediction_length
									_lowerCamelCase        =				distribution_output
									_lowerCamelCase        =				loss
									_lowerCamelCase        =				input_size
									_lowerCamelCase        =				num_time_features
									_lowerCamelCase        =				lags_sequence
									_lowerCamelCase        =				scaling
									_lowerCamelCase        =				num_dynamic_real_features
									_lowerCamelCase        =				num_static_real_features
									_lowerCamelCase        =				num_static_categorical_features
									if cardinality is not None and num_static_categorical_features > 0:
													if len(lowerCamelCase__   ) != 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]
									if embedding_dimension is not None and num_static_categorical_features > 0:
													if len(lowerCamelCase__   ) != 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(5_0				,       (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

									# Autoformer
									_lowerCamelCase        =				label_length
									_lowerCamelCase        =				moving_average
									_lowerCamelCase        =				autocorrelation_factor

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





					@property
					def 			snake_case__      (    self   ):
									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"""
import warnings

from .generation import TFGenerationMixin


class 							lowerCamelCase_(   A__    ):





					'''simple docstring'''



					warnings.warn(
					    'Importing `TFGenerationMixin` from `src/transformers/generation_tf_utils.py` is deprecated and will '
					    'be removed in Transformers v5. Import as `from transformers import TFGenerationMixin` instead.',				A__,				)
