




"""simple docstring"""




from typing import List, Optional, Union

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


lowerCAmelCase							:    int  							=							logging.get_logger(__name__)

lowerCAmelCase							:    int  							=							{
    """huggingface/time-series-transformer-tourism-monthly""": (
        """https://huggingface.co/huggingface/time-series-transformer-tourism-monthly/resolve/main/config.json"""
    ),
    # See all TimeSeriesTransformer models at https://huggingface.co/models?filter=time_series_transformer
}






class 					__magic_name__							( UpperCAmelCase__       ):






				'''simple docstring'''
				__UpperCamelCase    						=		"time_series_transformer"
				__UpperCamelCase    						=		{
				    "hidden_size": "d_model",
				    "num_attention_heads": "encoder_attention_heads",
				    "num_hidden_layers": "encoder_layers",
				}





				def __init__( self	,				_a = None	,				_a = None	,				_a = "student_t"	,				_a = "nll"	,				_a = 1	,				_a = [1, 2, 3, 4, 5, 6, 7]	,				_a = "mean"	,				_a = 0	,				_a = 0	,				_a = 0	,				_a = 0	,				_a = None	,				_a = None	,				_a = 32	,				_a = 32	,				_a = 2	,				_a = 2	,				_a = 2	,				_a = 2	,				_a = True	,				_a = "gelu"	,				_a = 64	,				_a = 0.1	,				_a = 0.1	,				_a = 0.1	,				_a = 0.1	,				_a = 0.1	,				_a = 100	,				_a = 0.02	,				_a=True	,				**_a	,				):





							"""simple docstring"""
							# 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
							lowerCamelCase       =      scaling
							lowerCamelCase       =      num_dynamic_real_features
							lowerCamelCase       =      num_static_real_features
							lowerCamelCase       =      num_static_categorical_features
							if cardinality and num_static_categorical_features > 0:
										if len(_a				) != 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 and num_static_categorical_features > 0:
										if len(_a				) != 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(_a				) + 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

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





				@property
				def      _lowerCAmelCase       ( self				):





							"""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

# rely on isort to merge the imports
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


lowerCAmelCase							:    List[str]  							=							{
    """configuration_autoformer""": [
        """AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""",
        """AutoformerConfig""",
    ],
}

try:
					if not is_torch_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					lowerCAmelCase							:    Tuple  							=							[
					    """AUTOFORMER_PRETRAINED_MODEL_ARCHIVE_LIST""",
					    """AutoformerForPrediction""",
					    """AutoformerModel""",
					    """AutoformerPreTrainedModel""",
					]


if TYPE_CHECKING:
					from .configuration_autoformer import (
					    AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP,
					    AutoformerConfig,
					)

					try:
										if not is_torch_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_autoformer import (
										    AUTOFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
										    AutoformerForPrediction,
										    AutoformerModel,
										    AutoformerPreTrainedModel,
										)

else:
					import sys

					lowerCAmelCase							:    str  							=							_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)



