




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  _lowerCamelCase						(			SCREAMING_SNAKE_CASE_   ):

      """simple docstring"""

      lowerCAmelCase__			: Optional[int]    =					"esm"







      def __init__(     self					: List[str] ,       snake_case					: List[str]=None ,       snake_case					: Dict=None ,       snake_case					: Optional[Any]=None ,       snake_case					: Union[str, Any]=768 ,       snake_case					: Any=12 ,       snake_case					: Tuple=12 ,       snake_case					: Optional[Any]=3072 ,       snake_case					: Union[str, Any]=0.1 ,       snake_case					: Optional[Any]=0.1 ,       snake_case					: Optional[int]=1026 ,       snake_case					: str=0.02 ,       snake_case					: str=1E-12 ,       snake_case					: Any="absolute" ,       snake_case					: List[Any]=True ,       snake_case					: Tuple=None ,       snake_case					: str=False ,       snake_case					: Optional[Any]=False ,       snake_case					: Optional[int]=None ,       snake_case					: Union[str, Any]=None ,       **snake_case					: List[str] ,       ):
          super().__init__(pad_token_id=UpperCamelCase__ ,       mask_token_id=UpperCamelCase__ ,       **UpperCamelCase__				)

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







@dataclass
class  _lowerCamelCase						:

      """simple docstring"""

      lowerCAmelCase__			: Dict    =					None
      lowerCAmelCase__			: Any    =					True
      lowerCAmelCase__			: Any    =					False
      lowerCAmelCase__			: int    =					False
      lowerCAmelCase__			: Optional[Any]    =					False
      lowerCAmelCase__			: str    =					0

      lowerCAmelCase__			: Union[str, Any]    =					True
      lowerCAmelCase__			: int    =					False

      lowerCAmelCase__			: Dict    =					1_28
      lowerCAmelCase__			: List[Any]    =					None







      def       snake_case	(     self					: Tuple				):
          if self.trunk is None:
              __UpperCamelCase  		=						TrunkConfig()
          elif isinstance(self.trunk ,       UpperCamelCase__				):
              __UpperCamelCase  		=						TrunkConfig(**self.trunk				)







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







@dataclass
class  _lowerCamelCase						:

      """simple docstring"""

      lowerCAmelCase__			: str    =					48
      lowerCAmelCase__			: int    =					10_24
      lowerCAmelCase__			: List[Any]    =					1_28
      lowerCAmelCase__			: List[str]    =					32
      lowerCAmelCase__			: List[Any]    =					32
      lowerCAmelCase__			: Optional[int]    =					32
      lowerCAmelCase__			: Optional[int]    =					0
      lowerCAmelCase__			: List[Any]    =					0
      lowerCAmelCase__			: str    =					False
      lowerCAmelCase__			: Optional[int]    =					4
      lowerCAmelCase__			: Union[str, Any]    =					1_28
      lowerCAmelCase__			: int    =					None







      def       snake_case	(     self					: List[str]				):
          if self.structure_module is None:
              __UpperCamelCase  		=						StructureModuleConfig()
          elif isinstance(self.structure_module ,       UpperCamelCase__				):
              __UpperCamelCase  		=						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}."				)

          __UpperCamelCase  		=						self.sequence_state_dim // self.sequence_head_width
          __UpperCamelCase  		=						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					: int				):
          __UpperCamelCase  		=						asdict(self				)
          __UpperCamelCase  		=						self.structure_module.to_dict()
          return output







@dataclass
class  _lowerCamelCase						:

      """simple docstring"""

      lowerCAmelCase__			: Tuple    =					3_84
      lowerCAmelCase__			: Any    =					1_28
      lowerCAmelCase__			: Union[str, Any]    =					16
      lowerCAmelCase__			: Tuple    =					1_28
      lowerCAmelCase__			: Union[str, Any]    =					12
      lowerCAmelCase__			: Tuple    =					4
      lowerCAmelCase__			: Any    =					8
      lowerCAmelCase__			: List[Any]    =					0.1
      lowerCAmelCase__			: Union[str, Any]    =					8
      lowerCAmelCase__			: Optional[Any]    =					1
      lowerCAmelCase__			: Optional[Any]    =					2
      lowerCAmelCase__			: Dict    =					7
      lowerCAmelCase__			: Union[str, Any]    =					10
      lowerCAmelCase__			: str    =					1E-8
      lowerCAmelCase__			: int    =					1E5







      def       snake_case	(     self					: Optional[Any]				):
          return asdict(self				)







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

    """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 ....configuration_utils import PretrainedConfig
from ....utils import logging


a_   		=     logging.get_logger(__name__)

a_   		=     {
    "speechbrain/m-ctc-t-large": "https://huggingface.co/speechbrain/m-ctc-t-large/resolve/main/config.json",
    # See all M-CTC-T models at https://huggingface.co/models?filter=mctct
}

class  _lowerCamelCase						(			_SCREAMING_SNAKE_CASE   ):

      """simple docstring"""

      lowerCAmelCase__			: int    =					"mctct"







      def __init__(     self					: List[Any] ,       snake_case					: Optional[Any]=8065 ,       snake_case					: Optional[int]=1536 ,       snake_case					: Any=36 ,       snake_case					: List[str]=6144 ,       snake_case					: Dict=4 ,       snake_case					: str=384 ,       snake_case					: List[str]=920 ,       snake_case					: Dict=1E-5 ,       snake_case					: Union[str, Any]=0.3 ,       snake_case					: Optional[Any]="relu" ,       snake_case					: str=0.02 ,       snake_case					: Optional[int]=0.3 ,       snake_case					: int=0.3 ,       snake_case					: Any=1 ,       snake_case					: int=0 ,       snake_case					: Union[str, Any]=2 ,       snake_case					: List[Any]=1 ,       snake_case					: Dict=0.3 ,       snake_case					: int=1 ,       snake_case					: Optional[int]=(7,) ,       snake_case					: List[Any]=(3,) ,       snake_case					: Optional[int]=80 ,       snake_case					: List[str]=1 ,       snake_case					: int=None ,       snake_case					: List[str]="sum" ,       snake_case					: Tuple=False ,       **snake_case					: List[str] ,       ):
          super().__init__(**snake_case ,       pad_token_id=snake_case ,       bos_token_id=snake_case ,       eos_token_id=snake_case				)
          __UpperCamelCase  		=						vocab_size
          __UpperCamelCase  		=						hidden_size
          __UpperCamelCase  		=						num_hidden_layers
          __UpperCamelCase  		=						intermediate_size
          __UpperCamelCase  		=						num_attention_heads
          __UpperCamelCase  		=						attention_head_dim
          __UpperCamelCase  		=						max_position_embeddings
          __UpperCamelCase  		=						layer_norm_eps
          __UpperCamelCase  		=						layerdrop
          __UpperCamelCase  		=						hidden_act
          __UpperCamelCase  		=						initializer_range
          __UpperCamelCase  		=						hidden_dropout_prob
          __UpperCamelCase  		=						attention_probs_dropout_prob
          __UpperCamelCase  		=						pad_token_id
          __UpperCamelCase  		=						bos_token_id
          __UpperCamelCase  		=						eos_token_id
          __UpperCamelCase  		=						conv_glu_dim
          __UpperCamelCase  		=						conv_dropout
          __UpperCamelCase  		=						num_conv_layers
          __UpperCamelCase  		=						input_feat_per_channel
          __UpperCamelCase  		=						input_channels
          __UpperCamelCase  		=						conv_channels
          __UpperCamelCase  		=						ctc_loss_reduction
          __UpperCamelCase  		=						ctc_zero_infinity

          # prevents config testing fail with exporting to json
          __UpperCamelCase  		=						list(snake_case				)
          __UpperCamelCase  		=						list(snake_case				)

          if len(self.conv_kernel				) != self.num_conv_layers:
              raise ValueError(
                  '''Configuration for convolutional module is incorrect. '''
                  '''It is required that `len(config.conv_kernel)` == `config.num_conv_layers` '''
                  F"but is `len(config.conv_kernel) = {len(self.conv_kernel				)}`, "
                  F"`config.num_conv_layers = {self.num_conv_layers}`."				)






