
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  lowercase__(				lowerCamelCase_							):



	"""simple docstring"""




	a			:List[str]         =	'''autoformer'''
	a			:Union[str, Any]         =	{
	    '''hidden_size''': '''d_model''',
	    '''num_attention_heads''': '''encoder_attention_heads''',
	    '''num_hidden_layers''': '''encoder_layers''',
	}
	def __init__(       self  :			Tuple       ,							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] = [1, 2, 3, 4, 5, 6, 7]       ,							SCREAMING_SNAKE_CASE_  :			bool = True       ,							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 = 6_4       ,							SCREAMING_SNAKE_CASE_  :			int = 2       ,							SCREAMING_SNAKE_CASE_  :			int = 2       ,							SCREAMING_SNAKE_CASE_  :			int = 2       ,							SCREAMING_SNAKE_CASE_  :			int = 2       ,							SCREAMING_SNAKE_CASE_  :			int = 3_2       ,							SCREAMING_SNAKE_CASE_  :			int = 3_2       ,							SCREAMING_SNAKE_CASE_  :			str = "gelu"       ,							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_  :			float = 0.1       ,							SCREAMING_SNAKE_CASE_  :			int = 1_0_0       ,							SCREAMING_SNAKE_CASE_  :			float = 0.02       ,							SCREAMING_SNAKE_CASE_  :			bool = True       ,							SCREAMING_SNAKE_CASE_  :			Dict=True       ,							SCREAMING_SNAKE_CASE_  :			int = 1_0       ,							SCREAMING_SNAKE_CASE_  :			int = 2_5       ,							SCREAMING_SNAKE_CASE_  :			int = 3       ,							**SCREAMING_SNAKE_CASE_  :			Optional[int]       ,							)       ->     Any:
					# time series specific configuration
					lowercase_       =					prediction_length
					lowercase_       =					context_length if context_length is not None else prediction_length
					lowercase_       =					distribution_output
					lowercase_       =					loss
					lowercase_       =					input_size
					lowercase_       =					num_time_features
					lowercase_       =					lags_sequence
					lowercase_       =					scaling
					lowercase_       =					num_dynamic_real_features
					lowercase_       =					num_static_real_features
					lowercase_       =					num_static_categorical_features
					if cardinality is not None and num_static_categorical_features > 0:
									if len(__snake_case       ) != num_static_categorical_features:
													raise ValueError(
													    '''The cardinality should be a list of the same length as `num_static_categorical_features`'''       )
									lowercase_       =					cardinality
					else:
									lowercase_       =					[0]
					if embedding_dimension is not None and num_static_categorical_features > 0:
									if len(__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_       =					embedding_dimension
					else:
									lowercase_       =					[min(5_0       ,							(cat + 1) // 2       ) for cat in self.cardinality]
					lowercase_       =					num_parallel_samples

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

					lowercase_       =					dropout
					lowercase_       =					attention_dropout
					lowercase_       =					activation_dropout
					lowercase_       =					encoder_layerdrop
					lowercase_       =					decoder_layerdrop

					lowercase_       =					activation_function
					lowercase_       =					init_std

					lowercase_       =					use_cache

					# Autoformer
					lowercase_       =					label_length
					lowercase_       =					moving_average
					lowercase_       =					autocorrelation_factor

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




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








import copy
from dataclasses import dataclass, field
from typing import ClassVar, Dict

from ..features import Audio, ClassLabel, Features
from .base import TaskTemplate







@dataclass(frozen=lowerCamelCase_      )
class        snake_case_   (lowerCamelCase_      ):
					UpperCAmelCase__					:    str          =			field(default='''audio-classification'''	,						metadata={'''include_in_asdict_even_if_is_default''': True}      )
					UpperCAmelCase__					:    ClassVar[Features]          =			Features({'''audio''': Audio()}      )
					UpperCAmelCase__					:    ClassVar[Features]          =			Features({'''labels''': ClassLabel}      )
					UpperCAmelCase__					:    str          =			"audio"
					UpperCAmelCase__					:    str          =			"labels"
					def  lowerCamelCase__(      self   :Optional[int]			,__snake_case   :int      )					->    str:
												if self.label_column not in features:
																			raise ValueError(F'Column {self.label_column} is not present in features.'      )
												if not isinstance(features[self.label_column]			,__snake_case      ):
																			raise ValueError(F'Column {self.label_column} is not a ClassLabel.'      )
												a__             =     copy.deepcopy(self      )
												a__             =     self.label_schema.copy()
												a__             =     features[self.label_column]
												a__             =     label_schema
												return task_template



					@property
					def  lowerCamelCase__(      self   :Dict      )					->    Dict[str, str]:
												return {
												    self.audio_column: "audio",
												    self.label_column: "labels",
												}




