


'''simple docstring'''

from dataclasses import asdict, dataclass
from typing import Optional

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


a_  :				str						= logging.get_logger(__name__)

# TODO Update this
a_  :				List[str]						= {
    """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    (    lowercase			):





  """simple docstring"""




  _lowerCamelCase		    =  "esm"






  def __init__(    self			,  UpperCamelCase=None			,  UpperCamelCase=None			,  UpperCamelCase=None			,  UpperCamelCase=768			,  UpperCamelCase=12			,  UpperCamelCase=12			,  UpperCamelCase=3072			,  UpperCamelCase=0.1			,  UpperCamelCase=0.1			,  UpperCamelCase=1026			,  UpperCamelCase=0.02			,  UpperCamelCase=1e-12			,  UpperCamelCase="absolute"			,  UpperCamelCase=True			,  UpperCamelCase=None			,  UpperCamelCase=False			,  UpperCamelCase=False			,  UpperCamelCase=None			,  UpperCamelCase=None			,  **UpperCamelCase			,  ):







   """simple docstring"""
   super().__init__(pad_token_id=UpperCamelCase			,  mask_token_id=UpperCamelCase			,  **UpperCamelCase     )

   lowerCamelCase_      =  vocab_size
   lowerCamelCase_      =  hidden_size
   lowerCamelCase_      =  num_hidden_layers
   lowerCamelCase_      =  num_attention_heads
   lowerCamelCase_      =  intermediate_size
   lowerCamelCase_      =  hidden_dropout_prob
   lowerCamelCase_      =  attention_probs_dropout_prob
   lowerCamelCase_      =  max_position_embeddings
   lowerCamelCase_      =  initializer_range
   lowerCamelCase_      =  layer_norm_eps
   lowerCamelCase_      =  position_embedding_type
   lowerCamelCase_      =  use_cache
   lowerCamelCase_      =  emb_layer_norm_before
   lowerCamelCase_      =  token_dropout
   lowerCamelCase_      =  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_      =  EsmFoldConfig()
    elif isinstance(UpperCamelCase			,  UpperCamelCase     ):
     lowerCamelCase_      =  EsmFoldConfig(**UpperCamelCase     )
    lowerCamelCase_      =  esmfold_config
    if vocab_list is None:
     logger.warning("No vocab_list supplied for folding model, assuming the ESM-2 vocabulary!"     )
     lowerCamelCase_      =  get_default_vocab_list()
    else:
     lowerCamelCase_      =  vocab_list
   else:
    lowerCamelCase_      =  None
    lowerCamelCase_      =  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   snake_case		(    self     ):







   """simple docstring"""
   lowerCamelCase_      =  super().to_dict()
   if isinstance(self.esmfold_config			,  UpperCamelCase     ):
    lowerCamelCase_      =  self.esmfold_config.to_dict()
   return output





@dataclass
class      snake_case    :





  """simple docstring"""




  _lowerCamelCase		    =  None
  _lowerCamelCase		    =  True
  _lowerCamelCase		    =  False
  _lowerCamelCase		    =  False
  _lowerCamelCase		    =  False
  _lowerCamelCase		    =  0

  _lowerCamelCase		    =  True
  _lowerCamelCase		    =  False

  _lowerCamelCase		    =  1_28
  _lowerCamelCase		    =  None






  def   snake_case		(    self     ):







   """simple docstring"""
   if self.trunk is None:
    lowerCamelCase_      =  TrunkConfig()
   elif isinstance(self.trunk			,  UpperCamelCase     ):
    lowerCamelCase_      =  TrunkConfig(**self.trunk     )







  def   snake_case		(    self     ):







   """simple docstring"""
   lowerCamelCase_      =  asdict(self     )
   lowerCamelCase_      =  self.trunk.to_dict()
   return output





@dataclass
class      snake_case    :





  """simple docstring"""




  _lowerCamelCase		    =  48
  _lowerCamelCase		    =  10_24
  _lowerCamelCase		    =  1_28
  _lowerCamelCase		    =  32
  _lowerCamelCase		    =  32
  _lowerCamelCase		    =  32
  _lowerCamelCase		    =  0
  _lowerCamelCase		    =  0
  _lowerCamelCase		    =  False
  _lowerCamelCase		    =  4
  _lowerCamelCase		    =  1_28
  _lowerCamelCase		    =  None






  def   snake_case		(    self     ):







   """simple docstring"""
   if self.structure_module is None:
    lowerCamelCase_      =  StructureModuleConfig()
   elif isinstance(self.structure_module			,  UpperCamelCase     ):
    lowerCamelCase_      =  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_      =  self.sequence_state_dim // self.sequence_head_width
   lowerCamelCase_      =  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   snake_case		(    self     ):







   """simple docstring"""
   lowerCamelCase_      =  asdict(self     )
   lowerCamelCase_      =  self.structure_module.to_dict()
   return output





@dataclass
class      snake_case    :





  """simple docstring"""




  _lowerCamelCase		    =  3_84
  _lowerCamelCase		    =  1_28
  _lowerCamelCase		    =  16
  _lowerCamelCase		    =  1_28
  _lowerCamelCase		    =  12
  _lowerCamelCase		    =  4
  _lowerCamelCase		    =  8
  _lowerCamelCase		    =  0.1
  _lowerCamelCase		    =  8
  _lowerCamelCase		    =  1
  _lowerCamelCase		    =  2
  _lowerCamelCase		    =  7
  _lowerCamelCase		    =  10
  _lowerCamelCase		    =  1e-8
  _lowerCamelCase		    =  1e5






  def   snake_case		(    self     ):







   """simple docstring"""
   return asdict(self     )





def __snake_case					(      ):
 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>",
 )










def A_	(		A__		,      A__				)  ->		str:
       if a < 0 or b < 0:
              raise ValueError('the value of both inputs must be positive'				)

       a__						:	List[str] =				str(bin(A__				)				)[2:]  # remove the leading "0b"
       a__						:	Optional[int] =				str(bin(A__				)				)[2:]  # remove the leading "0b"

       a__						:	List[str] =				max(len(A__				)		,      len(A__				)				)

       return "0b" + "".join(
           str(int(char_a == '1' and char_b == '1'				)				)
           for char_a, char_b in zip(a_binary.zfill(A__				)		,      b_binary.zfill(A__				)				)				)


if __name__ == "__main__":
    import doctest

    doctest.testmod()


