from dataclasses import asdict, dataclass
from typing import Optional

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


UpperCamelCase__											=					logging.get_logger(__name__)

# TODO Update this
UpperCamelCase__											=					{
    '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							(				UpperCAmelCase_     ):
   __UpperCAmelCase : int      =			'esm'


   def __init__(self     :						List[str]       ,  __UpperCAmelCase     :						List[str]=None       ,  __UpperCAmelCase     :						str=None       ,  __UpperCAmelCase     :						Tuple=None       ,  __UpperCAmelCase     :						List[str]=7_6_8       ,  __UpperCAmelCase     :						List[str]=1_2       ,  __UpperCAmelCase     :						Any=1_2       ,  __UpperCAmelCase     :						List[str]=3_0_7_2       ,  __UpperCAmelCase     :						Any=0.1       ,  __UpperCAmelCase     :						Any=0.1       ,  __UpperCAmelCase     :						int=1_0_2_6       ,  __UpperCAmelCase     :						Optional[int]=0.02       ,  __UpperCAmelCase     :						Optional[Any]=1E-12       ,  __UpperCAmelCase     :						int="absolute"       ,  __UpperCAmelCase     :						Optional[Any]=True       ,  __UpperCAmelCase     :						Optional[Any]=None       ,  __UpperCAmelCase     :						str=False       ,  __UpperCAmelCase     :						Dict=False       ,  __UpperCAmelCase     :						List[str]=None       ,  __UpperCAmelCase     :						Optional[Any]=None       ,  **__UpperCAmelCase     :						Union[str, Any]       ,  )						->				Any:
         """simple docstring"""



         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 			lowercase_      (self     :						Tuple		)						->				Dict:
         """simple docstring"""



         UpperCAmelCase__								=  super().to_dict()
         if isinstance(self.esmfold_config       ,  __UpperCAmelCase		):
               UpperCAmelCase__								=  self.esmfold_config.to_dict()
         return output





@dataclass
class      A							:
   __UpperCAmelCase : str      =			None
   __UpperCAmelCase : bool      =			True
   __UpperCAmelCase : bool      =			False
   __UpperCAmelCase : bool      =			False
   __UpperCAmelCase : bool      =			False
   __UpperCAmelCase : float      =			0

   __UpperCAmelCase : bool      =			True
   __UpperCAmelCase : bool      =			False

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


   def 			lowercase_      (self     :						Optional[Any]		)						->				List[Any]:
         """simple docstring"""



         if self.trunk is None:
               UpperCAmelCase__								=  TrunkConfig()
         elif isinstance(self.trunk       ,  __UpperCAmelCase		):
               UpperCAmelCase__								=  TrunkConfig(**self.trunk		)





   def 			lowercase_      (self     :						str		)						->				Tuple:
         """simple docstring"""



         UpperCAmelCase__								=  asdict(self		)
         UpperCAmelCase__								=  self.trunk.to_dict()
         return output





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


   def 			lowercase_      (self     :						Optional[int]		)						->				Dict:
         """simple docstring"""



         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 			lowercase_      (self     :						Any		)						->				Optional[int]:
         """simple docstring"""



         UpperCAmelCase__								=  asdict(self		)
         UpperCAmelCase__								=  self.structure_module.to_dict()
         return output





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


   def 			lowercase_      (self     :						Optional[Any]		)						->				str:
         """simple docstring"""



         return asdict(self		)




def    lowerCAmelCase_ (     )     ->				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 collections import OrderedDict
from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


__A				:    int       =   logging.get_logger(__name__)

__A				:    Tuple       =   {
    "google/bigbird-roberta-base": "https://huggingface.co/google/bigbird-roberta-base/resolve/main/config.json",
    "google/bigbird-roberta-large": "https://huggingface.co/google/bigbird-roberta-large/resolve/main/config.json",
    "google/bigbird-base-trivia-itc": "https://huggingface.co/google/bigbird-base-trivia-itc/resolve/main/config.json",
    # See all BigBird models at https://huggingface.co/models?filter=big_bird
}

class 	A_       (a_			):
	UpperCAmelCase__					=			'''big_bird'''
	def __init__(    self							,					_A=5_0_3_5_8							,					_A=7_6_8							,					_A=1_2							,					_A=1_2							,					_A=3_0_7_2							,					_A="gelu_new"							,					_A=0.1							,					_A=0.1							,					_A=4_0_9_6							,					_A=2							,					_A=0.02							,					_A=1E-12							,					_A=True							,					_A=0							,					_A=1							,					_A=2							,					_A=6_6							,					_A="block_sparse"							,					_A=True							,					_A=False							,					_A=6_4							,					_A=3							,					_A=None							,					**_A							,					):






				'''simple docstring'''







				super().__init__(
				    pad_token_id=_A							,					bos_token_id=_A							,					eos_token_id=_A							,					sep_token_id=_A							,					**_A							,					)

				UpperCAmelCase   		=				vocab_size
				UpperCAmelCase   		=				max_position_embeddings
				UpperCAmelCase   		=				hidden_size
				UpperCAmelCase   		=				num_hidden_layers
				UpperCAmelCase   		=				num_attention_heads
				UpperCAmelCase   		=				intermediate_size
				UpperCAmelCase   		=				hidden_act
				UpperCAmelCase   		=				hidden_dropout_prob
				UpperCAmelCase   		=				attention_probs_dropout_prob
				UpperCAmelCase   		=				initializer_range
				UpperCAmelCase   		=				type_vocab_size
				UpperCAmelCase   		=				layer_norm_eps
				UpperCAmelCase   		=				use_cache

				UpperCAmelCase   		=				rescale_embeddings
				UpperCAmelCase   		=				attention_type
				UpperCAmelCase   		=				use_bias
				UpperCAmelCase   		=				block_size
				UpperCAmelCase   		=				num_random_blocks
				UpperCAmelCase   		=				classifier_dropout

class 	A_       (a_			):
	@property
	def      _lowercase				(    self		):






				'''simple docstring'''







				if self.task == "multiple-choice":
							UpperCAmelCase   		=				{0: '''batch''', 1: '''choice''', 2: '''sequence'''}
				else:
							UpperCAmelCase   		=				{0: '''batch''', 1: '''sequence'''}
				return OrderedDict(
				    [
				        ('''input_ids''', dynamic_axis),
				        ('''attention_mask''', dynamic_axis),
				    ]		)



