
'''simple docstring'''

from dataclasses import asdict, dataclass
from typing import Optional

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


UpperCamelCase_   	=				logging.get_logger(__name__)

# TODO Update this
UpperCamelCase_   	=				{
    """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      a_     (_a			):
       __lowerCAmelCase			: List[Any]			=					'''esm'''




       def __init__(   self      ,      snake_case_=None      ,      snake_case_=None      ,      snake_case_=None      ,      snake_case_=7_6_8      ,      snake_case_=1_2      ,      snake_case_=1_2      ,      snake_case_=3_0_7_2      ,      snake_case_=0.1      ,      snake_case_=0.1      ,      snake_case_=1_0_2_6      ,      snake_case_=0.02      ,      snake_case_=1E-12      ,      snake_case_="absolute"      ,      snake_case_=True      ,      snake_case_=None      ,      snake_case_=False      ,      snake_case_=False      ,      snake_case_=None      ,      snake_case_=None      ,      **snake_case_      ,      ):
         super().__init__(pad_token_id=SCREAMING_SNAKE_CASE__      ,      mask_token_id=SCREAMING_SNAKE_CASE__      ,      **SCREAMING_SNAKE_CASE__     )

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







       def 							__UpperCamelCase				(   self     ):
         _lowerCAmelCase				:     int       =    super().to_dict()
         if isinstance(self.esmfold_config      ,      SCREAMING_SNAKE_CASE__     ):
           _lowerCAmelCase				:     int       =    self.esmfold_config.to_dict()
         return output



@dataclass
class      a_     :
       __lowerCAmelCase			: str			=					None
       __lowerCAmelCase			: bool			=					True
       __lowerCAmelCase			: bool			=					False
       __lowerCAmelCase			: bool			=					False
       __lowerCAmelCase			: bool			=					False
       __lowerCAmelCase			: float			=					0

       __lowerCAmelCase			: bool			=					True
       __lowerCAmelCase			: bool			=					False

       __lowerCAmelCase			: int			=					1_2_8
       __lowerCAmelCase			: "TrunkConfig"			=					None




       def 							__UpperCamelCase				(   self     ):






         if self.trunk is None:
           _lowerCAmelCase				:     Optional[Any]       =    TrunkConfig()
         elif isinstance(self.trunk      ,      SCREAMING_SNAKE_CASE__     ):
           _lowerCAmelCase				:     Tuple       =    TrunkConfig(**self.trunk     )







       def 							__UpperCamelCase				(   self     ):
         _lowerCAmelCase				:     Optional[int]       =    asdict(self     )
         _lowerCAmelCase				:     int       =    self.trunk.to_dict()
         return output



@dataclass
class      a_     :
       __lowerCAmelCase			: int			=					4_8
       __lowerCAmelCase			: int			=					1_0_2_4
       __lowerCAmelCase			: int			=					1_2_8
       __lowerCAmelCase			: int			=					3_2
       __lowerCAmelCase			: int			=					3_2
       __lowerCAmelCase			: int			=					3_2
       __lowerCAmelCase			: float			=					0
       __lowerCAmelCase			: float			=					0
       __lowerCAmelCase			: bool			=					False
       __lowerCAmelCase			: int			=					4
       __lowerCAmelCase			: Optional[int]			=					1_2_8
       __lowerCAmelCase			: "StructureModuleConfig"			=					None




       def 							__UpperCamelCase				(   self     ):






         if self.structure_module is None:
           _lowerCAmelCase				:     Optional[int]       =    StructureModuleConfig()
         elif isinstance(self.structure_module      ,      SCREAMING_SNAKE_CASE__     ):
           _lowerCAmelCase				:     Dict       =    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}.'     )

         _lowerCAmelCase				:     Optional[Any]       =    self.sequence_state_dim // self.sequence_head_width
         _lowerCAmelCase				:     str       =    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 							__UpperCamelCase				(   self     ):
         _lowerCAmelCase				:     Any       =    asdict(self     )
         _lowerCAmelCase				:     Optional[int]       =    self.structure_module.to_dict()
         return output



@dataclass
class      a_     :
       __lowerCAmelCase			: int			=					3_8_4
       __lowerCAmelCase			: int			=					1_2_8
       __lowerCAmelCase			: int			=					1_6
       __lowerCAmelCase			: int			=					1_2_8
       __lowerCAmelCase			: int			=					1_2
       __lowerCAmelCase			: int			=					4
       __lowerCAmelCase			: int			=					8
       __lowerCAmelCase			: float			=					0.1
       __lowerCAmelCase			: int			=					8
       __lowerCAmelCase			: int			=					1
       __lowerCAmelCase			: int			=					2
       __lowerCAmelCase			: int			=					7
       __lowerCAmelCase			: int			=					1_0
       __lowerCAmelCase			: float			=					1E-8
       __lowerCAmelCase			: float			=					1E5




       def 							__UpperCamelCase				(   self     ):
         return asdict(self     )



def 		_UpperCAmelCase (     )			->  Any:
  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"""
def      __lowerCamelCase   (							a_     :		int ,   a_     :		str							)			->      Optional[int]:
      __SCREAMING_SNAKE_CASE   :Optional[int]						=  [1]
      for i in range(2 ,   a_							):
            factorials.append(factorials[-1] * i							)
      assert 0 <= k < factorials[-1] * n, "k out of bounds"

      __SCREAMING_SNAKE_CASE   :List[str]						=  []
      __SCREAMING_SNAKE_CASE   :Optional[Any]						=  list(range(a_							)							)

      # Find permutation
      while factorials:
            __SCREAMING_SNAKE_CASE   :Optional[int]						=  factorials.pop()
            __SCREAMING_SNAKE_CASE				,__SCREAMING_SNAKE_CASE   :Dict						=  divmod(a_ ,   a_							)
            permutation.append(elements[number]							)
            elements.remove(elements[number]							)
      permutation.append(elements[0]							)

      return permutation


if __name__ == "__main__":
  import doctest

  doctest.testmod()