import argparse
import json
import os
import sys
import tempfile
import unittest
from argparse import Namespace
from dataclasses import dataclass, field
from enum import Enum
from pathlib import Path
from typing import List, Literal, Optional

import yaml

from transformers import HfArgumentParser, TrainingArguments
from transformers.hf_argparser import make_choice_type_function, string_to_bool


# Since Python 3.10, we can use the builtin `|` operator for Union types
# See PEP 604: https://peps.python.org/pep-0604
__UpperCamelCase	: int    		=  sys.version_info >= (3, 10)
def    A			(					_lowercase=None	,						_lowercase=None		):

						'''simple docstring'''





						return field(default_factory=lambda: default	,						metadata=_lowercase		)





@dataclass
class       lowercase__		:
						UpperCamelCase_  =	42
						UpperCamelCase_  =	42
						UpperCamelCase_  =	42
						UpperCamelCase_  =	42






@dataclass
class       lowercase__		:
						UpperCamelCase_  =	42
						UpperCamelCase_  =	field(default="""toto"""			,							metadata={"""help""": """help message"""})






@dataclass
class       lowercase__		:
						UpperCamelCase_  =	False
						UpperCamelCase_  =	True
						UpperCamelCase_  =	None






class       lowercase__		(     UpperCamelCase_):
						UpperCamelCase_  =	"""titi"""
						UpperCamelCase_  =	"""toto"""






class       lowercase__		(     UpperCamelCase_):
						UpperCamelCase_  =	"""titi"""
						UpperCamelCase_  =	"""toto"""
						UpperCamelCase_  =	42






@dataclass
class       lowercase__		:
						UpperCamelCase_  =	"""toto"""


						def  __A ( self			:       int		):





												'''simple docstring'''





												SCREAMING_SNAKE_CASE							:					int           =							BasicEnum(self.foo		)






@dataclass
class       lowercase__		:
						UpperCamelCase_  =	"""toto"""


						def  __A ( self			:       Any		):





												'''simple docstring'''





												SCREAMING_SNAKE_CASE							:					Dict           =							MixedTypeEnum(self.foo		)






@dataclass
class       lowercase__		:
						UpperCamelCase_  =	None
						UpperCamelCase_  =	field(default=UpperCamelCase_			,							metadata={"""help""": """help message"""})
						UpperCamelCase_  =	None
						UpperCamelCase_  =	list_field(default=[])
						UpperCamelCase_  =	list_field(default=[])






@dataclass
class       lowercase__		:
						UpperCamelCase_  =	list_field(default=[])
						UpperCamelCase_  =	list_field(default=[1, 2, 3])
						UpperCamelCase_  =	list_field(default=["""Hallo""", """Bonjour""", """Hello"""])
						UpperCamelCase_  =	list_field(default=[0.1, 0.2, 0.3])






@dataclass
class       lowercase__		:
						UpperCamelCase_  =	field()
						UpperCamelCase_  =	field()
						UpperCamelCase_  =	field()


						def  __A ( self			:       Tuple		):





												'''simple docstring'''





												SCREAMING_SNAKE_CASE							:					Tuple           =							BasicEnum(self.required_enum		)






@dataclass
class       lowercase__		:
						UpperCamelCase_  =	42
						UpperCamelCase_  =	field()
						UpperCamelCase_  =	None
						UpperCamelCase_  =	field(default="""toto"""			,							metadata={"""help""": """help message"""})
						UpperCamelCase_  =	list_field(default=["""Hallo""", """Bonjour""", """Hello"""])


if is_python_no_less_than_3_10:





					@dataclass
					class       lowercase__		:
											UpperCamelCase_  =	False
											UpperCamelCase_  =	True
											UpperCamelCase_  =	None






					@dataclass
					class       lowercase__		:
											UpperCamelCase_  =	None
											UpperCamelCase_  =	field(default=UpperCamelCase_			,							metadata={"""help""": """help message"""})
											UpperCamelCase_  =	None
											UpperCamelCase_  =	list_field(default=[])
											UpperCamelCase_  =	list_field(default=[])





class       lowercase__		(     unittest.TestCase):


						def  __A ( self			:       Union[str, Any]					,	UpperCamelCase__			:       argparse.ArgumentParser					,	UpperCamelCase__			:       argparse.ArgumentParser		):





												'''simple docstring'''





												self.assertEqual(len(a._actions		)					,	len(b._actions		)		)
												for x, y in zip(a._actions					,	b._actions		):
																		SCREAMING_SNAKE_CASE							:					Tuple           =							{k: v for k, v in vars(UpperCamelCase__		).items() if k != '''container'''}
																		SCREAMING_SNAKE_CASE							:					Union[str, Any]           =							{k: v for k, v in vars(UpperCamelCase__		).items() if k != '''container'''}

																		# Choices with mixed type have custom function as "type"
																		# So we need to compare results directly for equality
																		if xx.get('''choices'''					,	UpperCamelCase__		) and yy.get('''choices'''					,	UpperCamelCase__		):
																								for expected_choice in yy["choices"] + xx["choices"]:
																														self.assertEqual(xx['''type'''](UpperCamelCase__		)					,	yy['''type'''](UpperCamelCase__		)		)
																								del xx["type"], yy["type"]

																		self.assertEqual(UpperCamelCase__					,	UpperCamelCase__		)


						def  __A ( self			:       Union[str, Any]		):





												'''simple docstring'''





												SCREAMING_SNAKE_CASE							:					Union[str, Any]           =							HfArgumentParser(UpperCamelCase__		)

												SCREAMING_SNAKE_CASE							:					int           =							argparse.ArgumentParser()
												expected.add_argument('''--foo'''					,	type=UpperCamelCase__					,	required=UpperCamelCase__		)
												expected.add_argument('''--bar'''					,	type=UpperCamelCase__					,	required=UpperCamelCase__		)
												expected.add_argument('''--baz'''					,	type=UpperCamelCase__					,	required=UpperCamelCase__		)
												expected.add_argument('''--flag'''					,	type=UpperCamelCase__					,	default=UpperCamelCase__					,	const=UpperCamelCase__					,	nargs='''?'''		)
												self.argparsersEqual(UpperCamelCase__					,	UpperCamelCase__		)

												SCREAMING_SNAKE_CASE							:					Union[str, Any]           =							['''--foo''', '''1''', '''--baz''', '''quux''', '''--bar''', '''0.5''']
												(SCREAMING_SNAKE_CASE						)							:					Optional[int]           =							parser.parse_args_into_dataclasses(UpperCamelCase__					,	look_for_args_file=UpperCamelCase__		)
												self.assertFalse(example.flag		)


						def  __A ( self			:       List[Any]		):





												'''simple docstring'''





												SCREAMING_SNAKE_CASE							:					List[Any]           =							HfArgumentParser(UpperCamelCase__		)

												SCREAMING_SNAKE_CASE							:					Dict           =							argparse.ArgumentParser()
												expected.add_argument('''--foo'''					,	default=42					,	type=UpperCamelCase__		)
												expected.add_argument('''--baz'''					,	default='''toto'''					,	type=UpperCamelCase__					,	help='''help message'''		)
												self.argparsersEqual(UpperCamelCase__					,	UpperCamelCase__		)


						def  __A ( self			:       Tuple		):





												'''simple docstring'''





												SCREAMING_SNAKE_CASE							:					Optional[Any]           =							argparse.ArgumentParser()
												expected.add_argument('''--foo'''					,	type=UpperCamelCase__					,	default=UpperCamelCase__					,	const=UpperCamelCase__					,	nargs='''?'''		)
												expected.add_argument('''--baz'''					,	type=UpperCamelCase__					,	default=UpperCamelCase__					,	const=UpperCamelCase__					,	nargs='''?'''		)
												# A boolean no_* argument always has to come after its "default: True" regular counter-part
												# and its default must be set to False
												expected.add_argument('''--no_baz'''					,	action='''store_false'''					,	default=UpperCamelCase__					,	dest='''baz'''		)
												expected.add_argument('''--opt'''					,	type=UpperCamelCase__					,	default=UpperCamelCase__		)

												SCREAMING_SNAKE_CASE							:					Optional[int]           =							[WithDefaultBoolExample]
												if is_python_no_less_than_3_10:
																		dataclass_types.append(UpperCamelCase__		)

												for dataclass_type in dataclass_types:
																		SCREAMING_SNAKE_CASE							:					Optional[Any]           =							HfArgumentParser(UpperCamelCase__		)
																		self.argparsersEqual(UpperCamelCase__					,	UpperCamelCase__		)

																		SCREAMING_SNAKE_CASE							:					Optional[Any]           =							parser.parse_args([]		)
																		self.assertEqual(UpperCamelCase__					,	Namespace(foo=UpperCamelCase__					,	baz=UpperCamelCase__					,	opt=UpperCamelCase__		)		)

																		SCREAMING_SNAKE_CASE							:					Dict           =							parser.parse_args(['''--foo''', '''--no_baz''']		)
																		self.assertEqual(UpperCamelCase__					,	Namespace(foo=UpperCamelCase__					,	baz=UpperCamelCase__					,	opt=UpperCamelCase__		)		)

																		SCREAMING_SNAKE_CASE							:					Optional[Any]           =							parser.parse_args(['''--foo''', '''--baz''']		)
																		self.assertEqual(UpperCamelCase__					,	Namespace(foo=UpperCamelCase__					,	baz=UpperCamelCase__					,	opt=UpperCamelCase__		)		)

																		SCREAMING_SNAKE_CASE							:					Union[str, Any]           =							parser.parse_args(['''--foo''', '''True''', '''--baz''', '''True''', '''--opt''', '''True''']		)
																		self.assertEqual(UpperCamelCase__					,	Namespace(foo=UpperCamelCase__					,	baz=UpperCamelCase__					,	opt=UpperCamelCase__		)		)

																		SCREAMING_SNAKE_CASE							:					int           =							parser.parse_args(['''--foo''', '''False''', '''--baz''', '''False''', '''--opt''', '''False''']		)
																		self.assertEqual(UpperCamelCase__					,	Namespace(foo=UpperCamelCase__					,	baz=UpperCamelCase__					,	opt=UpperCamelCase__		)		)


						def  __A ( self			:       Union[str, Any]		):





												'''simple docstring'''





												SCREAMING_SNAKE_CASE							:					int           =							HfArgumentParser(UpperCamelCase__		)

												SCREAMING_SNAKE_CASE							:					Any           =							argparse.ArgumentParser()
												expected.add_argument(
												    '''--foo'''					,	default='''toto'''					,	choices=['''titi''', '''toto''', 42]					,	type=make_choice_type_function(['''titi''', '''toto''', 42]		)					,	)
												self.argparsersEqual(UpperCamelCase__					,	UpperCamelCase__		)

												SCREAMING_SNAKE_CASE							:					int           =							parser.parse_args([]		)
												self.assertEqual(args.foo					,	'''toto'''		)
												SCREAMING_SNAKE_CASE							:					int           =							parser.parse_args_into_dataclasses([]		)[0]
												self.assertEqual(enum_ex.foo					,	MixedTypeEnum.toto		)

												SCREAMING_SNAKE_CASE							:					List[Any]           =							parser.parse_args(['''--foo''', '''titi''']		)
												self.assertEqual(args.foo					,	'''titi'''		)
												SCREAMING_SNAKE_CASE							:					int           =							parser.parse_args_into_dataclasses(['''--foo''', '''titi''']		)[0]
												self.assertEqual(enum_ex.foo					,	MixedTypeEnum.titi		)

												SCREAMING_SNAKE_CASE							:					Dict           =							parser.parse_args(['''--foo''', '''42''']		)
												self.assertEqual(args.foo					,	42		)
												SCREAMING_SNAKE_CASE							:					Any           =							parser.parse_args_into_dataclasses(['''--foo''', '''42''']		)[0]
												self.assertEqual(enum_ex.foo					,	MixedTypeEnum.fourtytwo		)


						def  __A ( self			:       Dict		):





												'''simple docstring'''





												@dataclass
												class       lowercase__		:
																		UpperCamelCase_  =	"""toto"""






												SCREAMING_SNAKE_CASE							:					Optional[Any]           =							HfArgumentParser(UpperCamelCase__		)

												SCREAMING_SNAKE_CASE							:					Tuple           =							argparse.ArgumentParser()
												expected.add_argument(
												    '''--foo'''					,	default='''toto'''					,	choices=('''titi''', '''toto''', 42)					,	type=make_choice_type_function(['''titi''', '''toto''', 42]		)					,	)
												self.argparsersEqual(UpperCamelCase__					,	UpperCamelCase__		)

												SCREAMING_SNAKE_CASE							:					int           =							parser.parse_args([]		)
												self.assertEqual(args.foo					,	'''toto'''		)

												SCREAMING_SNAKE_CASE							:					str           =							parser.parse_args(['''--foo''', '''titi''']		)
												self.assertEqual(args.foo					,	'''titi'''		)

												SCREAMING_SNAKE_CASE							:					List[str]           =							parser.parse_args(['''--foo''', '''42''']		)
												self.assertEqual(args.foo					,	42		)


						def  __A ( self			:       List[Any]		):





												'''simple docstring'''





												SCREAMING_SNAKE_CASE							:					Optional[Any]           =							HfArgumentParser(UpperCamelCase__		)

												SCREAMING_SNAKE_CASE							:					Tuple           =							argparse.ArgumentParser()
												expected.add_argument('''--foo_int'''					,	nargs='''+'''					,	default=[]					,	type=UpperCamelCase__		)
												expected.add_argument('''--bar_int'''					,	nargs='''+'''					,	default=[1, 2, 3]					,	type=UpperCamelCase__		)
												expected.add_argument('''--foo_str'''					,	nargs='''+'''					,	default=['''Hallo''', '''Bonjour''', '''Hello''']					,	type=UpperCamelCase__		)
												expected.add_argument('''--foo_float'''					,	nargs='''+'''					,	default=[0.1, 0.2, 0.3]					,	type=UpperCamelCase__		)

												self.argparsersEqual(UpperCamelCase__					,	UpperCamelCase__		)

												SCREAMING_SNAKE_CASE							:					Tuple           =							parser.parse_args([]		)
												self.assertEqual(
												    UpperCamelCase__					,	Namespace(foo_int=[]					,	bar_int=[1, 2, 3]					,	foo_str=['''Hallo''', '''Bonjour''', '''Hello''']					,	foo_float=[0.1, 0.2, 0.3]		)					,	)

												SCREAMING_SNAKE_CASE							:					Tuple           =							parser.parse_args('''--foo_int 1 --bar_int 2 3 --foo_str a b c --foo_float 0.1 0.7'''.split()		)
												self.assertEqual(UpperCamelCase__					,	Namespace(foo_int=[1]					,	bar_int=[2, 3]					,	foo_str=['''a''', '''b''', '''c''']					,	foo_float=[0.1, 0.7]		)		)


						def  __A ( self			:       Any		):





												'''simple docstring'''





												SCREAMING_SNAKE_CASE							:					Optional[int]           =							argparse.ArgumentParser()
												expected.add_argument('''--foo'''					,	default=UpperCamelCase__					,	type=UpperCamelCase__		)
												expected.add_argument('''--bar'''					,	default=UpperCamelCase__					,	type=UpperCamelCase__					,	help='''help message'''		)
												expected.add_argument('''--baz'''					,	default=UpperCamelCase__					,	type=UpperCamelCase__		)
												expected.add_argument('''--ces'''					,	nargs='''+'''					,	default=[]					,	type=UpperCamelCase__		)
												expected.add_argument('''--des'''					,	nargs='''+'''					,	default=[]					,	type=UpperCamelCase__		)

												SCREAMING_SNAKE_CASE							:					Dict           =							[OptionalExample]
												if is_python_no_less_than_3_10:
																		dataclass_types.append(UpperCamelCase__		)

												for dataclass_type in dataclass_types:
																		SCREAMING_SNAKE_CASE							:					str           =							HfArgumentParser(UpperCamelCase__		)

																		self.argparsersEqual(UpperCamelCase__					,	UpperCamelCase__		)

																		SCREAMING_SNAKE_CASE							:					Optional[Any]           =							parser.parse_args([]		)
																		self.assertEqual(UpperCamelCase__					,	Namespace(foo=UpperCamelCase__					,	bar=UpperCamelCase__					,	baz=UpperCamelCase__					,	ces=[]					,	des=[]		)		)

																		SCREAMING_SNAKE_CASE							:					Any           =							parser.parse_args('''--foo 12 --bar 3.14 --baz 42 --ces a b c --des 1 2 3'''.split()		)
																		self.assertEqual(UpperCamelCase__					,	Namespace(foo=12					,	bar=3.14					,	baz='''42'''					,	ces=['''a''', '''b''', '''c''']					,	des=[1, 2, 3]		)		)


						def  __A ( self			:       Union[str, Any]		):





												'''simple docstring'''





												SCREAMING_SNAKE_CASE							:					Optional[Any]           =							HfArgumentParser(UpperCamelCase__		)

												SCREAMING_SNAKE_CASE							:					Tuple           =							argparse.ArgumentParser()
												expected.add_argument('''--required_list'''					,	nargs='''+'''					,	type=UpperCamelCase__					,	required=UpperCamelCase__		)
												expected.add_argument('''--required_str'''					,	type=UpperCamelCase__					,	required=UpperCamelCase__		)
												expected.add_argument(
												    '''--required_enum'''					,	type=make_choice_type_function(['''titi''', '''toto''']		)					,	choices=['''titi''', '''toto''']					,	required=UpperCamelCase__					,	)
												self.argparsersEqual(UpperCamelCase__					,	UpperCamelCase__		)


						def  __A ( self			:       int		):





												'''simple docstring'''





												SCREAMING_SNAKE_CASE							:					Any           =							HfArgumentParser(UpperCamelCase__		)

												SCREAMING_SNAKE_CASE							:					List[str]           =							argparse.ArgumentParser()
												expected.add_argument('''--foo'''					,	type=UpperCamelCase__					,	required=UpperCamelCase__		)
												expected.add_argument(
												    '''--required_enum'''					,	type=make_choice_type_function(['''titi''', '''toto''']		)					,	choices=['''titi''', '''toto''']					,	required=UpperCamelCase__					,	)
												expected.add_argument('''--opt'''					,	type=UpperCamelCase__					,	default=UpperCamelCase__		)
												expected.add_argument('''--baz'''					,	default='''toto'''					,	type=UpperCamelCase__					,	help='''help message'''		)
												expected.add_argument('''--foo_str'''					,	nargs='''+'''					,	default=['''Hallo''', '''Bonjour''', '''Hello''']					,	type=UpperCamelCase__		)
												self.argparsersEqual(UpperCamelCase__					,	UpperCamelCase__		)


						def  __A ( self			:       Dict		):





												'''simple docstring'''





												SCREAMING_SNAKE_CASE							:					Any           =							HfArgumentParser(UpperCamelCase__		)

												SCREAMING_SNAKE_CASE							:					Optional[int]           =							{
												    '''foo''': 12,
												    '''bar''': 3.14,
												    '''baz''': '''42''',
												    '''flag''': True,
												}

												SCREAMING_SNAKE_CASE							:					List[Any]           =							parser.parse_dict(UpperCamelCase__		)[0]
												SCREAMING_SNAKE_CASE							:					Optional[Any]           =							BasicExample(**UpperCamelCase__		)
												self.assertEqual(UpperCamelCase__					,	UpperCamelCase__		)


						def  __A ( self			:       Tuple		):





												'''simple docstring'''





												SCREAMING_SNAKE_CASE							:					Optional[Any]           =							HfArgumentParser(UpperCamelCase__		)

												SCREAMING_SNAKE_CASE							:					List[str]           =							{
												    '''foo''': 12,
												    '''bar''': 3.14,
												    '''baz''': '''42''',
												    '''flag''': True,
												    '''extra''': 42,
												}

												self.assertRaises(UpperCamelCase__					,	parser.parse_dict					,	UpperCamelCase__					,	allow_extra_keys=UpperCamelCase__		)


						def  __A ( self			:       Optional[int]		):





												'''simple docstring'''





												SCREAMING_SNAKE_CASE							:					Optional[Any]           =							HfArgumentParser(UpperCamelCase__		)

												SCREAMING_SNAKE_CASE							:					Tuple           =							{
												    '''foo''': 12,
												    '''bar''': 3.14,
												    '''baz''': '''42''',
												    '''flag''': True,
												}
												with tempfile.TemporaryDirectory() as tmp_dir:
																		SCREAMING_SNAKE_CASE							:					Any           =							os.path.join(UpperCamelCase__					,	'''temp_json'''		)
																		os.mkdir(UpperCamelCase__		)
																		with open(temp_local_path + '''.json'''					,	'''w+'''		) as f:
																								json.dump(UpperCamelCase__					,	UpperCamelCase__		)
																		SCREAMING_SNAKE_CASE							:					int           =							parser.parse_yaml_file(Path(temp_local_path + '''.json'''		)		)[0]

												SCREAMING_SNAKE_CASE							:					str           =							BasicExample(**UpperCamelCase__		)
												self.assertEqual(UpperCamelCase__					,	UpperCamelCase__		)


						def  __A ( self			:       Union[str, Any]		):





												'''simple docstring'''





												SCREAMING_SNAKE_CASE							:					Dict           =							HfArgumentParser(UpperCamelCase__		)

												SCREAMING_SNAKE_CASE							:					List[str]           =							{
												    '''foo''': 12,
												    '''bar''': 3.14,
												    '''baz''': '''42''',
												    '''flag''': True,
												}
												with tempfile.TemporaryDirectory() as tmp_dir:
																		SCREAMING_SNAKE_CASE							:					int           =							os.path.join(UpperCamelCase__					,	'''temp_yaml'''		)
																		os.mkdir(UpperCamelCase__		)
																		with open(temp_local_path + '''.yaml'''					,	'''w+'''		) as f:
																								yaml.dump(UpperCamelCase__					,	UpperCamelCase__		)
																		SCREAMING_SNAKE_CASE							:					str           =							parser.parse_yaml_file(Path(temp_local_path + '''.yaml'''		)		)[0]
												SCREAMING_SNAKE_CASE							:					List[Any]           =							BasicExample(**UpperCamelCase__		)
												self.assertEqual(UpperCamelCase__					,	UpperCamelCase__		)



						def  __A ( self			:       List[Any]		):





												'''simple docstring'''





												SCREAMING_SNAKE_CASE							:					Optional[int]           =							HfArgumentParser(UpperCamelCase__		)
												self.assertIsNotNone(UpperCamelCase__		)






from dataclasses import asdict, dataclass
from typing import Optional

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


__UpperCamelCase	: Tuple    		=  logging.get_logger(__name__)

# TODO Update this
__UpperCamelCase	: List[str]    		=  {
    '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       lowercase__		(     UpperCamelCase_):
						UpperCamelCase_  =	"""esm"""


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





												'''simple docstring'''





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

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





												'''simple docstring'''





												SCREAMING_SNAKE_CASE							:					Optional[Any]           =							super().to_dict()
												if isinstance(self.esmfold_config					,	UpperCamelCase__		):
																		SCREAMING_SNAKE_CASE							:					Optional[Any]           =							self.esmfold_config.to_dict()
												return output






@dataclass
class       lowercase__		:
						UpperCamelCase_  =	None
						UpperCamelCase_  =	True
						UpperCamelCase_  =	False
						UpperCamelCase_  =	False
						UpperCamelCase_  =	False
						UpperCamelCase_  =	0

						UpperCamelCase_  =	True
						UpperCamelCase_  =	False

						UpperCamelCase_  =	128
						UpperCamelCase_  =	None


						def  __A ( self			:       Optional[int]		):





												'''simple docstring'''





												if self.trunk is None:
																		SCREAMING_SNAKE_CASE							:					Optional[Any]           =							TrunkConfig()
												elif isinstance(self.trunk					,	UpperCamelCase__		):
																		SCREAMING_SNAKE_CASE							:					Tuple           =							TrunkConfig(**self.trunk		)



						def  __A ( self			:       str		):





												'''simple docstring'''





												SCREAMING_SNAKE_CASE							:					str           =							asdict(self		)
												SCREAMING_SNAKE_CASE							:					Tuple           =							self.trunk.to_dict()
												return output






@dataclass
class       lowercase__		:
						UpperCamelCase_  =	48
						UpperCamelCase_  =	1_024
						UpperCamelCase_  =	128
						UpperCamelCase_  =	32
						UpperCamelCase_  =	32
						UpperCamelCase_  =	32
						UpperCamelCase_  =	0
						UpperCamelCase_  =	0
						UpperCamelCase_  =	False
						UpperCamelCase_  =	4
						UpperCamelCase_  =	128
						UpperCamelCase_  =	None


						def  __A ( self			:       Any		):





												'''simple docstring'''





												if self.structure_module is None:
																		SCREAMING_SNAKE_CASE							:					Optional[int]           =							StructureModuleConfig()
												elif isinstance(self.structure_module					,	UpperCamelCase__		):
																		SCREAMING_SNAKE_CASE							:					Optional[Any]           =							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}."""		)

												SCREAMING_SNAKE_CASE							:					Dict           =							self.sequence_state_dim // self.sequence_head_width
												SCREAMING_SNAKE_CASE							:					Tuple           =							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  __A ( self			:       Union[str, Any]		):





												'''simple docstring'''





												SCREAMING_SNAKE_CASE							:					Any           =							asdict(self		)
												SCREAMING_SNAKE_CASE							:					Union[str, Any]           =							self.structure_module.to_dict()
												return output






@dataclass
class       lowercase__		:
						UpperCamelCase_  =	384
						UpperCamelCase_  =	128
						UpperCamelCase_  =	16
						UpperCamelCase_  =	128
						UpperCamelCase_  =	12
						UpperCamelCase_  =	4
						UpperCamelCase_  =	8
						UpperCamelCase_  =	0.1
						UpperCamelCase_  =	8
						UpperCamelCase_  =	1
						UpperCamelCase_  =	2
						UpperCamelCase_  =	7
						UpperCamelCase_  =	10
						UpperCamelCase_  =	1E-8
						UpperCamelCase_  =	1E5


						def  __A ( self			:       Dict		):





												'''simple docstring'''





												return asdict(self		)






def    A			(					):
						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>",
						)





