




from dataclasses import asdict, dataclass
from typing import Optional

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


UpperCamelCase__ :   str						=							logging.get_logger(__name__)

# TODO Update this
UpperCamelCase__ :   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_       (					lowerCamelCase_							):
				__a     :       Optional[Any]						=     "esm"






				def __init__(			self      ,snake_case__=None      ,snake_case__=None      ,snake_case__=None      ,snake_case__=768      ,snake_case__=12      ,snake_case__=12      ,snake_case__=3072      ,snake_case__=0.1      ,snake_case__=0.1      ,snake_case__=1026      ,snake_case__=0.02      ,snake_case__=1E-12      ,snake_case__="absolute"      ,snake_case__=True      ,snake_case__=None      ,snake_case__=False      ,snake_case__=False      ,snake_case__=None      ,snake_case__=None      ,**snake_case__      ,):
							super().__init__(pad_token_id=snake_case__      ,mask_token_id=snake_case__      ,**snake_case__ )

							SCREAMING_SNAKE_CASE_   : Union[str, Any]					  =      vocab_size
							SCREAMING_SNAKE_CASE_   : Any					  =      hidden_size
							SCREAMING_SNAKE_CASE_   : Any					  =      num_hidden_layers
							SCREAMING_SNAKE_CASE_   : Any					  =      num_attention_heads
							SCREAMING_SNAKE_CASE_   : int					  =      intermediate_size
							SCREAMING_SNAKE_CASE_   : List[str]					  =      hidden_dropout_prob
							SCREAMING_SNAKE_CASE_   : List[str]					  =      attention_probs_dropout_prob
							SCREAMING_SNAKE_CASE_   : Optional[int]					  =      max_position_embeddings
							SCREAMING_SNAKE_CASE_   : List[str]					  =      initializer_range
							SCREAMING_SNAKE_CASE_   : int					  =      layer_norm_eps
							SCREAMING_SNAKE_CASE_   : Optional[Any]					  =      position_embedding_type
							SCREAMING_SNAKE_CASE_   : Optional[Any]					  =      use_cache
							SCREAMING_SNAKE_CASE_   : str					  =      emb_layer_norm_before
							SCREAMING_SNAKE_CASE_   : Any					  =      token_dropout
							SCREAMING_SNAKE_CASE_   : List[Any]					  =      is_folding_model
							if is_folding_model:
										if esmfold_config is None:
													logger.info('No esmfold_config supplied for folding model, using default values.' )
													SCREAMING_SNAKE_CASE_   : Dict					  =      EsmFoldConfig()
										elif isinstance(snake_case__      ,snake_case__ ):
													SCREAMING_SNAKE_CASE_   : Dict					  =      EsmFoldConfig(**snake_case__ )
										SCREAMING_SNAKE_CASE_   : Any					  =      esmfold_config
										if vocab_list is None:
													logger.warning('No vocab_list supplied for folding model, assuming the ESM-2 vocabulary!' )
													SCREAMING_SNAKE_CASE_   : Tuple					  =      get_default_vocab_list()
										else:
													SCREAMING_SNAKE_CASE_   : Union[str, Any]					  =      vocab_list
							else:
										SCREAMING_SNAKE_CASE_   : str					  =      None
										SCREAMING_SNAKE_CASE_   : str					  =      None
							if self.esmfold_config is not None and getattr(self.esmfold_config      ,'use_esm_attn_map'      ,snake_case__ ):
										raise ValueError('The HuggingFace port of ESMFold does not support use_esm_attn_map at this time!' )






				def 		snake_case	(			self ):
							SCREAMING_SNAKE_CASE_   : List[str]					  =      super().to_dict()
							if isinstance(self.esmfold_config      ,snake_case__ ):
										SCREAMING_SNAKE_CASE_   : int					  =      self.esmfold_config.to_dict()
							return output







@dataclass
class 				lowerCAmelCase_       :
				__a     :       str						=     None
				__a     :       bool						=     True
				__a     :       bool						=     False
				__a     :       bool						=     False
				__a     :       bool						=     False
				__a     :       float						=     0

				__a     :       bool						=     True
				__a     :       bool						=     False

				__a     :       int						=     1_28
				__a     :       "TrunkConfig"						=     None






				def 		snake_case	(			self ):
							if self.trunk is None:
										SCREAMING_SNAKE_CASE_   : List[str]					  =      TrunkConfig()
							elif isinstance(self.trunk      ,snake_case__ ):
										SCREAMING_SNAKE_CASE_   : str					  =      TrunkConfig(**self.trunk )






				def 		snake_case	(			self ):
							SCREAMING_SNAKE_CASE_   : str					  =      asdict(self )
							SCREAMING_SNAKE_CASE_   : str					  =      self.trunk.to_dict()
							return output







@dataclass
class 				lowerCAmelCase_       :
				__a     :       int						=     48
				__a     :       int						=     10_24
				__a     :       int						=     1_28
				__a     :       int						=     32
				__a     :       int						=     32
				__a     :       int						=     32
				__a     :       float						=     0
				__a     :       float						=     0
				__a     :       bool						=     False
				__a     :       int						=     4
				__a     :       Optional[int]						=     1_28
				__a     :       "StructureModuleConfig"						=     None






				def 		snake_case	(			self ):
							if self.structure_module is None:
										SCREAMING_SNAKE_CASE_   : Union[str, Any]					  =      StructureModuleConfig()
							elif isinstance(self.structure_module      ,snake_case__ ):
										SCREAMING_SNAKE_CASE_   : str					  =      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}.' )

							SCREAMING_SNAKE_CASE_   : str					  =      self.sequence_state_dim // self.sequence_head_width
							SCREAMING_SNAKE_CASE_   : List[str]					  =      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 		snake_case	(			self ):
							SCREAMING_SNAKE_CASE_   : Union[str, Any]					  =      asdict(self )
							SCREAMING_SNAKE_CASE_   : Optional[Any]					  =      self.structure_module.to_dict()
							return output







@dataclass
class 				lowerCAmelCase_       :
				__a     :       int						=     3_84
				__a     :       int						=     1_28
				__a     :       int						=     16
				__a     :       int						=     1_28
				__a     :       int						=     12
				__a     :       int						=     4
				__a     :       int						=     8
				__a     :       float						=     0.1
				__a     :       int						=     8
				__a     :       int						=     1
				__a     :       int						=     2
				__a     :       int						=     7
				__a     :       int						=     10
				__a     :       float						=     1E-8
				__a     :       float						=     1E5






				def 		snake_case	(			self ):
							return asdict(self )





def        __UpperCAmelCase						(							)       ->  Tuple:







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


UpperCamelCase__ :   Optional[Any]						=							{
    '''configuration_whisper''': ['''WHISPER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''WhisperConfig''', '''WhisperOnnxConfig'''],
    '''feature_extraction_whisper''': ['''WhisperFeatureExtractor'''],
    '''processing_whisper''': ['''WhisperProcessor'''],
    '''tokenization_whisper''': ['''WhisperTokenizer'''],
}

try:
						if not is_tokenizers_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						UpperCamelCase__ :   str						=							['''WhisperTokenizerFast''']

try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						UpperCamelCase__ :   List[Any]						=							[
						    '''WHISPER_PRETRAINED_MODEL_ARCHIVE_LIST''',
						    '''WhisperForConditionalGeneration''',
						    '''WhisperModel''',
						    '''WhisperPreTrainedModel''',
						    '''WhisperForAudioClassification''',
						]

try:
						if not is_tf_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						UpperCamelCase__ :   Tuple						=							[
						    '''TF_WHISPER_PRETRAINED_MODEL_ARCHIVE_LIST''',
						    '''TFWhisperForConditionalGeneration''',
						    '''TFWhisperModel''',
						    '''TFWhisperPreTrainedModel''',
						]

try:
						if not is_flax_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						UpperCamelCase__ :   List[str]						=							[
						    '''FlaxWhisperForConditionalGeneration''',
						    '''FlaxWhisperModel''',
						    '''FlaxWhisperPreTrainedModel''',
						    '''FlaxWhisperForAudioClassification''',
						]


if TYPE_CHECKING:
						from .configuration_whisper import WHISPER_PRETRAINED_CONFIG_ARCHIVE_MAP, WhisperConfig, WhisperOnnxConfig
						from .feature_extraction_whisper import WhisperFeatureExtractor
						from .processing_whisper import WhisperProcessor
						from .tokenization_whisper import WhisperTokenizer

						try:
												if not is_tokenizers_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .tokenization_whisper_fast import WhisperTokenizerFast

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_whisper import (
												    WHISPER_PRETRAINED_MODEL_ARCHIVE_LIST,
												    WhisperForAudioClassification,
												    WhisperForConditionalGeneration,
												    WhisperModel,
												    WhisperPreTrainedModel,
												)

						try:
												if not is_tf_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_tf_whisper import (
												    TF_WHISPER_PRETRAINED_MODEL_ARCHIVE_LIST,
												    TFWhisperForConditionalGeneration,
												    TFWhisperModel,
												    TFWhisperPreTrainedModel,
												)

						try:
												if not is_flax_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_flax_whisper import (
												    FlaxWhisperForAudioClassification,
												    FlaxWhisperForConditionalGeneration,
												    FlaxWhisperModel,
												    FlaxWhisperPreTrainedModel,
												)

else:
						import sys

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



