"""simple docstring"""







from typing import List, Optional, Union

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


__SCREAMING_SNAKE_CASE    	=logging.get_logger(__name__)

__SCREAMING_SNAKE_CASE    	={
    "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        UpperCamelCase		(			__a  ):
   lowercase							=  'informer'
   lowercase							=  {
       'hidden_size': 'd_model',
       'num_attention_heads': 'encoder_attention_heads',
       'num_hidden_layers': 'encoder_layers',
   }
   def __init__(			self     ,__UpperCamelCase = None     ,__UpperCamelCase = None     ,__UpperCamelCase = "student_t"     ,__UpperCamelCase = "nll"     ,__UpperCamelCase = 1     ,__UpperCamelCase = None     ,__UpperCamelCase = "mean"     ,__UpperCamelCase = 0     ,__UpperCamelCase = 0     ,__UpperCamelCase = 0     ,__UpperCamelCase = 0     ,__UpperCamelCase = None     ,__UpperCamelCase = None     ,__UpperCamelCase = 64     ,__UpperCamelCase = 32     ,__UpperCamelCase = 32     ,__UpperCamelCase = 2     ,__UpperCamelCase = 2     ,__UpperCamelCase = 2     ,__UpperCamelCase = 2     ,__UpperCamelCase = True     ,__UpperCamelCase = "gelu"     ,__UpperCamelCase = 0.05     ,__UpperCamelCase = 0.1     ,__UpperCamelCase = 0.1     ,__UpperCamelCase = 0.1     ,__UpperCamelCase = 0.1     ,__UpperCamelCase = 100     ,__UpperCamelCase = 0.02     ,__UpperCamelCase=True     ,__UpperCamelCase = "prob"     ,__UpperCamelCase = 5     ,__UpperCamelCase = True     ,**__UpperCamelCase     ,)	->      List[str]:


        '''simple docstring'''


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

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

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

        lowercase_	:				Optional[Any]													=	num_parallel_samples

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

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

        lowercase_	:				List[str]													=	activation_function
        lowercase_	:				Optional[Any]													=	init_std

        lowercase_	:				List[Any]													=	use_cache

        # Informer
        lowercase_	:				Tuple													=	attention_type
        lowercase_	:				Union[str, Any]													=	sampling_factor
        lowercase_	:				str													=	distil

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







   @property
   def 			_UpperCAmelCase   (			self			)	->      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
        )



import functools
import operator

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


_A   =     logging.get_logger(__name__)

_A   =     {
    "asapp/sew-tiny-100k": "https://huggingface.co/asapp/sew-tiny-100k/resolve/main/config.json",
    # See all SEW models at https://huggingface.co/models?filter=sew
}





class 	_lowerCAmelCase					(	__a       ):
				_lowercase					='''sew'''




				def __init__(					self				,				_UpperCamelCase=32				,				_UpperCamelCase=768				,				_UpperCamelCase=12				,				_UpperCamelCase=12				,				_UpperCamelCase=3_072				,				_UpperCamelCase=2				,				_UpperCamelCase="gelu"				,				_UpperCamelCase=0.1				,				_UpperCamelCase=0.1				,				_UpperCamelCase=0.1				,				_UpperCamelCase=0.0				,				_UpperCamelCase=0.1				,				_UpperCamelCase=0.1				,				_UpperCamelCase=0.02				,				_UpperCamelCase=1e-5				,				_UpperCamelCase="group"				,				_UpperCamelCase="gelu"				,				_UpperCamelCase=(64, 128, 128, 128, 128, 256, 256, 256, 256, 512, 512, 512, 512)				,				_UpperCamelCase=(5, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1)				,				_UpperCamelCase=(10, 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, 2, 1)				,				_UpperCamelCase=False				,				_UpperCamelCase=128				,				_UpperCamelCase=16				,				_UpperCamelCase=True				,				_UpperCamelCase=0.05				,				_UpperCamelCase=10				,				_UpperCamelCase=2				,				_UpperCamelCase=0.0				,				_UpperCamelCase=10				,				_UpperCamelCase=0				,				_UpperCamelCase="mean"				,				_UpperCamelCase=False				,				_UpperCamelCase=False				,				_UpperCamelCase=256				,				_UpperCamelCase=0				,				_UpperCamelCase=1				,				_UpperCamelCase=2				,				**_UpperCamelCase				,				)				->      Union[str, Any]:
							super().__init__(**_UpperCamelCase				,				pad_token_id=_UpperCamelCase				,				bos_token_id=_UpperCamelCase				,				eos_token_id=_UpperCamelCase     )
							lowerCAmelCase_						=	hidden_size
							lowerCAmelCase_						=	feat_extract_norm
							lowerCAmelCase_						=	feat_extract_activation
							lowerCAmelCase_						=	list(_UpperCamelCase     )
							lowerCAmelCase_						=	list(_UpperCamelCase     )
							lowerCAmelCase_						=	list(_UpperCamelCase     )
							lowerCAmelCase_						=	conv_bias
							lowerCAmelCase_						=	num_conv_pos_embeddings
							lowerCAmelCase_						=	num_conv_pos_embedding_groups
							lowerCAmelCase_						=	len(self.conv_dim     )
							lowerCAmelCase_						=	num_hidden_layers
							lowerCAmelCase_						=	intermediate_size
							lowerCAmelCase_						=	squeeze_factor
							lowerCAmelCase_						=	hidden_act
							lowerCAmelCase_						=	num_attention_heads
							lowerCAmelCase_						=	hidden_dropout
							lowerCAmelCase_						=	attention_dropout
							lowerCAmelCase_						=	activation_dropout
							lowerCAmelCase_						=	feat_proj_dropout
							lowerCAmelCase_						=	final_dropout
							lowerCAmelCase_						=	layerdrop
							lowerCAmelCase_						=	layer_norm_eps
							lowerCAmelCase_						=	initializer_range
							lowerCAmelCase_						=	vocab_size

							if (
							    (len(self.conv_stride     ) != self.num_feat_extract_layers)
							    or (len(self.conv_kernel     ) != self.num_feat_extract_layers)
							    or (len(self.conv_dim     ) != self.num_feat_extract_layers)
							):
										raise ValueError(
										    "Configuration for convolutional layers is incorrect."
										    "It is required that `len(config.conv_dim)` == `len(config.conv_stride)` == `len(config.conv_kernel)`,"
										    f"""but is `len(config.conv_dim) = {len(self.conv_dim     )}`, `len(config.conv_stride)"""
										    f"""= {len(self.conv_stride     )}`, `len(config.conv_kernel) = {len(self.conv_kernel     )}`."""     )

							# fine-tuning config parameters for SpecAugment: https://arxiv.org/abs/1904.08779
							lowerCAmelCase_						=	apply_spec_augment
							lowerCAmelCase_						=	mask_time_prob
							lowerCAmelCase_						=	mask_time_length
							lowerCAmelCase_						=	mask_time_min_masks
							lowerCAmelCase_						=	mask_feature_prob
							lowerCAmelCase_						=	mask_feature_length
							lowerCAmelCase_						=	mask_feature_min_masks

							# ctc loss
							lowerCAmelCase_						=	ctc_loss_reduction
							lowerCAmelCase_						=	ctc_zero_infinity

							# sequence classification
							lowerCAmelCase_						=	use_weighted_layer_sum
							lowerCAmelCase_						=	classifier_proj_size




				@property
				def      __a						(					self     )				->      Optional[Any]:
							return functools.reduce(operator.mul				,				self.conv_stride				,				1     )



