

from dataclasses import asdict, dataclass
from typing import Optional

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


UpperCAmelCase_							:					Dict		 =   logging.get_logger(__name__)

# TODO Update this
UpperCAmelCase_							:					Union[str, 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      lowerCamelCase_      (	_lowercase	):
	_lowercase		:   int     					=				'''esm'''




	def __init__(     self						:     Dict					,      __A						:     Any=None					,      __A						:     Optional[Any]=None					,      __A						:     Tuple=None					,      __A						:     Any=768					,      __A						:     Optional[Any]=12					,      __A						:     int=12					,      __A						:     Union[str, Any]=3072					,      __A						:     Optional[Any]=0.1					,      __A						:     Dict=0.1					,      __A						:     Union[str, Any]=1026					,      __A						:     Any=0.0_2					,      __A						:     Any=1e-1_2					,      __A						:     str="absolute"					,      __A						:     List[str]=True					,      __A						:     List[Any]=None					,      __A						:     List[str]=False					,      __A						:     Optional[int]=False					,      __A						:     Optional[Any]=None					,      __A						:     str=None					,      **__A						:     Tuple					,      ):
		super().__init__(pad_token_id=__A					,      mask_token_id=__A					,      **__A							)

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






@dataclass
class      lowerCamelCase_      :
	_lowercase		:   str     					=				None
	_lowercase		:   bool     					=				True
	_lowercase		:   bool     					=				False
	_lowercase		:   bool     					=				False
	_lowercase		:   bool     					=				False
	_lowercase		:   float     					=				0

	_lowercase		:   bool     					=				True
	_lowercase		:   bool     					=				False

	_lowercase		:   int     					=				128
	_lowercase		:   "TrunkConfig"     					=				None




	def        lowerCAmelCase_       (     self						:     Optional[Any]							):
		if self.trunk is None:
			__A :			str		    =			TrunkConfig()
		elif isinstance(self.trunk					,      __A							):
			__A :			Union[str, Any]		    =			TrunkConfig(**self.trunk							)




	def        lowerCAmelCase_       (     self						:     Any							):
		__A :			Optional[int]		    =			asdict(self							)
		__A :			Optional[Any]		    =			self.trunk.to_dict()
		return output






@dataclass
class      lowerCamelCase_      :
	_lowercase		:   int     					=				48
	_lowercase		:   int     					=				1024
	_lowercase		:   int     					=				128
	_lowercase		:   int     					=				32
	_lowercase		:   int     					=				32
	_lowercase		:   int     					=				32
	_lowercase		:   float     					=				0
	_lowercase		:   float     					=				0
	_lowercase		:   bool     					=				False
	_lowercase		:   int     					=				4
	_lowercase		:   Optional[int]     					=				128
	_lowercase		:   "StructureModuleConfig"     					=				None




	def        lowerCAmelCase_       (     self						:     int							):
		if self.structure_module is None:
			__A :			Any		    =			StructureModuleConfig()
		elif isinstance(self.structure_module					,      __A							):
			__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 :			int		    =			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        lowerCAmelCase_       (     self						:     int							):
		__A :			Optional[Any]		    =			asdict(self							)
		__A :			Any		    =			self.structure_module.to_dict()
		return output






@dataclass
class      lowerCamelCase_      :
	_lowercase		:   int     					=				384
	_lowercase		:   int     					=				128
	_lowercase		:   int     					=				16
	_lowercase		:   int     					=				128
	_lowercase		:   int     					=				12
	_lowercase		:   int     					=				4
	_lowercase		:   int     					=				8
	_lowercase		:   float     					=				0.1
	_lowercase		:   int     					=				8
	_lowercase		:   int     					=				1
	_lowercase		:   int     					=				2
	_lowercase		:   int     					=				7
	_lowercase		:   int     					=				10
	_lowercase		:   float     					=				1e-8
	_lowercase		:   float     					=				1e5




	def        lowerCAmelCase_       (     self						:     Tuple							):
		return asdict(self							)






def 							__SCREAMING_SNAKE_CASE     (   )					->				Optional[int]:
	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

# rely on isort to merge the imports
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


UpperCAmelCase_							:					int		 =   {
    '''configuration_informer''': [
        '''INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''InformerConfig''',
    ],
}

try:
			if not is_torch_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			UpperCAmelCase_							:					List[str]		 =   [
			    '''INFORMER_PRETRAINED_MODEL_ARCHIVE_LIST''',
			    '''InformerForPrediction''',
			    '''InformerModel''',
			    '''InformerPreTrainedModel''',
			]


if TYPE_CHECKING:
			from .configuration_informer import INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, InformerConfig

			try:
						if not is_torch_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .modeling_informer import (
						    INFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
						    InformerForPrediction,
						    InformerModel,
						    InformerPreTrainedModel,
						)

else:
			import sys

			UpperCAmelCase_							:					Optional[int]		 =   _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)





