
"""simple docstring"""



from dataclasses import asdict, dataclass
from typing import Optional

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


_snake_case          =						logging.get_logger(__name__)

# TODO Update this
_snake_case          =						{
    '''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  (  UpperCAmelCase							):






				'''simple docstring'''



				SCREAMING_SNAKE_CASE_:							Tuple							=					"esm"


				def __init__(					self	:			Union[str, Any]				,     UpperCAmelCase_	:			str=None				,     UpperCAmelCase_	:			Tuple=None				,     UpperCAmelCase_	:			Optional[Any]=None				,     UpperCAmelCase_	:			str=768				,     UpperCAmelCase_	:			Union[str, Any]=12				,     UpperCAmelCase_	:			Dict=12				,     UpperCAmelCase_	:			int=3_072				,     UpperCAmelCase_	:			Any=0.1				,     UpperCAmelCase_	:			int=0.1				,     UpperCAmelCase_	:			Tuple=1_026				,     UpperCAmelCase_	:			List[str]=0.02				,     UpperCAmelCase_	:			int=1E-1_2				,     UpperCAmelCase_	:			Any="absolute"				,     UpperCAmelCase_	:			Optional[int]=True				,     UpperCAmelCase_	:			Union[str, Any]=None				,     UpperCAmelCase_	:			Tuple=False				,     UpperCAmelCase_	:			Union[str, Any]=False				,     UpperCAmelCase_	:			Dict=None				,     UpperCAmelCase_	:			List[str]=None				,     **UpperCAmelCase_	:			Dict				,     )		->  Union[str, Any]:







											"""simple docstring"""




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

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







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







											"""simple docstring"""




											_lowerCAmelCase  	=			super().to_dict()
											if isinstance(self.esmfold_config				,     UpperCAmelCase_  ):
																		_lowerCAmelCase  	=			self.esmfold_config.to_dict()
											return output






@dataclass
class        _SCREAMING_SNAKE_CASE  :






				'''simple docstring'''



				SCREAMING_SNAKE_CASE_:							str							=					None
				SCREAMING_SNAKE_CASE_:							bool							=					True
				SCREAMING_SNAKE_CASE_:							bool							=					False
				SCREAMING_SNAKE_CASE_:							bool							=					False
				SCREAMING_SNAKE_CASE_:							bool							=					False
				SCREAMING_SNAKE_CASE_:							float							=					0

				SCREAMING_SNAKE_CASE_:							bool							=					True
				SCREAMING_SNAKE_CASE_:							bool							=					False

				SCREAMING_SNAKE_CASE_:							int							=					1_2_8
				SCREAMING_SNAKE_CASE_:							"TrunkConfig"							=					None


				def 				__lowerCamelCase	(					self	:			Tuple  )		->  Any:







											"""simple docstring"""




											if self.trunk is None:
																		_lowerCAmelCase  	=			TrunkConfig()
											elif isinstance(self.trunk				,     UpperCAmelCase_  ):
																		_lowerCAmelCase  	=			TrunkConfig(**self.trunk  )







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







											"""simple docstring"""




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






@dataclass
class        _SCREAMING_SNAKE_CASE  :






				'''simple docstring'''



				SCREAMING_SNAKE_CASE_:							int							=					4_8
				SCREAMING_SNAKE_CASE_:							int							=					1_0_2_4
				SCREAMING_SNAKE_CASE_:							int							=					1_2_8
				SCREAMING_SNAKE_CASE_:							int							=					3_2
				SCREAMING_SNAKE_CASE_:							int							=					3_2
				SCREAMING_SNAKE_CASE_:							int							=					3_2
				SCREAMING_SNAKE_CASE_:							float							=					0
				SCREAMING_SNAKE_CASE_:							float							=					0
				SCREAMING_SNAKE_CASE_:							bool							=					False
				SCREAMING_SNAKE_CASE_:							int							=					4
				SCREAMING_SNAKE_CASE_:							Optional[int]							=					1_2_8
				SCREAMING_SNAKE_CASE_:							"StructureModuleConfig"							=					None


				def 				__lowerCamelCase	(					self	:			Any  )		->  str:







											"""simple docstring"""




											if self.structure_module is None:
																		_lowerCAmelCase  	=			StructureModuleConfig()
											elif isinstance(self.structure_module				,     UpperCAmelCase_  ):
																		_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	:			Union[str, Any]  )		->  List[Any]:







											"""simple docstring"""




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






@dataclass
class        _SCREAMING_SNAKE_CASE  :






				'''simple docstring'''



				SCREAMING_SNAKE_CASE_:							int							=					3_8_4
				SCREAMING_SNAKE_CASE_:							int							=					1_2_8
				SCREAMING_SNAKE_CASE_:							int							=					1_6
				SCREAMING_SNAKE_CASE_:							int							=					1_2_8
				SCREAMING_SNAKE_CASE_:							int							=					1_2
				SCREAMING_SNAKE_CASE_:							int							=					4
				SCREAMING_SNAKE_CASE_:							int							=					8
				SCREAMING_SNAKE_CASE_:							float							=					0.1
				SCREAMING_SNAKE_CASE_:							int							=					8
				SCREAMING_SNAKE_CASE_:							int							=					1
				SCREAMING_SNAKE_CASE_:							int							=					2
				SCREAMING_SNAKE_CASE_:							int							=					7
				SCREAMING_SNAKE_CASE_:							int							=					1_0
				SCREAMING_SNAKE_CASE_:							float							=					1e-8
				SCREAMING_SNAKE_CASE_:							float							=					1e5


				def 				__lowerCamelCase	(					self	:			Optional[int]  )		->  int:







											"""simple docstring"""




											return asdict(self  )






def 	__snake_case  (    ):






							"""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>",
							)








"""simple docstring"""



from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


_snake_case          =						{
    '''configuration_roformer''': ['''ROFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''RoFormerConfig''', '''RoFormerOnnxConfig'''],
    '''tokenization_roformer''': ['''RoFormerTokenizer'''],
}

try:
	if not is_tokenizers_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	_snake_case          =						['''RoFormerTokenizerFast''']

try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	_snake_case          =						[
	    '''ROFORMER_PRETRAINED_MODEL_ARCHIVE_LIST''',
	    '''RoFormerForCausalLM''',
	    '''RoFormerForMaskedLM''',
	    '''RoFormerForMultipleChoice''',
	    '''RoFormerForQuestionAnswering''',
	    '''RoFormerForSequenceClassification''',
	    '''RoFormerForTokenClassification''',
	    '''RoFormerLayer''',
	    '''RoFormerModel''',
	    '''RoFormerPreTrainedModel''',
	    '''load_tf_weights_in_roformer''',
	]


try:
	if not is_tf_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	_snake_case          =						[
	    '''TF_ROFORMER_PRETRAINED_MODEL_ARCHIVE_LIST''',
	    '''TFRoFormerForCausalLM''',
	    '''TFRoFormerForMaskedLM''',
	    '''TFRoFormerForMultipleChoice''',
	    '''TFRoFormerForQuestionAnswering''',
	    '''TFRoFormerForSequenceClassification''',
	    '''TFRoFormerForTokenClassification''',
	    '''TFRoFormerLayer''',
	    '''TFRoFormerModel''',
	    '''TFRoFormerPreTrainedModel''',
	]


try:
	if not is_flax_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	_snake_case          =						[
	    '''FLAX_ROFORMER_PRETRAINED_MODEL_ARCHIVE_LIST''',
	    '''FlaxRoFormerForMaskedLM''',
	    '''FlaxRoFormerForMultipleChoice''',
	    '''FlaxRoFormerForQuestionAnswering''',
	    '''FlaxRoFormerForSequenceClassification''',
	    '''FlaxRoFormerForTokenClassification''',
	    '''FlaxRoFormerModel''',
	    '''FlaxRoFormerPreTrainedModel''',
	]


if TYPE_CHECKING:
	from .configuration_roformer import ROFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, RoFormerConfig, RoFormerOnnxConfig
	from .tokenization_roformer import RoFormerTokenizer

	try:
		if not is_tokenizers_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .tokenization_roformer_fast import RoFormerTokenizerFast

	try:
		if not is_torch_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_roformer import (
		    ROFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
		    RoFormerForCausalLM,
		    RoFormerForMaskedLM,
		    RoFormerForMultipleChoice,
		    RoFormerForQuestionAnswering,
		    RoFormerForSequenceClassification,
		    RoFormerForTokenClassification,
		    RoFormerLayer,
		    RoFormerModel,
		    RoFormerPreTrainedModel,
		    load_tf_weights_in_roformer,
		)

	try:
		if not is_tf_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_tf_roformer import (
		    TF_ROFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
		    TFRoFormerForCausalLM,
		    TFRoFormerForMaskedLM,
		    TFRoFormerForMultipleChoice,
		    TFRoFormerForQuestionAnswering,
		    TFRoFormerForSequenceClassification,
		    TFRoFormerForTokenClassification,
		    TFRoFormerLayer,
		    TFRoFormerModel,
		    TFRoFormerPreTrainedModel,
		)

	try:
		if not is_flax_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_flax_roformer import (
		    FLAX_ROFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
		    FlaxRoFormerForMaskedLM,
		    FlaxRoFormerForMultipleChoice,
		    FlaxRoFormerForQuestionAnswering,
		    FlaxRoFormerForSequenceClassification,
		    FlaxRoFormerForTokenClassification,
		    FlaxRoFormerModel,
		    FlaxRoFormerPreTrainedModel,
		)


else:
	import sys

	_snake_case          =						_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)






