


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











from typing import List

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


__UpperCAmelCase								=						logging.get_logger(__name__)

__UpperCAmelCase								=						{
    'snap-research/efficientformer-l1-300': (
        'https://huggingface.co/snap-research/efficientformer-l1-300/resolve/main/config.json'
    ),
}



class   lowerCamelCase      (_snake_case			):







		'''simple docstring'''



		_snake_case    :    Optional[int]       						=  '''efficientformer'''



		def __init__(							self				,		_UpperCamelCase = [3, 2, 6, 4]				,		_UpperCamelCase = [4_8, 9_6, 2_2_4, 4_4_8]				,		_UpperCamelCase = [True, True, True, True]				,		_UpperCamelCase = 4_4_8				,		_UpperCamelCase = 3_2				,		_UpperCamelCase = 4				,		_UpperCamelCase = 7				,		_UpperCamelCase = 5				,		_UpperCamelCase = 8				,		_UpperCamelCase = 4				,		_UpperCamelCase = 0.0				,		_UpperCamelCase = 1_6				,		_UpperCamelCase = 3				,		_UpperCamelCase = 3				,		_UpperCamelCase = 3				,		_UpperCamelCase = 2				,		_UpperCamelCase = 1				,		_UpperCamelCase = 0.0				,		_UpperCamelCase = 1				,		_UpperCamelCase = True				,		_UpperCamelCase = True				,		_UpperCamelCase = 1E-5				,		_UpperCamelCase = "gelu"				,		_UpperCamelCase = 0.02				,		_UpperCamelCase = 1E-12				,		_UpperCamelCase = 2_2_4				,		_UpperCamelCase = 1E-05				,		**_UpperCamelCase				,		)	->							None:
							super().__init__(**_UpperCamelCase   )

							UpperCAmelCase_    :      int            =						hidden_act
							UpperCAmelCase_    :      Union[str, Any]            =						hidden_dropout_prob
							UpperCAmelCase_    :      Tuple            =						hidden_sizes
							UpperCAmelCase_    :      Union[str, Any]            =						num_hidden_layers
							UpperCAmelCase_    :      List[str]            =						num_attention_heads
							UpperCAmelCase_    :      List[Any]            =						initializer_range
							UpperCAmelCase_    :      int            =						layer_norm_eps
							UpperCAmelCase_    :      List[str]            =						patch_size
							UpperCAmelCase_    :      Union[str, Any]            =						num_channels
							UpperCAmelCase_    :      Optional[Any]            =						depths
							UpperCAmelCase_    :      List[Any]            =						mlp_expansion_ratio
							UpperCAmelCase_    :      List[str]            =						downsamples
							UpperCAmelCase_    :      List[Any]            =						dim
							UpperCAmelCase_    :      Tuple            =						key_dim
							UpperCAmelCase_    :      Optional[int]            =						attention_ratio
							UpperCAmelCase_    :      str            =						resolution
							UpperCAmelCase_    :      Dict            =						pool_size
							UpperCAmelCase_    :      Union[str, Any]            =						downsample_patch_size
							UpperCAmelCase_    :      List[str]            =						downsample_stride
							UpperCAmelCase_    :      List[str]            =						downsample_pad
							UpperCAmelCase_    :      Any            =						drop_path_rate
							UpperCAmelCase_    :      Dict            =						num_metaad_blocks
							UpperCAmelCase_    :      Dict            =						distillation
							UpperCAmelCase_    :      int            =						use_layer_scale
							UpperCAmelCase_    :      Any            =						layer_scale_init_value
							UpperCAmelCase_    :      Any            =						image_size
							UpperCAmelCase_    :      Dict            =						batch_norm_eps






