


"""simple docstring"""


from dataclasses import asdict, dataclass
from typing import Optional

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


a_       							=    logging.get_logger(__name__)

# TODO Update this
a_       							=    {
    "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 snake_case      (  _UpperCamelCase):
		__UpperCamelCase           =			'esm'







		def __init__(					self      :       Optional[Any]    ,   a__      :       List[Any]=None    ,   a__      :       int=None    ,   a__      :       List[Any]=None    ,   a__      :       Optional[int]=7_68    ,   a__      :       str=12    ,   a__      :       str=12    ,   a__      :       str=30_72    ,   a__      :       List[str]=0.1    ,   a__      :       Tuple=0.1    ,   a__      :       List[Any]=10_26    ,   a__      :       Any=0.0_2    ,   a__      :       Any=1E-1_2    ,   a__      :       List[str]="absolute"    ,   a__      :       Optional[Any]=True    ,   a__      :       Union[str, Any]=None    ,   a__      :       Dict=False    ,   a__      :       Dict=False    ,   a__      :       Any=None    ,   a__      :       str=None    ,   **a__      :       Optional[int]    ,   )       ->						int:





						'''simple docstring'''







						super().__init__(pad_token_id=a__    ,   mask_token_id=a__    ,   **a__		)

						_A					  =			vocab_size
						_A					  =			hidden_size
						_A					  =			num_hidden_layers
						_A					  =			num_attention_heads
						_A					  =			intermediate_size
						_A					  =			hidden_dropout_prob
						_A					  =			attention_probs_dropout_prob
						_A					  =			max_position_embeddings
						_A					  =			initializer_range
						_A					  =			layer_norm_eps
						_A					  =			position_embedding_type
						_A					  =			use_cache
						_A					  =			emb_layer_norm_before
						_A					  =			token_dropout
						_A					  =			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					  =			EsmFoldConfig()
										elif isinstance(a__    ,   a__		):
														_A					  =			EsmFoldConfig(**a__		)
										_A					  =			esmfold_config
										if vocab_list is None:
														logger.warning("No vocab_list supplied for folding model, assuming the ESM-2 vocabulary!"		)
														_A					  =			get_default_vocab_list()
										else:
														_A					  =			vocab_list
						else:
										_A					  =			None
										_A					  =			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  a_ (					self      :       int		)       ->						int:





						'''simple docstring'''







						_A					  =			super().to_dict()
						if isinstance(self.esmfold_config    ,   a__		):
										_A					  =			self.esmfold_config.to_dict()
						return output





@dataclass
class snake_case      :
		__UpperCamelCase           =			None
		__UpperCamelCase           =			True
		__UpperCamelCase           =			False
		__UpperCamelCase           =			False
		__UpperCamelCase           =			False
		__UpperCamelCase           =			0

		__UpperCamelCase           =			True
		__UpperCamelCase           =			False

		__UpperCamelCase           =			128
		__UpperCamelCase           =			None







		def  a_ (					self      :       str		)       ->						Optional[int]:





						'''simple docstring'''







						if self.trunk is None:
										_A					  =			TrunkConfig()
						elif isinstance(self.trunk    ,   a__		):
										_A					  =			TrunkConfig(**self.trunk		)







		def  a_ (					self      :       List[str]		)       ->						Optional[Any]:





						'''simple docstring'''







						_A					  =			asdict(self		)
						_A					  =			self.trunk.to_dict()
						return output





@dataclass
class snake_case      :
		__UpperCamelCase           =			48
		__UpperCamelCase           =			1024
		__UpperCamelCase           =			128
		__UpperCamelCase           =			32
		__UpperCamelCase           =			32
		__UpperCamelCase           =			32
		__UpperCamelCase           =			0
		__UpperCamelCase           =			0
		__UpperCamelCase           =			False
		__UpperCamelCase           =			4
		__UpperCamelCase           =			128
		__UpperCamelCase           =			None







		def  a_ (					self      :       str		)       ->						Union[str, Any]:





						'''simple docstring'''







						if self.structure_module is None:
										_A					  =			StructureModuleConfig()
						elif isinstance(self.structure_module    ,   a__		):
										_A					  =			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					  =			self.sequence_state_dim // self.sequence_head_width
						_A					  =			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  a_ (					self      :       List[Any]		)       ->						Optional[Any]:





						'''simple docstring'''







						_A					  =			asdict(self		)
						_A					  =			self.structure_module.to_dict()
						return output





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







		def  a_ (					self      :       List[Any]		)       ->						List[Any]:





						'''simple docstring'''







						return asdict(self		)






def      a__ (				)	->	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>",
				)



"""simple docstring"""


from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


a_       							=    {
    "configuration_upernet": ["UperNetConfig"],
}

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		a_       							=    [
		    "UperNetForSemanticSegmentation",
		    "UperNetPreTrainedModel",
		]


if TYPE_CHECKING:
		from .configuration_upernet import UperNetConfig

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_upernet import UperNetForSemanticSegmentation, UperNetPreTrainedModel


else:
		import sys

		a_       							=    _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)