





'''simple docstring'''






from dataclasses import asdict, dataclass
from typing import Optional

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


lowerCAmelCase									=   logging.get_logger(__name__)

# TODO Update this
lowerCAmelCase									=   {
    """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							):
	snake_case_   = "esm"



	def __init__( self		,   a_=None		,   a_=None		,   a_=None		,   a_=768		,   a_=12		,   a_=12		,   a_=3_072		,   a_=0.1		,   a_=0.1		,   a_=1_026		,   a_=0.02		,   a_=1e-1_2		,   a_="absolute"		,   a_=True		,   a_=None		,   a_=False		,   a_=False		,   a_=None		,   a_=None		,   **a_		,   ):
			super().__init__(pad_token_id=a_		,   mask_token_id=a_		,   **a_						)

			lowerCAmelCase  :     List[str]       						= vocab_size
			lowerCAmelCase  :     Tuple       						= hidden_size
			lowerCAmelCase  :     Optional[Any]       						= num_hidden_layers
			lowerCAmelCase  :     Dict       						= num_attention_heads
			lowerCAmelCase  :     Tuple       						= intermediate_size
			lowerCAmelCase  :     Tuple       						= hidden_dropout_prob
			lowerCAmelCase  :     Tuple       						= attention_probs_dropout_prob
			lowerCAmelCase  :     Tuple       						= max_position_embeddings
			lowerCAmelCase  :     int       						= initializer_range
			lowerCAmelCase  :     Dict       						= layer_norm_eps
			lowerCAmelCase  :     Dict       						= position_embedding_type
			lowerCAmelCase  :     Optional[int]       						= use_cache
			lowerCAmelCase  :     Optional[Any]       						= emb_layer_norm_before
			lowerCAmelCase  :     int       						= token_dropout
			lowerCAmelCase  :     Union[str, Any]       						= 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  :     List[str]       						= EsmFoldConfig()
					elif isinstance(a_		,   a_						):
							lowerCAmelCase  :     str       						= EsmFoldConfig(**a_						)
					lowerCAmelCase  :     int       						= esmfold_config
					if vocab_list is None:
							logger.warning("No vocab_list supplied for folding model, assuming the ESM-2 vocabulary!"						)
							lowerCAmelCase  :     Dict       						= get_default_vocab_list()
					else:
							lowerCAmelCase  :     List[Any]       						= vocab_list
			else:
					lowerCAmelCase  :     Optional[Any]       						= None
					lowerCAmelCase  :     Any       						= None
			if self.esmfold_config is not None and getattr(self.esmfold_config		,   "use_esm_attn_map"		,   a_						):
					raise ValueError("The HuggingFace port of ESMFold does not support use_esm_attn_map at this time!"						)





	def 	_lowerCamelCase     ( self						):
			lowerCAmelCase  :     Optional[int]       						= super().to_dict()
			if isinstance(self.esmfold_config		,   a_						):
					lowerCAmelCase  :     int       						= self.esmfold_config.to_dict()
			return output






@dataclass
class 		lowerCamelCase	:
	snake_case_   = None
	snake_case_   = True
	snake_case_   = False
	snake_case_   = False
	snake_case_   = False
	snake_case_   = 0

	snake_case_   = True
	snake_case_   = False

	snake_case_   = 128
	snake_case_   = None



	def 	_lowerCamelCase     ( self						):
			if self.trunk is None:
					lowerCAmelCase  :     Union[str, Any]       						= TrunkConfig()
			elif isinstance(self.trunk		,   a_						):
					lowerCAmelCase  :     int       						= TrunkConfig(**self.trunk						)





	def 	_lowerCamelCase     ( self						):
			lowerCAmelCase  :     str       						= asdict(self						)
			lowerCAmelCase  :     Union[str, Any]       						= self.trunk.to_dict()
			return output






@dataclass
class 		lowerCamelCase	:
	snake_case_   = 48
	snake_case_   = 1_024
	snake_case_   = 128
	snake_case_   = 32
	snake_case_   = 32
	snake_case_   = 32
	snake_case_   = 0
	snake_case_   = 0
	snake_case_   = False
	snake_case_   = 4
	snake_case_   = 128
	snake_case_   = None



	def 	_lowerCamelCase     ( self						):
			if self.structure_module is None:
					lowerCAmelCase  :     Optional[Any]       						= StructureModuleConfig()
			elif isinstance(self.structure_module		,   a_						):
					lowerCAmelCase  :     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}.'''						)

			lowerCAmelCase  :     Any       						= self.sequence_state_dim // self.sequence_head_width
			lowerCAmelCase  :     str       						= 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 	_lowerCamelCase     ( self						):
			lowerCAmelCase  :     List[str]       						= asdict(self						)
			lowerCAmelCase  :     Union[str, Any]       						= self.structure_module.to_dict()
			return output






@dataclass
class 		lowerCamelCase	:
	snake_case_   = 384
	snake_case_   = 128
	snake_case_   = 16
	snake_case_   = 128
	snake_case_   = 12
	snake_case_   = 4
	snake_case_   = 8
	snake_case_   = 0.1
	snake_case_   = 8
	snake_case_   = 1
	snake_case_   = 2
	snake_case_   = 7
	snake_case_   = 10
	snake_case_   = 1e-8
	snake_case_   = 1e5



	def 	_lowerCamelCase     ( self						):
			return asdict(self						)






def   __A    (				):
		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'''






from __future__ import annotations






def   __A    (				a_    :	float   ,a_    :	float   ,a_    :	float   ,):
		if (electron_conc, hole_conc, intrinsic_conc).count(0						) != 1:
				raise ValueError("You cannot supply more or less than 2 values"						)
		elif electron_conc < 0:
				raise ValueError("Electron concentration cannot be negative in a semiconductor"						)
		elif hole_conc < 0:
				raise ValueError("Hole concentration cannot be negative in a semiconductor"						)
		elif intrinsic_conc < 0:
				raise ValueError(
				    "Intrinsic concentration cannot be negative in a semiconductor"						)
		elif electron_conc == 0:
				return (
				    "electron_conc",
				    intrinsic_conc**2 / hole_conc,
				)
		elif hole_conc == 0:
				return (
				    "hole_conc",
				    intrinsic_conc**2 / electron_conc,
				)
		elif intrinsic_conc == 0:
				return (
				    "intrinsic_conc",
				    (electron_conc * hole_conc) ** 0.5,
				)
		else:
				return (-1, -1)


if __name__ == "__main__":
					import doctest

					doctest.testmod()



