



"""simple docstring"""






from typing import List, Optional, Union

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


__snake_case							:   str      =    logging.get_logger(__name__)

__snake_case							:   Dict      =    {
    'huggingface/informer-tourism-monthly': (
        'https://huggingface.co/huggingface/informer-tourism-monthly/resolve/main/config.json'
    ),
    # See all Informer models at https://huggingface.co/models?filter=informer
}



class 			A__   (  __SCREAMING_SNAKE_CASE							):




	'''simple docstring'''





	SCREAMING_SNAKE_CASE          =	'informer'
	SCREAMING_SNAKE_CASE          =	{
	    'hidden_size': 'd_model',
	    'num_attention_heads': 'encoder_attention_heads',
	    'num_hidden_layers': 'encoder_layers',
	}

	def __init__(     self:		Optional[Any]       ,			_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] = None       ,			_SCREAMING_SNAKE_CASE:		Optional[Union[str, bool]] = "mean"       ,			_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 = 64       ,			_SCREAMING_SNAKE_CASE:		int = 32       ,			_SCREAMING_SNAKE_CASE:		int = 32       ,			_SCREAMING_SNAKE_CASE:		int = 2       ,			_SCREAMING_SNAKE_CASE:		int = 2       ,			_SCREAMING_SNAKE_CASE:		int = 2       ,			_SCREAMING_SNAKE_CASE:		int = 2       ,			_SCREAMING_SNAKE_CASE:		bool = True       ,			_SCREAMING_SNAKE_CASE:		str = "gelu"       ,			_SCREAMING_SNAKE_CASE:		float = 0.05       ,			_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 = 100       ,			_SCREAMING_SNAKE_CASE:		float = 0.02       ,			_SCREAMING_SNAKE_CASE:		Optional[Any]=True       ,			_SCREAMING_SNAKE_CASE:		str = "prob"       ,			_SCREAMING_SNAKE_CASE:		int = 5       ,			_SCREAMING_SNAKE_CASE:		bool = True       ,			**_SCREAMING_SNAKE_CASE:		str       ,			)				->       List[Any]:

				"""simple docstring"""

				__lowerCAmelCase      :  Dict												=       prediction_length
				__lowerCAmelCase      :  Optional[Any]												=       context_length or prediction_length
				__lowerCAmelCase      :  Optional[int]												=       distribution_output
				__lowerCAmelCase      :  Any												=       loss
				__lowerCAmelCase      :  str												=       input_size
				__lowerCAmelCase      :  Optional[Any]												=       num_time_features
				__lowerCAmelCase      :  int												=       lags_sequence if lags_sequence is not None else [1, 2, 3, 4, 5, 6, 7]
				__lowerCAmelCase      :  Optional[int]												=       scaling
				__lowerCAmelCase      :  List[Any]												=       num_dynamic_real_features
				__lowerCAmelCase      :  Optional[Any]												=       num_static_real_features
				__lowerCAmelCase      :  Dict												=       num_static_categorical_features

				# set cardinality
				if cardinality and num_static_categorical_features > 0:
							if len(_SCREAMING_SNAKE_CASE) != num_static_categorical_features:
										raise ValueError(
										    "The cardinality should be a list of the same length as `num_static_categorical_features`")
							__lowerCAmelCase      :  Optional[int]												=       cardinality
				else:
							__lowerCAmelCase      :  str												=       [0]

				# set embedding_dimension
				if embedding_dimension and num_static_categorical_features > 0:
							if len(_SCREAMING_SNAKE_CASE) != num_static_categorical_features:
										raise ValueError(
										    "The embedding dimension should be a list of the same length as `num_static_categorical_features`")
							__lowerCAmelCase      :  Tuple												=       embedding_dimension
				else:
							__lowerCAmelCase      :  Optional[int]												=       [min(50       ,			(cat + 1) // 2) for cat in self.cardinality]

				__lowerCAmelCase      :  Union[str, Any]												=       num_parallel_samples

				# Transformer architecture configuration
				__lowerCAmelCase      :  Dict												=       input_size * len(self.lags_sequence) + self._number_of_features
				__lowerCAmelCase      :  Union[str, Any]												=       d_model
				__lowerCAmelCase      :  Any												=       encoder_attention_heads
				__lowerCAmelCase      :  Any												=       decoder_attention_heads
				__lowerCAmelCase      :  Optional[int]												=       encoder_ffn_dim
				__lowerCAmelCase      :  Any												=       decoder_ffn_dim
				__lowerCAmelCase      :  List[Any]												=       encoder_layers
				__lowerCAmelCase      :  Tuple												=       decoder_layers

				__lowerCAmelCase      :  List[str]												=       dropout
				__lowerCAmelCase      :  Optional[int]												=       attention_dropout
				__lowerCAmelCase      :  List[Any]												=       activation_dropout
				__lowerCAmelCase      :  List[Any]												=       encoder_layerdrop
				__lowerCAmelCase      :  Union[str, Any]												=       decoder_layerdrop

				__lowerCAmelCase      :  Any												=       activation_function
				__lowerCAmelCase      :  Any												=       init_std

				__lowerCAmelCase      :  Union[str, Any]												=       use_cache

				# Informer
				__lowerCAmelCase      :  int												=       attention_type
				__lowerCAmelCase      :  Dict												=       sampling_factor
				__lowerCAmelCase      :  List[str]												=       distil

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







	@property
	def 							_SCREAMING_SNAKE_CASE   (     self:		Optional[int])				->       int:

				"""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 ...configuration_utils import PretrainedConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


__snake_case							:   Optional[int]      =    logging.get_logger(__name__)



class 			A__   (  __SCREAMING_SNAKE_CASE  ,		__SCREAMING_SNAKE_CASE							):




	'''simple docstring'''





	SCREAMING_SNAKE_CASE          =	'maskformer-swin'

	SCREAMING_SNAKE_CASE          =	{
	    'num_attention_heads': 'num_heads',
	    'num_hidden_layers': 'num_layers',
	}

	def __init__(     self:		Optional[int]       ,			_SCREAMING_SNAKE_CASE:		int=224       ,			_SCREAMING_SNAKE_CASE:		Tuple=4       ,			_SCREAMING_SNAKE_CASE:		int=3       ,			_SCREAMING_SNAKE_CASE:		List[Any]=96       ,			_SCREAMING_SNAKE_CASE:		Union[str, Any]=[2, 2, 6, 2]       ,			_SCREAMING_SNAKE_CASE:		Any=[3, 6, 12, 24]       ,			_SCREAMING_SNAKE_CASE:		List[str]=7       ,			_SCREAMING_SNAKE_CASE:		List[str]=4.0       ,			_SCREAMING_SNAKE_CASE:		Optional[int]=True       ,			_SCREAMING_SNAKE_CASE:		Tuple=0.0       ,			_SCREAMING_SNAKE_CASE:		Any=0.0       ,			_SCREAMING_SNAKE_CASE:		Any=0.1       ,			_SCREAMING_SNAKE_CASE:		str="gelu"       ,			_SCREAMING_SNAKE_CASE:		Tuple=False       ,			_SCREAMING_SNAKE_CASE:		Union[str, Any]=0.02       ,			_SCREAMING_SNAKE_CASE:		str=1e-5       ,			_SCREAMING_SNAKE_CASE:		Optional[int]=None       ,			_SCREAMING_SNAKE_CASE:		str=None       ,			**_SCREAMING_SNAKE_CASE:		Union[str, Any]       ,			)				->       List[str]:

				"""simple docstring"""

				super().__init__(**_SCREAMING_SNAKE_CASE)

				__lowerCAmelCase      :  int												=       image_size
				__lowerCAmelCase      :  Any												=       patch_size
				__lowerCAmelCase      :  Tuple												=       num_channels
				__lowerCAmelCase      :  Any												=       embed_dim
				__lowerCAmelCase      :  Any												=       depths
				__lowerCAmelCase      :  Dict												=       len(_SCREAMING_SNAKE_CASE)
				__lowerCAmelCase      :  List[Any]												=       num_heads
				__lowerCAmelCase      :  Tuple												=       window_size
				__lowerCAmelCase      :  Dict												=       mlp_ratio
				__lowerCAmelCase      :  Any												=       qkv_bias
				__lowerCAmelCase      :  Union[str, Any]												=       hidden_dropout_prob
				__lowerCAmelCase      :  int												=       attention_probs_dropout_prob
				__lowerCAmelCase      :  Tuple												=       drop_path_rate
				__lowerCAmelCase      :  int												=       hidden_act
				__lowerCAmelCase      :  Optional[int]												=       use_absolute_embeddings
				__lowerCAmelCase      :  List[str]												=       layer_norm_eps
				__lowerCAmelCase      :  Any												=       initializer_range
				# we set the hidden_size attribute in order to make Swin work with VisionEncoderDecoderModel
				# this indicates the channel dimension after the last stage of the model
				__lowerCAmelCase      :  Optional[Any]												=       int(embed_dim * 2 ** (len(_SCREAMING_SNAKE_CASE) - 1))
				__lowerCAmelCase      :  Any												=       ["stem"] + [F"""stage{idx}""" for idx in range(1       ,			len(_SCREAMING_SNAKE_CASE) + 1)]
				__lowerCAmelCase						,	__lowerCAmelCase      :  List[str]												=       get_aligned_output_features_output_indices(
				    out_features=_SCREAMING_SNAKE_CASE       ,			out_indices=_SCREAMING_SNAKE_CASE       ,			stage_names=self.stage_names)