





'''simple docstring'''




import functools
import operator

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


_A							=				logging.get_logger(__name__)

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






class UpperCAmelCase							(		a__							):
    _A :			List[str]						   =       """sew-d"""



    def __init__(  self     ,			__A=32     ,			__A=768     ,			__A=12     ,			__A=12     ,			__A=3_072     ,			__A=2     ,			__A=512     ,			__A=256     ,			__A=True     ,			__A=True     ,			__A=("p2c", "c2p")     ,			__A="layer_norm"     ,			__A="gelu_python"     ,			__A=0.1     ,			__A=0.1     ,			__A=0.1     ,			__A=0.0     ,			__A=0.1     ,			__A=0.0_2     ,			__A=1E-7     ,			__A=1E-5     ,			__A="group"     ,			__A="gelu"     ,			__A=(64, 128, 128, 128, 128, 256, 256, 256, 256, 512, 512, 512, 512)     ,			__A=(5, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1)     ,			__A=(10, 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, 2, 1)     ,			__A=False     ,			__A=128     ,			__A=16     ,			__A=True     ,			__A=0.0_5     ,			__A=10     ,			__A=2     ,			__A=0.0     ,			__A=10     ,			__A=0     ,			__A="mean"     ,			__A=False     ,			__A=False     ,			__A=256     ,			__A=0     ,			__A=1     ,			__A=2     ,			**__A     ,			):
     super().__init__(**_A     ,			pad_token_id=_A     ,			bos_token_id=_A     ,			eos_token_id=_A					)
     __UpperCAmelCase					=   hidden_size
     __UpperCAmelCase					=   feat_extract_norm
     __UpperCAmelCase					=   feat_extract_activation
     __UpperCAmelCase					=   list(_A					)
     __UpperCAmelCase					=   list(_A					)
     __UpperCAmelCase					=   list(_A					)
     __UpperCAmelCase					=   conv_bias
     __UpperCAmelCase					=   num_conv_pos_embeddings
     __UpperCAmelCase					=   num_conv_pos_embedding_groups
     __UpperCAmelCase					=   len(self.conv_dim					)
     __UpperCAmelCase					=   num_hidden_layers
     __UpperCAmelCase					=   intermediate_size
     __UpperCAmelCase					=   squeeze_factor
     __UpperCAmelCase					=   max_position_embeddings
     __UpperCAmelCase					=   position_buckets
     __UpperCAmelCase					=   share_att_key
     __UpperCAmelCase					=   relative_attention
     __UpperCAmelCase					=   norm_rel_ebd
     __UpperCAmelCase					=   list(_A					)
     __UpperCAmelCase					=   hidden_act
     __UpperCAmelCase					=   num_attention_heads
     __UpperCAmelCase					=   hidden_dropout
     __UpperCAmelCase					=   attention_dropout
     __UpperCAmelCase					=   activation_dropout
     __UpperCAmelCase					=   feat_proj_dropout
     __UpperCAmelCase					=   final_dropout
     __UpperCAmelCase					=   layer_norm_eps
     __UpperCAmelCase					=   feature_layer_norm_eps
     __UpperCAmelCase					=   initializer_range
     __UpperCAmelCase					=   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
     __UpperCAmelCase					=   apply_spec_augment
     __UpperCAmelCase					=   mask_time_prob
     __UpperCAmelCase					=   mask_time_length
     __UpperCAmelCase					=   mask_time_min_masks
     __UpperCAmelCase					=   mask_feature_prob
     __UpperCAmelCase					=   mask_feature_length
     __UpperCAmelCase					=   mask_feature_min_masks

     # ctc loss
     __UpperCAmelCase					=   ctc_loss_reduction
     __UpperCAmelCase					=   ctc_zero_infinity

     # sequence classification
     __UpperCAmelCase					=   use_weighted_layer_sum
     __UpperCAmelCase					=   classifier_proj_size




    @property
    def 					__lowerCamelCase						(  self					):
     return functools.reduce(operator.mul     ,			self.conv_stride     ,			1					)












'''simple docstring'''




from typing import List, Optional

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


_A:					str							=				logging.get_logger(__name__)

_A:					Optional[Any]							=				{
    """huggingface/autoformer-tourism-monthly""": """https://huggingface.co/huggingface/autoformer-tourism-monthly/resolve/main/config.json""",
}






class UpperCAmelCase							(		UpperCAmelCase_							):
    _A :			Tuple						   =       """autoformer"""
    _A :			str						   =       {
        """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 = True     ,			__A = 0     ,			__A = 0     ,			__A = 0     ,			__A = 0     ,			__A = None     ,			__A = None     ,			__A = 64     ,			__A = 2     ,			__A = 2     ,			__A = 2     ,			__A = 2     ,			__A = 32     ,			__A = 32     ,			__A = "gelu"     ,			__A = 0.1     ,			__A = 0.1     ,			__A = 0.1     ,			__A = 0.1     ,			__A = 0.1     ,			__A = 100     ,			__A = 0.0_2     ,			__A = True     ,			__A=True     ,			__A = 10     ,			__A = 25     ,			__A = 3     ,			**__A     ,			):
     # time series specific configuration
     __UpperCAmelCase					=   prediction_length
     __UpperCAmelCase					=   context_length if context_length is not None else prediction_length
     __UpperCAmelCase					=   distribution_output
     __UpperCAmelCase					=   loss
     __UpperCAmelCase					=   input_size
     __UpperCAmelCase					=   num_time_features
     __UpperCAmelCase					=   lags_sequence
     __UpperCAmelCase					=   scaling
     __UpperCAmelCase					=   num_dynamic_real_features
     __UpperCAmelCase					=   num_static_real_features
     __UpperCAmelCase					=   num_static_categorical_features
     if cardinality is not None 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`'					)
      __UpperCAmelCase					=   cardinality
     else:
      __UpperCAmelCase					=   [0]
     if embedding_dimension is not None 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`'					)
      __UpperCAmelCase					=   embedding_dimension
     else:
      __UpperCAmelCase					=   [min(50     ,			(cat + 1) // 2					) for cat in self.cardinality]
     __UpperCAmelCase					=   num_parallel_samples

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

     __UpperCAmelCase					=   dropout
     __UpperCAmelCase					=   attention_dropout
     __UpperCAmelCase					=   activation_dropout
     __UpperCAmelCase					=   encoder_layerdrop
     __UpperCAmelCase					=   decoder_layerdrop

     __UpperCAmelCase					=   activation_function
     __UpperCAmelCase					=   init_std

     __UpperCAmelCase					=   use_cache

     # Autoformer
     __UpperCAmelCase					=   label_length
     __UpperCAmelCase					=   moving_average
     __UpperCAmelCase					=   autocorrelation_factor

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




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





