


"""simple docstring"""






from dataclasses import asdict, dataclass
from typing import Optional

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


_lowerCAmelCase							:    Union[str, Any]					   =	logging.get_logger(__name__)

# TODO Update this
_lowerCAmelCase							:    Optional[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 							A_      (       _a ):
  lowerCAmelCase__      			=	'esm'


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







     '''simple docstring'''







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

     _lowerCamelCase   :				List[Any]							=     vocab_size
     _lowerCamelCase   :				Union[str, Any]							=     hidden_size
     _lowerCamelCase   :				Optional[Any]							=     num_hidden_layers
     _lowerCamelCase   :				str							=     num_attention_heads
     _lowerCamelCase   :				int							=     intermediate_size
     _lowerCamelCase   :				Tuple							=     hidden_dropout_prob
     _lowerCamelCase   :				Any							=     attention_probs_dropout_prob
     _lowerCamelCase   :				int							=     max_position_embeddings
     _lowerCamelCase   :				int							=     initializer_range
     _lowerCamelCase   :				Union[str, Any]							=     layer_norm_eps
     _lowerCamelCase   :				Optional[int]							=     position_embedding_type
     _lowerCamelCase   :				str							=     use_cache
     _lowerCamelCase   :				Union[str, Any]							=     emb_layer_norm_before
     _lowerCamelCase   :				Tuple							=     token_dropout
     _lowerCamelCase   :				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."    )
           _lowerCamelCase   :				Dict							=     EsmFoldConfig()
        elif isinstance(__lowerCAmelCase							,__lowerCAmelCase    ):
           _lowerCamelCase   :				List[Any]							=     EsmFoldConfig(**__lowerCAmelCase    )
        _lowerCamelCase   :				Union[str, Any]							=     esmfold_config
        if vocab_list is None:
           logger.warning("No vocab_list supplied for folding model, assuming the ESM-2 vocabulary!"    )
           _lowerCamelCase   :				List[str]							=     get_default_vocab_list()
        else:
           _lowerCamelCase   :				Optional[Any]							=     vocab_list
     else:
        _lowerCamelCase   :				List[str]							=     None
        _lowerCamelCase   :				Dict							=     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:						Any    ):







     '''simple docstring'''







     _lowerCamelCase   :				List[Any]							=     super().to_dict()
     if isinstance(self.esmfold_config							,__lowerCAmelCase    ):
        _lowerCamelCase   :				Optional[int]							=     self.esmfold_config.to_dict()
     return output




@dataclass
class 							A_      :
  lowerCAmelCase__      			=	None
  lowerCAmelCase__      			=	True
  lowerCAmelCase__      			=	False
  lowerCAmelCase__      			=	False
  lowerCAmelCase__      			=	False
  lowerCAmelCase__      			=	0

  lowerCAmelCase__      			=	True
  lowerCAmelCase__      			=	False

  lowerCAmelCase__      			=	1_2_8
  lowerCAmelCase__      			=	None


  def 							_lowercase					(			self:						Dict    ):







     '''simple docstring'''







     if self.trunk is None:
        _lowerCamelCase   :				Optional[int]							=     TrunkConfig()
     elif isinstance(self.trunk							,__lowerCAmelCase    ):
        _lowerCamelCase   :				Union[str, Any]							=     TrunkConfig(**self.trunk    )






  def 							_lowercase					(			self:						Optional[Any]    ):







     '''simple docstring'''







     _lowerCamelCase   :				Dict							=     asdict(self    )
     _lowerCamelCase   :				str							=     self.trunk.to_dict()
     return output




@dataclass
class 							A_      :
  lowerCAmelCase__      			=	4_8
  lowerCAmelCase__      			=	1_0_2_4
  lowerCAmelCase__      			=	1_2_8
  lowerCAmelCase__      			=	3_2
  lowerCAmelCase__      			=	3_2
  lowerCAmelCase__      			=	3_2
  lowerCAmelCase__      			=	0
  lowerCAmelCase__      			=	0
  lowerCAmelCase__      			=	False
  lowerCAmelCase__      			=	4
  lowerCAmelCase__      			=	1_2_8
  lowerCAmelCase__      			=	None


  def 							_lowercase					(			self:						Any    ):







     '''simple docstring'''







     if self.structure_module is None:
        _lowerCamelCase   :				Tuple							=     StructureModuleConfig()
     elif isinstance(self.structure_module							,__lowerCAmelCase    ):
        _lowerCamelCase   :				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}."""    )

     _lowerCamelCase   :				Optional[Any]							=     self.sequence_state_dim // self.sequence_head_width
     _lowerCamelCase   :				Optional[int]							=     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:						List[str]    ):







     '''simple docstring'''







     _lowerCamelCase   :				Dict							=     asdict(self    )
     _lowerCamelCase   :				Optional[int]							=     self.structure_module.to_dict()
     return output




@dataclass
class 							A_      :
  lowerCAmelCase__      			=	3_8_4
  lowerCAmelCase__      			=	1_2_8
  lowerCAmelCase__      			=	1_6
  lowerCAmelCase__      			=	1_2_8
  lowerCAmelCase__      			=	1_2
  lowerCAmelCase__      			=	4
  lowerCAmelCase__      			=	8
  lowerCAmelCase__      			=	0.1
  lowerCAmelCase__      			=	8
  lowerCAmelCase__      			=	1
  lowerCAmelCase__      			=	2
  lowerCAmelCase__      			=	7
  lowerCAmelCase__      			=	1_0
  lowerCAmelCase__      			=	1E-8
  lowerCAmelCase__      			=	1E5


  def 							_lowercase					(			self:						Any    ):







     '''simple docstring'''







     return asdict(self    )







def        lowerCamelCase_(		)    ->     int:
   '''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


UpperCAmelCase_           =	logging.get_logger(__name__)

UpperCAmelCase_           =	{
    "RWKV/rwkv-4-169m-pile": "https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json",
    "RWKV/rwkv-4-430m-pile": "https://huggingface.co/RWKV/rwkv-4-430m-pile/resolve/main/config.json",
    "RWKV/rwkv-4-1b5-pile": "https://huggingface.co/RWKV/rwkv-4-1b5-pile/resolve/main/config.json",
    "RWKV/rwkv-4-3b-pile": "https://huggingface.co/RWKV/rwkv-4-3b-pile/resolve/main/config.json",
    "RWKV/rwkv-4-7b-pile": "https://huggingface.co/RWKV/rwkv-4-7b-pile/resolve/main/config.json",
    "RWKV/rwkv-4-14b-pile": "https://huggingface.co/RWKV/rwkv-4-14b-pile/resolve/main/config.json",
    "RWKV/rwkv-raven-1b5": "https://huggingface.co/RWKV/rwkv-raven-1b5/resolve/main/config.json",
    "RWKV/rwkv-raven-3b": "https://huggingface.co/RWKV/rwkv-raven-3b/resolve/main/config.json",
    "RWKV/rwkv-raven-7b": "https://huggingface.co/RWKV/rwkv-raven-7b/resolve/main/config.json",
    "RWKV/rwkv-raven-14b": "https://huggingface.co/RWKV/rwkv-raven-14b/resolve/main/config.json",
}




class 			__UpperCamelCase    (							A__    ):
     __A	:  Tuple							  =   """rwkv"""
     __A	:  Any							  =   {"""max_position_embeddings""": """context_length"""}





     def __init__(     self				,							_UpperCamelCase=50277				,							_UpperCamelCase=1024				,							_UpperCamelCase=4096				,							_UpperCamelCase=32				,							_UpperCamelCase=None				,							_UpperCamelCase=None				,							_UpperCamelCase=1e-5				,							_UpperCamelCase=0				,							_UpperCamelCase=0				,							_UpperCamelCase=6				,							_UpperCamelCase=False				,							_UpperCamelCase=True				,							**_UpperCamelCase				,							):
        _UpperCAmelCase           =   vocab_size
        _UpperCAmelCase           =   context_length
        _UpperCAmelCase           =   hidden_size
        _UpperCAmelCase           =   num_hidden_layers
        _UpperCAmelCase           =   attention_hidden_size if attention_hidden_size is not None else hidden_size
        _UpperCAmelCase           =   intermediate_size if intermediate_size is not None else 4 * hidden_size
        _UpperCAmelCase           =   layer_norm_epsilon
        _UpperCAmelCase           =   rescale_every
        _UpperCAmelCase           =   use_cache

        _UpperCAmelCase           =   bos_token_id
        _UpperCAmelCase           =   eos_token_id

        super().__init__(
            tie_word_embeddings=_UpperCamelCase				,							bos_token_id=_UpperCamelCase				,							eos_token_id=_UpperCamelCase				,							**_UpperCamelCase					)