





'''simple docstring'''


from dataclasses import asdict, dataclass
from typing import Optional

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


_SCREAMING_SNAKE_CASE									=				logging.get_logger(__name__)

# TODO Update this
_SCREAMING_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  lowerCAmelCase_		(		__magic_name__		):
 __lowerCamelCase    :				Any								=       "esm"




 def __init__(						self      ,  _lowerCAmelCase=None      ,  _lowerCAmelCase=None      ,  _lowerCAmelCase=None      ,  _lowerCAmelCase=768      ,  _lowerCAmelCase=12      ,  _lowerCAmelCase=12      ,  _lowerCAmelCase=3072      ,  _lowerCAmelCase=0.1      ,  _lowerCAmelCase=0.1      ,  _lowerCAmelCase=1026      ,  _lowerCAmelCase=0.02      ,  _lowerCAmelCase=1E-12      ,  _lowerCAmelCase="absolute"      ,  _lowerCAmelCase=True      ,  _lowerCAmelCase=None      ,  _lowerCAmelCase=False      ,  _lowerCAmelCase=False      ,  _lowerCAmelCase=None      ,  _lowerCAmelCase=None      ,  **_lowerCAmelCase      ,  )     ->				Optional[int]:
     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 				_snake_case (						self		)     ->				List[str]:
     _lowerCAmelCase						      =   super().to_dict()
     if isinstance(self.esmfold_config      ,  _lowerCAmelCase		):
         _lowerCAmelCase						      =   self.esmfold_config.to_dict()
     return output







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

 __lowerCamelCase    :				bool								=       True
 __lowerCamelCase    :				bool								=       False

 __lowerCamelCase    :				int								=       128
 __lowerCamelCase    :				"TrunkConfig"								=       None




 def 				_snake_case (						self		)     ->				Tuple:
     if self.trunk is None:
         _lowerCAmelCase						      =   TrunkConfig()
     elif isinstance(self.trunk      ,  _lowerCAmelCase		):
         _lowerCAmelCase						      =   TrunkConfig(**self.trunk		)





 def 				_snake_case (						self		)     ->				Optional[Any]:
     _lowerCAmelCase						      =   asdict(self		)
     _lowerCAmelCase						      =   self.trunk.to_dict()
     return output







@dataclass
class  lowerCAmelCase_		:
 __lowerCamelCase    :				int								=       48
 __lowerCamelCase    :				int								=       1_024
 __lowerCamelCase    :				int								=       128
 __lowerCamelCase    :				int								=       32
 __lowerCamelCase    :				int								=       32
 __lowerCamelCase    :				int								=       32
 __lowerCamelCase    :				float								=       0
 __lowerCamelCase    :				float								=       0
 __lowerCamelCase    :				bool								=       False
 __lowerCamelCase    :				int								=       4
 __lowerCamelCase    :				Optional[int]								=       128
 __lowerCamelCase    :				"StructureModuleConfig"								=       None




 def 				_snake_case (						self		)     ->				List[Any]:
     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 				_snake_case (						self		)     ->				Union[str, Any]:
     _lowerCAmelCase						      =   asdict(self		)
     _lowerCAmelCase						      =   self.structure_module.to_dict()
     return output







@dataclass
class  lowerCAmelCase_		:
 __lowerCamelCase    :				int								=       384
 __lowerCamelCase    :				int								=       128
 __lowerCamelCase    :				int								=       16
 __lowerCamelCase    :				int								=       128
 __lowerCamelCase    :				int								=       12
 __lowerCamelCase    :				int								=       4
 __lowerCamelCase    :				int								=       8
 __lowerCamelCase    :				float								=       0.1
 __lowerCamelCase    :				int								=       8
 __lowerCamelCase    :				int								=       1
 __lowerCamelCase    :				int								=       2
 __lowerCamelCase    :				int								=       7
 __lowerCamelCase    :				int								=       10
 __lowerCamelCase    :				float								=       1e-8
 __lowerCamelCase    :				float								=       1e5




 def 				_snake_case (						self		)     ->				Union[str, Any]:
     return asdict(self		)







def 						__a():



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


_SCREAMING_SNAKE_CASE									=				logging.get_logger(__name__)

_SCREAMING_SNAKE_CASE									=				{
    "bigcode/gpt_bigcode-santacoder": "https://huggingface.co/bigcode/gpt_bigcode-santacoder/resolve/main/config.json",
}

class  lowerCAmelCase_		(		__magic_name__		):
 __lowerCamelCase    :				str								=       "gpt_bigcode"
 __lowerCamelCase    :				Optional[int]								=       ["past_key_values"]
 __lowerCamelCase    :				List[str]								=       {
     "hidden_size": "n_embd",
     "max_position_embeddings": "n_positions",
     "num_attention_heads": "n_head",
     "num_hidden_layers": "n_layer",
 }




 def __init__(						self      ,  _lowerCAmelCase=50257      ,  _lowerCAmelCase=1024      ,  _lowerCAmelCase=768      ,  _lowerCAmelCase=12      ,  _lowerCAmelCase=12      ,  _lowerCAmelCase=None      ,  _lowerCAmelCase="gelu_pytorch_tanh"      ,  _lowerCAmelCase=0.1      ,  _lowerCAmelCase=0.1      ,  _lowerCAmelCase=0.1      ,  _lowerCAmelCase=1E-5      ,  _lowerCAmelCase=0.02      ,  _lowerCAmelCase=True      ,  _lowerCAmelCase=True      ,  _lowerCAmelCase=50256      ,  _lowerCAmelCase=50256      ,  _lowerCAmelCase=True      ,  _lowerCAmelCase=True      ,  _lowerCAmelCase=True      ,  **_lowerCAmelCase      ,  )     ->				List[Any]:
     _lowerCAmelCase						      =   vocab_size
     _lowerCAmelCase						      =   n_positions
     _lowerCAmelCase						      =   n_embd
     _lowerCAmelCase						      =   n_layer
     _lowerCAmelCase						      =   n_head
     _lowerCAmelCase						      =   n_inner
     _lowerCAmelCase						      =   activation_function
     _lowerCAmelCase						      =   resid_pdrop
     _lowerCAmelCase						      =   embd_pdrop
     _lowerCAmelCase						      =   attn_pdrop
     _lowerCAmelCase						      =   layer_norm_epsilon
     _lowerCAmelCase						      =   initializer_range
     _lowerCAmelCase						      =   scale_attn_weights
     _lowerCAmelCase						      =   use_cache
     _lowerCAmelCase						      =   attention_softmax_in_fpaa
     _lowerCAmelCase						      =   scale_attention_softmax_in_fpaa
     _lowerCAmelCase						      =   multi_query

     _lowerCAmelCase						      =   bos_token_id
     _lowerCAmelCase						      =   eos_token_id

     super().__init__(bos_token_id=_lowerCAmelCase      ,  eos_token_id=_lowerCAmelCase      ,  **_lowerCAmelCase		)


