




"""simple docstring"""







from dataclasses import asdict, dataclass
from typing import Optional

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


SCREAMING_SNAKE_CASE_	     =       logging.get_logger(__name__)

# TODO Update this
SCREAMING_SNAKE_CASE_	     =       {
    '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 				snake_case_			(					lowerCamelCase_			):







   """simple docstring"""




   A_				      =       '''esm'''







   def __init__(		self       ,					lowerCamelCase_=None       ,					lowerCamelCase_=None       ,					lowerCamelCase_=None       ,					lowerCamelCase_=7_6_8       ,					lowerCamelCase_=1_2       ,					lowerCamelCase_=1_2       ,					lowerCamelCase_=3_0_7_2       ,					lowerCamelCase_=0.1       ,					lowerCamelCase_=0.1       ,					lowerCamelCase_=1_0_2_6       ,					lowerCamelCase_=0.02       ,					lowerCamelCase_=1e-12       ,					lowerCamelCase_="absolute"       ,					lowerCamelCase_=True       ,					lowerCamelCase_=None       ,					lowerCamelCase_=False       ,					lowerCamelCase_=False       ,					lowerCamelCase_=None       ,					lowerCamelCase_=None       ,					**lowerCamelCase_       ,					)				->   Union[str, Any]:
       super().__init__(pad_token_id=lowerCamelCase_       ,					mask_token_id=lowerCamelCase_       ,					**lowerCamelCase_)

       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(lowerCamelCase_       ,					lowerCamelCase_):
               UpperCamelCase              =	EsmFoldConfig(**lowerCamelCase_)
           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'''       ,					lowerCamelCase_):
           raise ValueError('''The HuggingFace port of ESMFold does not support use_esm_attn_map at this time!''')







   def   UpperCAmelCase__			(		self)				->   List[Any]:
       UpperCamelCase              =	super().to_dict()
       if isinstance(self.esmfold_config       ,					lowerCamelCase_):
           UpperCamelCase              =	self.esmfold_config.to_dict()
       return output

@dataclass
class 				snake_case_			:







   """simple docstring"""




   A_				      =       None
   A_				      =       True
   A_				      =       False
   A_				      =       False
   A_				      =       False
   A_				      =       0

   A_				      =       True
   A_				      =       False

   A_				      =       128
   A_				      =       None







   def   UpperCAmelCase__			(		self)				->   Tuple:
       if self.trunk is None:
           UpperCamelCase              =	TrunkConfig()
       elif isinstance(self.trunk       ,					lowerCamelCase_):
           UpperCamelCase              =	TrunkConfig(**self.trunk)







   def   UpperCAmelCase__			(		self)				->   Union[str, Any]:
       UpperCamelCase              =	asdict(self)
       UpperCamelCase              =	self.trunk.to_dict()
       return output

@dataclass
class 				snake_case_			:







   """simple docstring"""




   A_				      =       48
   A_				      =       1_024
   A_				      =       128
   A_				      =       32
   A_				      =       32
   A_				      =       32
   A_				      =       0
   A_				      =       0
   A_				      =       False
   A_				      =       4
   A_				      =       128
   A_				      =       None







   def   UpperCAmelCase__			(		self)				->   Tuple:
       if self.structure_module is None:
           UpperCamelCase              =	StructureModuleConfig()
       elif isinstance(self.structure_module       ,					lowerCamelCase_):
           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   UpperCAmelCase__			(		self)				->   Union[str, Any]:
       UpperCamelCase              =	asdict(self)
       UpperCamelCase              =	self.structure_module.to_dict()
       return output

@dataclass
class 				snake_case_			:







   """simple docstring"""




   A_				      =       384
   A_				      =       128
   A_				      =       16
   A_				      =       128
   A_				      =       12
   A_				      =       4
   A_				      =       8
   A_				      =       0.1
   A_				      =       8
   A_				      =       1
   A_				      =       2
   A_				      =       7
   A_				      =       10
   A_				      =       1E-8
   A_				      =       1E5







   def   UpperCAmelCase__			(		self)				->   Union[str, Any]:
       return asdict(self)





def      __snake_case (				):


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





'''simple docstring'''







def        lowerCamelCase__				(      __lowercase				):
     if not isinstance(__lowercase     ,   __lowercase				):
          snake_case			:      int        =			F'''Input value of [number={number}] must be an integer'''
          raise TypeError(__lowercase				)
     if number < 0:
          return False
     snake_case			:      Optional[int]        =			number * number
     while number > 0:
          if number % 10 != number_square % 10:
               return False
          number //= 10
          number_square //= 10
     return True


if __name__ == "__main__":
      import doctest

      doctest.testmod()



