



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 	lowerCamelCase_    ( _A						):






						'''simple docstring'''
						a__   =  "esm"







						def __init__(	self      :			Optional[Any]	,	__lowerCamelCase      :			str=None	,	__lowerCamelCase      :			Any=None	,	__lowerCamelCase      :			Optional[Any]=None	,	__lowerCamelCase      :			Any=7_68	,	__lowerCamelCase      :			Tuple=12	,	__lowerCamelCase      :			int=12	,	__lowerCamelCase      :			Any=30_72	,	__lowerCamelCase      :			str=0.1	,	__lowerCamelCase      :			Optional[int]=0.1	,	__lowerCamelCase      :			List[str]=10_26	,	__lowerCamelCase      :			List[Any]=0.02	,	__lowerCamelCase      :			Union[str, Any]=1e-12	,	__lowerCamelCase      :			Optional[Any]="absolute"	,	__lowerCamelCase      :			str=True	,	__lowerCamelCase      :			List[str]=None	,	__lowerCamelCase      :			List[str]=False	,	__lowerCamelCase      :			Union[str, Any]=False	,	__lowerCamelCase      :			Union[str, Any]=None	,	__lowerCamelCase      :			int=None	,	**__lowerCamelCase      :			List[str]	,	)      ->				Any:
									super().__init__(pad_token_id=__lowerCamelCase	,	mask_token_id=__lowerCamelCase	,	**__lowerCamelCase )

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







@dataclass
class 	lowerCamelCase_    :






						'''simple docstring'''
						a__   =  None
						a__   =  True
						a__   =  False
						a__   =  False
						a__   =  False
						a__   =  0

						a__   =  True
						a__   =  False

						a__   =  128
						a__   =  None







						def 			SCREAMING_SNAKE_CASE__		(	self      :			List[str] )      ->				Optional[Any]:
									if self.trunk is None:
												A							:					Dict              =						TrunkConfig()
									elif isinstance(self.trunk	,	__lowerCamelCase ):
												A							:					str              =						TrunkConfig(**self.trunk )







						def 			SCREAMING_SNAKE_CASE__		(	self      :			str )      ->				str:
									A							:					int              =						asdict(self )
									A							:					Dict              =						self.trunk.to_dict()
									return output







@dataclass
class 	lowerCamelCase_    :






						'''simple docstring'''
						a__   =  48
						a__   =  1024
						a__   =  128
						a__   =  32
						a__   =  32
						a__   =  32
						a__   =  0
						a__   =  0
						a__   =  False
						a__   =  4
						a__   =  128
						a__   =  None







						def 			SCREAMING_SNAKE_CASE__		(	self      :			Dict )      ->				Union[str, Any]:
									if self.structure_module is None:
												A							:					Optional[int]              =						StructureModuleConfig()
									elif isinstance(self.structure_module	,	__lowerCamelCase ):
												A							:					Optional[Any]              =						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}.""" )

									A							:					List[str]              =						self.sequence_state_dim // self.sequence_head_width
									A							:					Optional[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 			SCREAMING_SNAKE_CASE__		(	self      :			Tuple )      ->				int:
									A							:					Any              =						asdict(self )
									A							:					int              =						self.structure_module.to_dict()
									return output







@dataclass
class 	lowerCamelCase_    :






						'''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 			SCREAMING_SNAKE_CASE__		(	self      :			Optional[Any] )      ->				str:
									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>",
			)




from __future__ import annotations

from math import pi

# Define the Reduced Planck Constant ℏ (H bar), speed of light C, value of
# Pi and the function
__SCREAMING_SNAKE_CASE           =  1.0_5_4_5_7_1_8_1_7e-3_4  # unit of ℏ : J * s

__SCREAMING_SNAKE_CASE           =  3e8  # unit of c : m * s^-1




def 	UpperCAmelCase   (						_lowerCamelCase ,    _lowerCamelCase ,    _lowerCamelCase    ):

			if (force, area, distance).count(0    ) != 1:
						raise ValueError("One and only one argument must be 0"    )
			if force < 0:
						raise ValueError("Magnitude of force can not be negative"    )
			if distance < 0:
						raise ValueError("Distance can not be negative"    )
			if area < 0:
						raise ValueError("Area can not be negative"    )
			if force == 0:
						A							:					int              =						(REDUCED_PLANCK_CONSTANT * SPEED_OF_LIGHT * pi**2 * area) / (
						    240 * (distance) ** 4
						)
						return {"force": force}
			elif area == 0:
						A							:					Tuple              =						(240 * force * (distance) ** 4) / (
						    REDUCED_PLANCK_CONSTANT * SPEED_OF_LIGHT * pi**2
						)
						return {"area": area}
			elif distance == 0:
						A							:					Dict              =						(
						    (REDUCED_PLANCK_CONSTANT * SPEED_OF_LIGHT * pi**2 * area) / (240 * force)
						) ** (1 / 4)
						return {"distance": distance}
			raise ValueError("One and only one argument must be 0"    )


# Run doctest
if __name__ == "__main__":
							import doctest

							doctest.testmod()