




"""simple docstring"""







from ...processing_utils import ProcessorMixin






class       SCREAMING_SNAKE_CASE__					(					__a					):
						_a    						=						["image_processor", "feature_extractor"]
						_a    						=						"TvltImageProcessor"
						_a    						=						"TvltFeatureExtractor"


						def __init__(							self				:			Optional[int]						,						lowerCAmelCase				:			Union[str, Any]						,						lowerCAmelCase				:			Union[str, Any]					):
										super().__init__(image_processor=lowerCAmelCase_						,						feature_extractor=lowerCAmelCase_					)

										lowerCAmelCase  =				image_processor
										lowerCAmelCase  =				feature_extractor


						def __call__(							self				:			Union[str, Any]						,						lowerCAmelCase				:			List[Any]=None						,						lowerCAmelCase				:			Optional[Any]=None						,						lowerCAmelCase				:			Optional[int]=None						,						lowerCAmelCase				:			List[str]=None						,						lowerCAmelCase				:			int=False						,						lowerCAmelCase				:			Dict=False						,						*lowerCAmelCase				:			List[Any]						,						**lowerCAmelCase				:			Dict						,						):







										if images is None and audio is None:
														raise ValueError("""You need to specify either an `images` or `audio` input to process."""					)

										lowerCAmelCase  =				None
										if images is not None:
														lowerCAmelCase  =				self.image_processor(lowerCAmelCase_						,						mask_pixel=lowerCAmelCase_						,						*lowerCAmelCase_						,						**lowerCAmelCase_					)
										if images_mixed is not None:
														lowerCAmelCase  =				self.image_processor(lowerCAmelCase_						,						is_mixed=lowerCAmelCase_						,						*lowerCAmelCase_						,						**lowerCAmelCase_					)
										if audio is not None:
														lowerCAmelCase  =				self.feature_extractor(
														    lowerCAmelCase_						,						*lowerCAmelCase_						,						sampling_rate=lowerCAmelCase_						,						mask_audio=lowerCAmelCase_						,						**lowerCAmelCase_					)

										lowerCAmelCase  =				{}
										if audio is not None:
														output_dict.update(lowerCAmelCase_					)
										if images is not None:
														output_dict.update(lowerCAmelCase_					)
										if images_mixed_dict is not None:
														output_dict.update(lowerCAmelCase_					)
										return output_dict




						@property
						def   __lowercase (							self				:			Optional[Any]					):
										lowerCAmelCase  =				self.image_processor.model_input_names
										lowerCAmelCase  =				self.feature_extractor.model_input_names
										return list(dict.fromkeys(image_processor_input_names + feature_extractor_input_names					)					)











"""simple docstring"""







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       SCREAMING_SNAKE_CASE__					(					_a					):
						_a    						=						'autoformer'
						_a    						=						{
						    'hidden_size': 'd_model',
						    'num_attention_heads': 'encoder_attention_heads',
						    'num_hidden_layers': 'encoder_layers',
						}


						def __init__(							self				:			Dict						,						lowerCAmelCase				:			Optional[int] = None						,						lowerCAmelCase				:			Optional[int] = None						,						lowerCAmelCase				:			str = "student_t"						,						lowerCAmelCase				:			str = "nll"						,						lowerCAmelCase				:			int = 1						,						lowerCAmelCase				:			List[int] = [1, 2, 3, 4, 5, 6, 7]						,						lowerCAmelCase				:			bool = True						,						lowerCAmelCase				:			int = 0						,						lowerCAmelCase				:			int = 0						,						lowerCAmelCase				:			int = 0						,						lowerCAmelCase				:			int = 0						,						lowerCAmelCase				:			Optional[List[int]] = None						,						lowerCAmelCase				:			Optional[List[int]] = None						,						lowerCAmelCase				:			int = 64						,						lowerCAmelCase				:			int = 2						,						lowerCAmelCase				:			int = 2						,						lowerCAmelCase				:			int = 2						,						lowerCAmelCase				:			int = 2						,						lowerCAmelCase				:			int = 32						,						lowerCAmelCase				:			int = 32						,						lowerCAmelCase				:			str = "gelu"						,						lowerCAmelCase				:			float = 0.1						,						lowerCAmelCase				:			float = 0.1						,						lowerCAmelCase				:			float = 0.1						,						lowerCAmelCase				:			float = 0.1						,						lowerCAmelCase				:			float = 0.1						,						lowerCAmelCase				:			int = 100						,						lowerCAmelCase				:			float = 0.02						,						lowerCAmelCase				:			bool = True						,						lowerCAmelCase				:			Tuple=True						,						lowerCAmelCase				:			int = 10						,						lowerCAmelCase				:			int = 25						,						lowerCAmelCase				:			int = 3						,						**lowerCAmelCase				:			Tuple						,						):
										# 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(50						,						(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   __lowercase (							self				:			Tuple					):
										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
										)





