



'''simple docstring'''



from dataclasses import asdict, dataclass
from typing import Optional

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


lowerCAmelCase_  :							Any             =    logging.get_logger(__name__)

# TODO Update this
lowerCAmelCase_  :							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 						lowerCamelCase_				(       __UpperCAmelCase      ):
						_lowerCAmelCase  : Tuple						  =					'esm'







						def __init__(	self :   str					,     lowerCAmelCase__ :   Optional[int]=None					,     lowerCAmelCase__ :   Dict=None					,     lowerCAmelCase__ :   Optional[int]=None					,     lowerCAmelCase__ :   Tuple=7_68					,     lowerCAmelCase__ :   Dict=12					,     lowerCAmelCase__ :   int=12					,     lowerCAmelCase__ :   Optional[Any]=30_72					,     lowerCAmelCase__ :   Optional[int]=0.1					,     lowerCAmelCase__ :   List[Any]=0.1					,     lowerCAmelCase__ :   List[Any]=10_26					,     lowerCAmelCase__ :   str=0.02					,     lowerCAmelCase__ :   Optional[int]=1e-12					,     lowerCAmelCase__ :   Optional[Any]="absolute"					,     lowerCAmelCase__ :   Any=True					,     lowerCAmelCase__ :   str=None					,     lowerCAmelCase__ :   str=False					,     lowerCAmelCase__ :   Dict=False					,     lowerCAmelCase__ :   Optional[Any]=None					,     lowerCAmelCase__ :   Tuple=None					,     **lowerCAmelCase__ :   int					,     ):

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

													SCREAMING_SNAKE_CASE       :   str         =      vocab_size
													SCREAMING_SNAKE_CASE       :   Any         =      hidden_size
													SCREAMING_SNAKE_CASE       :   Tuple         =      num_hidden_layers
													SCREAMING_SNAKE_CASE       :   Union[str, Any]         =      num_attention_heads
													SCREAMING_SNAKE_CASE       :   List[Any]         =      intermediate_size
													SCREAMING_SNAKE_CASE       :   int         =      hidden_dropout_prob
													SCREAMING_SNAKE_CASE       :   Union[str, Any]         =      attention_probs_dropout_prob
													SCREAMING_SNAKE_CASE       :   Optional[int]         =      max_position_embeddings
													SCREAMING_SNAKE_CASE       :   Optional[int]         =      initializer_range
													SCREAMING_SNAKE_CASE       :   Union[str, Any]         =      layer_norm_eps
													SCREAMING_SNAKE_CASE       :   Union[str, Any]         =      position_embedding_type
													SCREAMING_SNAKE_CASE       :   Union[str, Any]         =      use_cache
													SCREAMING_SNAKE_CASE       :   Optional[Any]         =      emb_layer_norm_before
													SCREAMING_SNAKE_CASE       :   int         =      token_dropout
													SCREAMING_SNAKE_CASE       :   Tuple         =      is_folding_model
													if is_folding_model:
																				if esmfold_config is None:
																											logger.info('''No esmfold_config supplied for folding model, using default values.'''					)
																											SCREAMING_SNAKE_CASE       :   int         =      EsmFoldConfig()
																				elif isinstance(lowerCAmelCase_					,     lowerCAmelCase_					):
																											SCREAMING_SNAKE_CASE       :   Tuple         =      EsmFoldConfig(**lowerCAmelCase_					)
																				SCREAMING_SNAKE_CASE       :   Optional[int]         =      esmfold_config
																				if vocab_list is None:
																											logger.warning('''No vocab_list supplied for folding model, assuming the ESM-2 vocabulary!'''					)
																											SCREAMING_SNAKE_CASE       :   int         =      get_default_vocab_list()
																				else:
																											SCREAMING_SNAKE_CASE       :   Optional[int]         =      vocab_list
													else:
																				SCREAMING_SNAKE_CASE       :   str         =      None
																				SCREAMING_SNAKE_CASE       :   Any         =      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        __lowercase     (	self :   Dict					):

													"""simple docstring"""
													SCREAMING_SNAKE_CASE       :   Optional[int]         =      super().to_dict()
													if isinstance(self.esmfold_config					,     lowerCAmelCase_					):
																				SCREAMING_SNAKE_CASE       :   str         =      self.esmfold_config.to_dict()
													return output


@dataclass
class 						lowerCamelCase_				:
						_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        __lowercase     (	self :   int					):

													"""simple docstring"""
													if self.trunk is None:
																				SCREAMING_SNAKE_CASE       :   Tuple         =      TrunkConfig()
													elif isinstance(self.trunk					,     lowerCAmelCase_					):
																				SCREAMING_SNAKE_CASE       :   str         =      TrunkConfig(**self.trunk					)







						def        __lowercase     (	self :   int					):

													"""simple docstring"""
													SCREAMING_SNAKE_CASE       :   Union[str, Any]         =      asdict(self					)
													SCREAMING_SNAKE_CASE       :   str         =      self.trunk.to_dict()
													return output


@dataclass
class 						lowerCamelCase_				:
						_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        __lowercase     (	self :   Optional[int]					):

													"""simple docstring"""
													if self.structure_module is None:
																				SCREAMING_SNAKE_CASE       :   str         =      StructureModuleConfig()
													elif isinstance(self.structure_module					,     lowerCAmelCase_					):
																				SCREAMING_SNAKE_CASE       :   Tuple         =      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}."""					)

													SCREAMING_SNAKE_CASE       :   Union[str, Any]         =      self.sequence_state_dim // self.sequence_head_width
													SCREAMING_SNAKE_CASE       :   Any         =      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        __lowercase     (	self :   Union[str, Any]					):

													"""simple docstring"""
													SCREAMING_SNAKE_CASE       :   Optional[int]         =      asdict(self					)
													SCREAMING_SNAKE_CASE       :   List[str]         =      self.structure_module.to_dict()
													return output


@dataclass
class 						lowerCamelCase_				:
						_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        __lowercase     (	self :   List[Any]					):

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


def        UpperCAmelCase (    ):
							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"""
lowerCAmelCase__    						=			'\n# Transformers installation\n! pip install transformers datasets\n# To install from source instead of the last release, comment the command above and uncomment the following one.\n# ! pip install git+https://github.com/huggingface/transformers.git\n'

lowerCAmelCase__    						=			[{'type': 'code', 'content': INSTALL_CONTENT}]
lowerCAmelCase__    						=			{
    '{processor_class}': 'FakeProcessorClass',
    '{model_class}': 'FakeModelClass',
    '{object_class}': 'FakeObjectClass',
}

