





'''simple docstring'''




from dataclasses import asdict, dataclass
from typing import Optional

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


_A							=				logging.get_logger(__name__)

# TODO Update this
_A							=				{
    """facebook/esm-1b""": """https://huggingface.co/facebook/esm-1b/resolve/main/config.json""",
    # See all ESM models at https://huggingface.co/models?filter=esm
}






class UpperCAmelCase							(		UpperCAmelCase_							):
    _A :			Tuple						   =       """esm"""



    def __init__(  self     ,			__A=None     ,			__A=None     ,			__A=None     ,			__A=768     ,			__A=12     ,			__A=12     ,			__A=3_072     ,			__A=0.1     ,			__A=0.1     ,			__A=1_026     ,			__A=0.0_2     ,			__A=1E-12     ,			__A="absolute"     ,			__A=True     ,			__A=None     ,			__A=False     ,			__A=False     ,			__A=None     ,			__A=None     ,			**__A     ,			):
     super().__init__(pad_token_id=lowercase_     ,			mask_token_id=lowercase_     ,			**lowercase_					)

     __UpperCAmelCase					=   vocab_size
     __UpperCAmelCase					=   hidden_size
     __UpperCAmelCase					=   num_hidden_layers
     __UpperCAmelCase					=   num_attention_heads
     __UpperCAmelCase					=   intermediate_size
     __UpperCAmelCase					=   hidden_dropout_prob
     __UpperCAmelCase					=   attention_probs_dropout_prob
     __UpperCAmelCase					=   max_position_embeddings
     __UpperCAmelCase					=   initializer_range
     __UpperCAmelCase					=   layer_norm_eps
     __UpperCAmelCase					=   position_embedding_type
     __UpperCAmelCase					=   use_cache
     __UpperCAmelCase					=   emb_layer_norm_before
     __UpperCAmelCase					=   token_dropout
     __UpperCAmelCase					=   is_folding_model
     if is_folding_model:
      if esmfold_config is None:
       logger.info('No esmfold_config supplied for folding model, using default values.'					)
       __UpperCAmelCase					=   EsmFoldConfig()
      elif isinstance(lowercase_     ,			lowercase_					):
       __UpperCAmelCase					=   EsmFoldConfig(**lowercase_					)
      __UpperCAmelCase					=   esmfold_config
      if vocab_list is None:
       logger.warning('No vocab_list supplied for folding model, assuming the ESM-2 vocabulary!'					)
       __UpperCAmelCase					=   get_default_vocab_list()
      else:
       __UpperCAmelCase					=   vocab_list
     else:
      __UpperCAmelCase					=   None
      __UpperCAmelCase					=   None
     if self.esmfold_config is not None and getattr(self.esmfold_config     ,			'use_esm_attn_map'     ,			lowercase_					):
      raise ValueError('The HuggingFace port of ESMFold does not support use_esm_attn_map at this time!'					)




    def 					__lowerCamelCase						(  self					):
     __UpperCAmelCase					=   super().to_dict()
     if isinstance(self.esmfold_config     ,			lowercase_					):
      __UpperCAmelCase					=   self.esmfold_config.to_dict()
     return output






@dataclass
class UpperCAmelCase							:
    _A :			Union[str, Any]						   =       None
    _A :			List[Any]						   =       True
    _A :			Union[str, Any]						   =       False
    _A :			str						   =       False
    _A :			List[Any]						   =       False
    _A :			Any						   =       0

    _A :			Any						   =       True
    _A :			Tuple						   =       False

    _A :			str						   =       128
    _A :			Union[str, Any]						   =       None



    def 					__lowerCamelCase						(  self					):







     if self.trunk is None:
      __UpperCAmelCase					=   TrunkConfig()
     elif isinstance(self.trunk     ,			lowercase_					):
      __UpperCAmelCase					=   TrunkConfig(**self.trunk					)




    def 					__lowerCamelCase						(  self					):
     __UpperCAmelCase					=   asdict(self					)
     __UpperCAmelCase					=   self.trunk.to_dict()
     return output






@dataclass
class UpperCAmelCase							:
    _A :			List[Any]						   =       48
    _A :			Tuple						   =       1_024
    _A :			Union[str, Any]						   =       128
    _A :			List[Any]						   =       32
    _A :			List[str]						   =       32
    _A :			Any						   =       32
    _A :			Optional[int]						   =       0
    _A :			Tuple						   =       0
    _A :			Union[str, Any]						   =       False
    _A :			Any						   =       4
    _A :			Optional[Any]						   =       128
    _A :			str						   =       None



    def 					__lowerCamelCase						(  self					):







     if self.structure_module is None:
      __UpperCAmelCase					=   StructureModuleConfig()
     elif isinstance(self.structure_module     ,			lowercase_					):
      __UpperCAmelCase					=   StructureModuleConfig(**self.structure_module					)

     if self.max_recycles <= 0:
      raise ValueError(f'`max_recycles` should be positive, got {self.max_recycles}.'					)
     if self.sequence_state_dim % self.sequence_state_dim != 0:
      raise ValueError(
          '`sequence_state_dim` should be a round multiple of `sequence_state_dim`, got'
          f' {self.sequence_state_dim} and {self.sequence_state_dim}.'					)
     if self.pairwise_state_dim % self.pairwise_state_dim != 0:
      raise ValueError(
          '`pairwise_state_dim` should be a round multiple of `pairwise_state_dim`, got'
          f' {self.pairwise_state_dim} and {self.pairwise_state_dim}.'					)

     __UpperCAmelCase					=   self.sequence_state_dim // self.sequence_head_width
     __UpperCAmelCase					=   self.pairwise_state_dim // self.pairwise_head_width

     if self.sequence_state_dim != sequence_num_heads * self.sequence_head_width:
      raise ValueError(
          '`sequence_state_dim` should be equal to `sequence_num_heads * sequence_head_width, got'
          f' {self.sequence_state_dim} != {sequence_num_heads} * {self.sequence_head_width}.'					)
     if self.pairwise_state_dim != pairwise_num_heads * self.pairwise_head_width:
      raise ValueError(
          '`pairwise_state_dim` should be equal to `pairwise_num_heads * pairwise_head_width, got'
          f' {self.pairwise_state_dim} != {pairwise_num_heads} * {self.pairwise_head_width}.'					)
     if self.pairwise_state_dim % 2 != 0:
      raise ValueError(f'`pairwise_state_dim` should be even, got {self.pairwise_state_dim}.'					)

     if self.dropout >= 0.4:
      raise ValueError(f'`dropout` should not be greater than 0.4, got {self.dropout}.'					)




    def 					__lowerCamelCase						(  self					):
     __UpperCAmelCase					=   asdict(self					)
     __UpperCAmelCase					=   self.structure_module.to_dict()
     return output






@dataclass
class UpperCAmelCase							:
    _A :			Any						   =       384
    _A :			int						   =       128
    _A :			Any						   =       16
    _A :			str						   =       128
    _A :			Any						   =       12
    _A :			Tuple						   =       4
    _A :			Optional[Any]						   =       8
    _A :			Dict						   =       0.1
    _A :			List[Any]						   =       8
    _A :			Dict						   =       1
    _A :			int						   =       2
    _A :			List[Any]						   =       7
    _A :			Tuple						   =       10
    _A :			Optional[int]						   =       1e-8
    _A :			Optional[Any]						   =       1e5



    def 					__lowerCamelCase						(  self					):
     return asdict(self					)







def _lowerCAmelCase     (      )->     Dict:
 return (
     "<cls>",
     "<pad>",
     "<eos>",
     "<unk>",
     "L",
     "A",
     "G",
     "V",
     "S",
     "E",
     "R",
     "T",
     "I",
     "D",
     "P",
     "K",
     "Q",
     "N",
     "F",
     "Y",
     "M",
     "H",
     "W",
     "C",
     "X",
     "B",
     "U",
     "Z",
     "O",
     ".",
     "-",
     "<null_1>",
     "<mask>",
 )












'''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
     )





