
from dataclasses import asdict, dataclass
from typing import Optional

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


__snake_case    :    Optional[int]         =     logging.get_logger(__name__)

# TODO Update this
__snake_case    :    List[Any]         =     {
    '''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     __SCREAMING_SNAKE_CASE					(   SCREAMING_SNAKE_CASE__):
						_SCREAMING_SNAKE_CASE	:       int   =					'''esm'''






						def __init__(	self     ,						_UpperCamelCase=None     ,						_UpperCamelCase=None     ,						_UpperCamelCase=None     ,						_UpperCamelCase=7_68     ,						_UpperCamelCase=12     ,						_UpperCamelCase=12     ,						_UpperCamelCase=30_72     ,						_UpperCamelCase=0.1     ,						_UpperCamelCase=0.1     ,						_UpperCamelCase=10_26     ,						_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=_lowercase     ,						mask_token_id=_lowercase     ,						**_lowercase   )

												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(_lowercase     ,						_lowercase   ):
																								lowerCAmelCase__    						=						EsmFoldConfig(**_lowercase   )
																		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'     ,						_lowercase   ):
																		raise ValueError('The HuggingFace port of ESMFold does not support use_esm_attn_map at this time!'   )







						def       UpperCamelCase__      (	self   ):






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




@dataclass
class     __SCREAMING_SNAKE_CASE					:
						_SCREAMING_SNAKE_CASE	:       Dict   =					None
						_SCREAMING_SNAKE_CASE	:       Tuple   =					True
						_SCREAMING_SNAKE_CASE	:       List[str]   =					False
						_SCREAMING_SNAKE_CASE	:       Any   =					False
						_SCREAMING_SNAKE_CASE	:       List[str]   =					False
						_SCREAMING_SNAKE_CASE	:       Union[str, Any]   =					0

						_SCREAMING_SNAKE_CASE	:       Dict   =					True
						_SCREAMING_SNAKE_CASE	:       List[str]   =					False

						_SCREAMING_SNAKE_CASE	:       List[Any]   =					128
						_SCREAMING_SNAKE_CASE	:       List[Any]   =					None






						def       UpperCamelCase__      (	self   ):






												"""simple docstring"""

												if self.trunk is None:
																		lowerCAmelCase__    						=						TrunkConfig()
												elif isinstance(self.trunk     ,						_lowercase   ):
																		lowerCAmelCase__    						=						TrunkConfig(**self.trunk   )







						def       UpperCamelCase__      (	self   ):






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




@dataclass
class     __SCREAMING_SNAKE_CASE					:
						_SCREAMING_SNAKE_CASE	:       Dict   =					48
						_SCREAMING_SNAKE_CASE	:       int   =					1024
						_SCREAMING_SNAKE_CASE	:       Dict   =					128
						_SCREAMING_SNAKE_CASE	:       List[str]   =					32
						_SCREAMING_SNAKE_CASE	:       List[str]   =					32
						_SCREAMING_SNAKE_CASE	:       Any   =					32
						_SCREAMING_SNAKE_CASE	:       Tuple   =					0
						_SCREAMING_SNAKE_CASE	:       List[str]   =					0
						_SCREAMING_SNAKE_CASE	:       int   =					False
						_SCREAMING_SNAKE_CASE	:       str   =					4
						_SCREAMING_SNAKE_CASE	:       Tuple   =					128
						_SCREAMING_SNAKE_CASE	:       int   =					None






						def       UpperCamelCase__      (	self   ):






												"""simple docstring"""

												if self.structure_module is None:
																		lowerCAmelCase__    						=						StructureModuleConfig()
												elif isinstance(self.structure_module     ,						_lowercase   ):
																		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       UpperCamelCase__      (	self   ):






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




@dataclass
class     __SCREAMING_SNAKE_CASE					:
						_SCREAMING_SNAKE_CASE	:       int   =					384
						_SCREAMING_SNAKE_CASE	:       Tuple   =					128
						_SCREAMING_SNAKE_CASE	:       Tuple   =					16
						_SCREAMING_SNAKE_CASE	:       Tuple   =					128
						_SCREAMING_SNAKE_CASE	:       Tuple   =					12
						_SCREAMING_SNAKE_CASE	:       str   =					4
						_SCREAMING_SNAKE_CASE	:       Optional[Any]   =					8
						_SCREAMING_SNAKE_CASE	:       Any   =					0.1
						_SCREAMING_SNAKE_CASE	:       Any   =					8
						_SCREAMING_SNAKE_CASE	:       Tuple   =					1
						_SCREAMING_SNAKE_CASE	:       Tuple   =					2
						_SCREAMING_SNAKE_CASE	:       Dict   =					7
						_SCREAMING_SNAKE_CASE	:       Optional[Any]   =					10
						_SCREAMING_SNAKE_CASE	:       Any   =					1E-8
						_SCREAMING_SNAKE_CASE	:       int   =					1E5






						def       UpperCamelCase__      (	self   ):






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







def 	_UpperCamelCase   (    )  ->   Any:

						"""simple docstring"""



						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 TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available


__snake_case    :    Dict         =     {"""configuration_speech_encoder_decoder""": ["""SpeechEncoderDecoderConfig"""]}

try:
					if not is_torch_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					__snake_case    :    Union[str, Any]         =     ["""SpeechEncoderDecoderModel"""]

try:
					if not is_flax_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					__snake_case    :    str         =     ["""FlaxSpeechEncoderDecoderModel"""]

if TYPE_CHECKING:
					from .configuration_speech_encoder_decoder import SpeechEncoderDecoderConfig

					try:
										if not is_torch_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_speech_encoder_decoder import SpeechEncoderDecoderModel

					try:
										if not is_flax_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_flax_speech_encoder_decoder import FlaxSpeechEncoderDecoderModel

else:
					import sys

					__snake_case    :    Tuple         =     _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)





