
"""simple docstring"""


# Lint as: python3
import dataclasses
import re
from dataclasses import dataclass
from functools import total_ordering
from typing import Optional, Union


_lowercase							      = re.compile(r'''^(?P<major>\d+)''' r'''\.(?P<minor>\d+)''' r'''\.(?P<patch>\d+)$''')







@total_ordering
@dataclass
class  lowerCAmelCase_ :



						'''simple docstring'''


						_lowerCamelCase:			str
						_lowerCamelCase:			Optional[str]					=			None
						_lowerCamelCase:			Optional[Union[str, int]]					=			None
						_lowerCamelCase:			Optional[Union[str, int]]					=			None
						_lowerCamelCase:			Optional[Union[str, int]]					=			None


						def   _SCREAMING_SNAKE_CASE					(       self   :					List[str]					)   ->      List[str]:
							A      ,					A      ,					A        =      _str_to_version_tuple(self.version_str					)


						def __repr__(       self   :					Optional[int]					)   ->      Dict:
							return F'{self.tuple[0]}.{self.tuple[1]}.{self.tuple[2]}'


						@property
						def   _SCREAMING_SNAKE_CASE					(       self   :					Optional[int]					)   ->      int:
							return self.major, self.minor, self.patch


						def   _SCREAMING_SNAKE_CASE					(       self   :					Optional[int]     ,A_   :					Tuple					)   ->      Union[str, Any]:
							if isinstance(A_     ,A_					):
								return Version(A_					)
							elif isinstance(A_     ,A_					):
								return other
							raise TypeError(F'{other} (type {type(A_					)}) cannot be compared to version.'					)


						def __eq__(       self   :					List[Any]     ,A_   :					Dict					)   ->      Any:
							try:
								A        =      self._validate_operand(A_					)
							except (TypeError, ValueError):
								return False
							else:
								return self.tuple == other.tuple


						def __lt__(       self   :					List[Any]     ,A_   :					Optional[int]					)   ->      Tuple:
							A        =      self._validate_operand(A_					)
							return self.tuple < other.tuple


						def __hash__(       self   :					Union[str, Any]					)   ->      Union[str, Any]:
							return hash(_version_tuple_to_str(self.tuple					)					)


						@classmethod
						def   _SCREAMING_SNAKE_CASE					(       cls   :					Any     ,A_   :					List[str]					)   ->      List[str]:
							A        =      {f.name for f in dataclasses.fields(cls					)}
							return cls(**{k: v for k, v in dic.items() if k in field_names}					)




						def   _SCREAMING_SNAKE_CASE					(       self   :					Optional[int]					)   ->      str:
							return self.version_str






def 					_snake_case (						snake_case__      :   List[str]   ):
	A        =      _VERSION_REG.match(snake_case__   )
	if not res:
		raise ValueError(F'Invalid version \'{version_str}\'. Format should be x.y.z with {{x,y,z}} being digits.'   )
	return tuple(int(snake_case__   ) for v in [res.group('major'   ), res.group('minor'   ), res.group('patch'   )]   )






def 					_snake_case (						snake_case__      :   str   ):
	return ".".join(str(snake_case__   ) for v in version_tuple   )



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       lowerCamelCase__   (       lowerCAmelCase):
     SCREAMING_SNAKE_CASE__      			=			'''esm'''





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

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





     def      __A					(self       )     ->   List[str]:
      _lowercase							      =super().to_dict()
      if isinstance(self.esmfold_config		,     UpperCAmelCase       ):
       _lowercase							      =self.esmfold_config.to_dict()
      return output







@dataclass
class       lowerCamelCase__   :
     SCREAMING_SNAKE_CASE__      			=			None
     SCREAMING_SNAKE_CASE__      			=			True
     SCREAMING_SNAKE_CASE__      			=			False
     SCREAMING_SNAKE_CASE__      			=			False
     SCREAMING_SNAKE_CASE__      			=			False
     SCREAMING_SNAKE_CASE__      			=			0

     SCREAMING_SNAKE_CASE__      			=			True
     SCREAMING_SNAKE_CASE__      			=			False

     SCREAMING_SNAKE_CASE__      			=			128
     SCREAMING_SNAKE_CASE__      			=			None





     def      __A					(self       )     ->   Union[str, Any]:
      if self.trunk is None:
       _lowercase							      =TrunkConfig()
      elif isinstance(self.trunk		,     UpperCAmelCase       ):
       _lowercase							      =TrunkConfig(**self.trunk       )





     def      __A					(self       )     ->   Tuple:
      _lowercase							      =asdict(self       )
      _lowercase							      =self.trunk.to_dict()
      return output







@dataclass
class       lowerCamelCase__   :
     SCREAMING_SNAKE_CASE__      			=			48
     SCREAMING_SNAKE_CASE__      			=			1024
     SCREAMING_SNAKE_CASE__      			=			128
     SCREAMING_SNAKE_CASE__      			=			32
     SCREAMING_SNAKE_CASE__      			=			32
     SCREAMING_SNAKE_CASE__      			=			32
     SCREAMING_SNAKE_CASE__      			=			0
     SCREAMING_SNAKE_CASE__      			=			0
     SCREAMING_SNAKE_CASE__      			=			False
     SCREAMING_SNAKE_CASE__      			=			4
     SCREAMING_SNAKE_CASE__      			=			128
     SCREAMING_SNAKE_CASE__      			=			None





     def      __A					(self       )     ->   List[str]:
      if self.structure_module is None:
       _lowercase							      =StructureModuleConfig()
      elif isinstance(self.structure_module		,     UpperCAmelCase       ):
       _lowercase							      =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}."       )

      _lowercase							      =self.sequence_state_dim // self.sequence_head_width
      _lowercase							      =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      __A					(self       )     ->   Dict:
      _lowercase							      =asdict(self       )
      _lowercase							      =self.structure_module.to_dict()
      return output







@dataclass
class       lowerCamelCase__   :
     SCREAMING_SNAKE_CASE__      			=			384
     SCREAMING_SNAKE_CASE__      			=			128
     SCREAMING_SNAKE_CASE__      			=			16
     SCREAMING_SNAKE_CASE__      			=			128
     SCREAMING_SNAKE_CASE__      			=			12
     SCREAMING_SNAKE_CASE__      			=			4
     SCREAMING_SNAKE_CASE__      			=			8
     SCREAMING_SNAKE_CASE__      			=			0.1
     SCREAMING_SNAKE_CASE__      			=			8
     SCREAMING_SNAKE_CASE__      			=			1
     SCREAMING_SNAKE_CASE__      			=			2
     SCREAMING_SNAKE_CASE__      			=			7
     SCREAMING_SNAKE_CASE__      			=			10
     SCREAMING_SNAKE_CASE__      			=			1E-8
     SCREAMING_SNAKE_CASE__      			=			1E5





     def      __A					(self       )     ->   List[Any]:
      return asdict(self       )



def 				UpperCAmelCase_					(							)     ->			Tuple:







 """simple docstring"""


 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>",
 )

