





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

			'''simple docstring'''







			lowerCAmelCase_							     =						"""esm"""





			def __init__(    self       ,  __lowerCAmelCase=None       ,  __lowerCAmelCase=None       ,  __lowerCAmelCase=None       ,  __lowerCAmelCase=7_6_8       ,  __lowerCAmelCase=1_2       ,  __lowerCAmelCase=1_2       ,  __lowerCAmelCase=3_0_7_2       ,  __lowerCAmelCase=0.1       ,  __lowerCAmelCase=0.1       ,  __lowerCAmelCase=1_0_2_6       ,  __lowerCAmelCase=0.02       ,  __lowerCAmelCase=1E-12       ,  __lowerCAmelCase="absolute"       ,  __lowerCAmelCase=True       ,  __lowerCAmelCase=None       ,  __lowerCAmelCase=False       ,  __lowerCAmelCase=False       ,  __lowerCAmelCase=None       ,  __lowerCAmelCase=None       ,  **__lowerCAmelCase       ,  ):



				'''simple docstring'''







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

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





			def 		__lowerCamelCase				(    self							):



				'''simple docstring'''







				lowerCamelCase__								=		super().to_dict()
				if isinstance(self.esmfold_config       ,  __lowerCAmelCase							):
					lowerCamelCase__								=		self.esmfold_config.to_dict()
				return output






@dataclass
class 					__A    :

			'''simple docstring'''







			lowerCAmelCase_							     =						None
			lowerCAmelCase_							     =						True
			lowerCAmelCase_							     =						False
			lowerCAmelCase_							     =						False
			lowerCAmelCase_							     =						False
			lowerCAmelCase_							     =						0

			lowerCAmelCase_							     =						True
			lowerCAmelCase_							     =						False

			lowerCAmelCase_							     =						128
			lowerCAmelCase_							     =						None





			def 		__lowerCamelCase				(    self							):



				'''simple docstring'''







				if self.trunk is None:
					lowerCamelCase__								=		TrunkConfig()
				elif isinstance(self.trunk       ,  __lowerCAmelCase							):
					lowerCamelCase__								=		TrunkConfig(**self.trunk							)





			def 		__lowerCamelCase				(    self							):



				'''simple docstring'''







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






@dataclass
class 					__A    :

			'''simple docstring'''







			lowerCAmelCase_							     =						48
			lowerCAmelCase_							     =						1024
			lowerCAmelCase_							     =						128
			lowerCAmelCase_							     =						32
			lowerCAmelCase_							     =						32
			lowerCAmelCase_							     =						32
			lowerCAmelCase_							     =						0
			lowerCAmelCase_							     =						0
			lowerCAmelCase_							     =						False
			lowerCAmelCase_							     =						4
			lowerCAmelCase_							     =						128
			lowerCAmelCase_							     =						None





			def 		__lowerCamelCase				(    self							):



				'''simple docstring'''







				if self.structure_module is None:
					lowerCamelCase__								=		StructureModuleConfig()
				elif isinstance(self.structure_module       ,  __lowerCAmelCase							):
					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 		__lowerCamelCase				(    self							):



				'''simple docstring'''







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






@dataclass
class 					__A    :

			'''simple docstring'''







			lowerCAmelCase_							     =						384
			lowerCAmelCase_							     =						128
			lowerCAmelCase_							     =						16
			lowerCAmelCase_							     =						128
			lowerCAmelCase_							     =						12
			lowerCAmelCase_							     =						4
			lowerCAmelCase_							     =						8
			lowerCAmelCase_							     =						0.1
			lowerCAmelCase_							     =						8
			lowerCAmelCase_							     =						1
			lowerCAmelCase_							     =						2
			lowerCAmelCase_							     =						7
			lowerCAmelCase_							     =						10
			lowerCAmelCase_							     =						1e-8
			lowerCAmelCase_							     =						1e5





			def 		__lowerCamelCase				(    self							):



				'''simple docstring'''







				return asdict(self							)





def lowerCAmelCase__()				->      str:







	'''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_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


_a 						=      {
    "configuration_lxmert": ["LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "LxmertConfig"],
    "tokenization_lxmert": ["LxmertTokenizer"],
}

try:
			if not is_tokenizers_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			_a 						=      ["LxmertTokenizerFast"]

try:
			if not is_torch_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			_a 						=      [
			    "LxmertEncoder",
			    "LxmertForPreTraining",
			    "LxmertForQuestionAnswering",
			    "LxmertModel",
			    "LxmertPreTrainedModel",
			    "LxmertVisualFeatureEncoder",
			    "LxmertXLayer",
			]

try:
			if not is_tf_available():
						raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
			pass
else:
			_a 						=      [
			    "TF_LXMERT_PRETRAINED_MODEL_ARCHIVE_LIST",
			    "TFLxmertForPreTraining",
			    "TFLxmertMainLayer",
			    "TFLxmertModel",
			    "TFLxmertPreTrainedModel",
			    "TFLxmertVisualFeatureEncoder",
			]


if TYPE_CHECKING:
			from .configuration_lxmert import LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP, LxmertConfig
			from .tokenization_lxmert import LxmertTokenizer

			try:
						if not is_tokenizers_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .tokenization_lxmert_fast import LxmertTokenizerFast

			try:
						if not is_torch_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .modeling_lxmert import (
						    LxmertEncoder,
						    LxmertForPreTraining,
						    LxmertForQuestionAnswering,
						    LxmertModel,
						    LxmertPreTrainedModel,
						    LxmertVisualFeatureEncoder,
						    LxmertXLayer,
						)

			try:
						if not is_tf_available():
									raise OptionalDependencyNotAvailable()
			except OptionalDependencyNotAvailable:
						pass
			else:
						from .modeling_tf_lxmert import (
						    TF_LXMERT_PRETRAINED_MODEL_ARCHIVE_LIST,
						    TFLxmertForPreTraining,
						    TFLxmertMainLayer,
						    TFLxmertModel,
						    TFLxmertPreTrainedModel,
						    TFLxmertVisualFeatureEncoder,
						)

else:
			import sys

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



