from dataclasses import asdict, dataclass
from typing import Optional

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


__magic_name__    							=							logging.get_logger(__name__)

# TODO Update this
__magic_name__    							=							{
    '''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"""

       __UpperCAmelCase       =					"esm"







       def __init__( self			,		_UpperCAmelCase=None			,		_UpperCAmelCase=None			,		_UpperCAmelCase=None			,		_UpperCAmelCase=768			,		_UpperCAmelCase=12			,		_UpperCAmelCase=12			,		_UpperCAmelCase=3_072			,		_UpperCAmelCase=0.1			,		_UpperCAmelCase=0.1			,		_UpperCAmelCase=1_026			,		_UpperCAmelCase=0.02			,		_UpperCAmelCase=1E-12			,		_UpperCAmelCase="absolute"			,		_UpperCAmelCase=True			,		_UpperCAmelCase=None			,		_UpperCAmelCase=False			,		_UpperCAmelCase=False			,		_UpperCAmelCase=None			,		_UpperCAmelCase=None			,		**_UpperCAmelCase			,		):
          super().__init__(pad_token_id=_lowerCAmelCase			,		mask_token_id=_lowerCAmelCase			,		**_lowerCAmelCase				)

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





@dataclass
class 					__SCREAMING_SNAKE_CASE       :






       """simple docstring"""

       __UpperCAmelCase       =					None
       __UpperCAmelCase       =					True
       __UpperCAmelCase       =					False
       __UpperCAmelCase       =					False
       __UpperCAmelCase       =					False
       __UpperCAmelCase       =					0

       __UpperCAmelCase       =					True
       __UpperCAmelCase       =					False

       __UpperCAmelCase       =					1_2_8
       __UpperCAmelCase       =					None







       def      lowercase_   ( self				):
          if self.trunk is None:
             __snake_case   :			int										=						TrunkConfig()
          elif isinstance(self.trunk			,		_lowerCAmelCase				):
             __snake_case   :			Tuple										=						TrunkConfig(**self.trunk				)







       def      lowercase_   ( self				):
          __snake_case   :			Optional[int]										=						asdict(self				)
          __snake_case   :			Tuple										=						self.trunk.to_dict()
          return output





@dataclass
class 					__SCREAMING_SNAKE_CASE       :






       """simple docstring"""

       __UpperCAmelCase       =					4_8
       __UpperCAmelCase       =					1_0_2_4
       __UpperCAmelCase       =					1_2_8
       __UpperCAmelCase       =					3_2
       __UpperCAmelCase       =					3_2
       __UpperCAmelCase       =					3_2
       __UpperCAmelCase       =					0
       __UpperCAmelCase       =					0
       __UpperCAmelCase       =					False
       __UpperCAmelCase       =					4
       __UpperCAmelCase       =					1_2_8
       __UpperCAmelCase       =					None







       def      lowercase_   ( self				):
          if self.structure_module is None:
             __snake_case   :			int										=						StructureModuleConfig()
          elif isinstance(self.structure_module			,		_lowerCAmelCase				):
             __snake_case   :			Optional[int]										=						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}."""				)

          __snake_case   :			Any										=						self.sequence_state_dim // self.sequence_head_width
          __snake_case   :			Dict										=						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      lowercase_   ( self				):
          __snake_case   :			Tuple										=						asdict(self				)
          __snake_case   :			Optional[Any]										=						self.structure_module.to_dict()
          return output





@dataclass
class 					__SCREAMING_SNAKE_CASE       :






       """simple docstring"""

       __UpperCAmelCase       =					3_8_4
       __UpperCAmelCase       =					1_2_8
       __UpperCAmelCase       =					1_6
       __UpperCAmelCase       =					1_2_8
       __UpperCAmelCase       =					1_2
       __UpperCAmelCase       =					4
       __UpperCAmelCase       =					8
       __UpperCAmelCase       =					0.1
       __UpperCAmelCase       =					8
       __UpperCAmelCase       =					1
       __UpperCAmelCase       =					2
       __UpperCAmelCase       =					7
       __UpperCAmelCase       =					1_0
       __UpperCAmelCase       =					1E-8
       __UpperCAmelCase       =					1E5







       def      lowercase_   ( self				):
          return asdict(self				)






def 							UpperCAmelCase__(					):
   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


_SCREAMING_SNAKE_CASE									=				{
    "configuration_mctct": ["MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP", "MCTCTConfig"],
    "feature_extraction_mctct": ["MCTCTFeatureExtractor"],
    "processing_mctct": ["MCTCTProcessor"],
}


try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       _SCREAMING_SNAKE_CASE									=				[
           "MCTCT_PRETRAINED_MODEL_ARCHIVE_LIST",
           "MCTCTForCTC",
           "MCTCTModel",
           "MCTCTPreTrainedModel",
       ]


if TYPE_CHECKING:
       from .configuration_mctct import MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP, MCTCTConfig
       from .feature_extraction_mctct import MCTCTFeatureExtractor
       from .processing_mctct import MCTCTProcessor

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_mctct import MCTCT_PRETRAINED_MODEL_ARCHIVE_LIST, MCTCTForCTC, MCTCTModel, MCTCTPreTrainedModel

else:
       import sys

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


