


from dataclasses import asdict, dataclass
from typing import Optional

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


_snake_case	:						int         =							logging.get_logger(__name__)

# TODO Update this
_snake_case	:						Tuple         =							{
    "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						(_lowerCAmelCase ):




							"""simple docstring"""


							__UpperCAmelCase       :				Optional[Any]	    =    "esm"

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

														__snake_case						:     Optional[int]									=  vocab_size
														__snake_case						:     Union[str, Any]									=  hidden_size
														__snake_case						:     List[Any]									=  num_hidden_layers
														__snake_case						:     int									=  num_attention_heads
														__snake_case						:     str									=  intermediate_size
														__snake_case						:     Dict									=  hidden_dropout_prob
														__snake_case						:     Tuple									=  attention_probs_dropout_prob
														__snake_case						:     Dict									=  max_position_embeddings
														__snake_case						:     Any									=  initializer_range
														__snake_case						:     int									=  layer_norm_eps
														__snake_case						:     str									=  position_embedding_type
														__snake_case						:     List[str]									=  use_cache
														__snake_case						:     Tuple									=  emb_layer_norm_before
														__snake_case						:     str									=  token_dropout
														__snake_case						:     Any									=  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						:     int									=  EsmFoldConfig()
																					elif isinstance(lowerCamelCase       ,      lowerCamelCase							):
																												__snake_case						:     Union[str, Any]									=  EsmFoldConfig(**lowerCamelCase							)
																					__snake_case						:     List[str]									=  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						:     int									=  vocab_list
														else:
																					__snake_case						:     List[Any]									=  None
																					__snake_case						:     List[str]									=  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			:    Dict							)      ->       List[Any]:
														__snake_case						:     Any									=  super().to_dict()
														if isinstance(self.esmfold_config       ,      lowerCamelCase							):
																					__snake_case						:     int									=  self.esmfold_config.to_dict()
														return output

@dataclass
class 							a						:




							"""simple docstring"""


							__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	    =    128
							__UpperCAmelCase       :				"TrunkConfig"	    =    None

							def        __snake_case   (				self			:    Union[str, Any]							)      ->       Union[str, Any]:
														if self.trunk is None:
																					__snake_case						:     Optional[Any]									=  TrunkConfig()
														elif isinstance(self.trunk       ,      lowerCamelCase							):
																					__snake_case						:     Any									=  TrunkConfig(**self.trunk							)






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

@dataclass
class 							a						:




							"""simple docstring"""


							__UpperCAmelCase       :				int	    =    48
							__UpperCAmelCase       :				int	    =    1024
							__UpperCAmelCase       :				int	    =    128
							__UpperCAmelCase       :				int	    =    32
							__UpperCAmelCase       :				int	    =    32
							__UpperCAmelCase       :				int	    =    32
							__UpperCAmelCase       :				float	    =    0
							__UpperCAmelCase       :				float	    =    0
							__UpperCAmelCase       :				bool	    =    False
							__UpperCAmelCase       :				int	    =    4
							__UpperCAmelCase       :				Optional[int]	    =    128
							__UpperCAmelCase       :				"StructureModuleConfig"	    =    None

							def        __snake_case   (				self			:    List[Any]							)      ->       Any:
														if self.structure_module is None:
																					__snake_case						:     Union[str, Any]									=  StructureModuleConfig()
														elif isinstance(self.structure_module       ,      lowerCamelCase							):
																					__snake_case						:     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}.'							)

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

@dataclass
class 							a						:




							"""simple docstring"""


							__UpperCAmelCase       :				int	    =    384
							__UpperCAmelCase       :				int	    =    128
							__UpperCAmelCase       :				int	    =    16
							__UpperCAmelCase       :				int	    =    128
							__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        __snake_case   (				self			:    Dict							)      ->       Any:
														return asdict(self							)







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


__lowerCAmelCase     :	Dict       			=  logging.get_logger(__name__)

__lowerCAmelCase     :	int       			=  {
    'microsoft/trocr-base-handwritten': (
        'https://huggingface.co/microsoft/trocr-base-handwritten/resolve/main/config.json'
    ),
    # See all TrOCR models at https://huggingface.co/models?filter=trocr
}




class 			UpperCAmelCase_     (					_A	):


  '''simple docstring'''







  a__       			=						"""trocr"""
  a__       			=						["""past_key_values"""]
  a__       			=						{
      """num_attention_heads""": """decoder_attention_heads""",
      """hidden_size""": """d_model""",
      """num_hidden_layers""": """decoder_layers""",
  }
  def __init__(					self     :					Dict     ,				UpperCamelCase__     :					Optional[Any]=5_0265     ,				UpperCamelCase__     :					int=1024     ,				UpperCamelCase__     :					int=12     ,				UpperCamelCase__     :					List[Any]=16     ,				UpperCamelCase__     :					Union[str, Any]=4096     ,				UpperCamelCase__     :					List[Any]="gelu"     ,				UpperCamelCase__     :					Optional[int]=512     ,				UpperCamelCase__     :					Optional[Any]=0.1     ,				UpperCamelCase__     :					int=0.0     ,				UpperCamelCase__     :					str=0.0     ,				UpperCamelCase__     :					Optional[int]=2     ,				UpperCamelCase__     :					List[str]=0.02     ,				UpperCamelCase__     :					Dict=0.0     ,				UpperCamelCase__     :					List[str]=True     ,				UpperCamelCase__     :					str=False     ,				UpperCamelCase__     :					List[str]=True     ,				UpperCamelCase__     :					Tuple=True     ,				UpperCamelCase__     :					str=1     ,				UpperCamelCase__     :					Union[str, Any]=0     ,				UpperCamelCase__     :					List[str]=2     ,				**UpperCamelCase__     :					Tuple     ,				)     ->      Dict:







    """simple docstring"""






    __magic_name__								=			vocab_size
    __magic_name__								=			d_model
    __magic_name__								=			decoder_layers
    __magic_name__								=			decoder_attention_heads
    __magic_name__								=			decoder_ffn_dim
    __magic_name__								=			activation_function
    __magic_name__								=			max_position_embeddings
    __magic_name__								=			dropout
    __magic_name__								=			attention_dropout
    __magic_name__								=			activation_dropout
    __magic_name__								=			init_std
    __magic_name__								=			decoder_layerdrop
    __magic_name__								=			use_cache
    __magic_name__								=			scale_embedding
    __magic_name__								=			use_learned_position_embeddings
    __magic_name__								=			layernorm_embedding

    super().__init__(
        pad_token_id=UpperCamelCase__     ,				bos_token_id=UpperCamelCase__     ,				eos_token_id=UpperCamelCase__     ,				decoder_start_token_id=UpperCamelCase__     ,				**UpperCamelCase__     ,				)

