





from dataclasses import asdict, dataclass
from typing import Optional

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


_lowerCamelCase :    Any  							= logging.get_logger(__name__)

# TODO Update this
_lowerCamelCase :    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 						lowerCamelCase       (__lowerCamelCase      ):







							"""simple docstring"""




							UpperCAmelCase_      						=   "esm"






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





														"""simple docstring"""
														super().__init__(pad_token_id=_UpperCAmelCase,			mask_token_id=_UpperCAmelCase,			**_UpperCAmelCase						)

														SCREAMING_SNAKE_CASE__       :      str     =						vocab_size
														SCREAMING_SNAKE_CASE__       :      Any     =						hidden_size
														SCREAMING_SNAKE_CASE__       :      List[str]     =						num_hidden_layers
														SCREAMING_SNAKE_CASE__       :      int     =						num_attention_heads
														SCREAMING_SNAKE_CASE__       :      Union[str, Any]     =						intermediate_size
														SCREAMING_SNAKE_CASE__       :      Optional[Any]     =						hidden_dropout_prob
														SCREAMING_SNAKE_CASE__       :      Any     =						attention_probs_dropout_prob
														SCREAMING_SNAKE_CASE__       :      List[str]     =						max_position_embeddings
														SCREAMING_SNAKE_CASE__       :      Optional[int]     =						initializer_range
														SCREAMING_SNAKE_CASE__       :      List[str]     =						layer_norm_eps
														SCREAMING_SNAKE_CASE__       :      Optional[Any]     =						position_embedding_type
														SCREAMING_SNAKE_CASE__       :      Optional[int]     =						use_cache
														SCREAMING_SNAKE_CASE__       :      Tuple     =						emb_layer_norm_before
														SCREAMING_SNAKE_CASE__       :      List[Any]     =						token_dropout
														SCREAMING_SNAKE_CASE__       :      Optional[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[str]     =						EsmFoldConfig()
																					elif isinstance(_UpperCAmelCase,			_UpperCAmelCase						):
																												SCREAMING_SNAKE_CASE__       :      List[str]     =						EsmFoldConfig(**_UpperCAmelCase						)
																					SCREAMING_SNAKE_CASE__       :      Union[str, 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__       :      Union[str, Any]     =						get_default_vocab_list()
																					else:
																												SCREAMING_SNAKE_CASE__       :      List[str]     =						vocab_list
														else:
																					SCREAMING_SNAKE_CASE__       :      Tuple     =						None
																					SCREAMING_SNAKE_CASE__       :      Any     =						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     :					Any						)				->			List[Any]:





														"""simple docstring"""
														SCREAMING_SNAKE_CASE__       :      List[str]     =						super().to_dict()
														if isinstance(self.esmfold_config,			_UpperCAmelCase						):
																					SCREAMING_SNAKE_CASE__       :      Optional[int]     =						self.esmfold_config.to_dict()
														return output


@dataclass
class 						lowerCamelCase       :







							"""simple docstring"""




							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]						)				->			Tuple:





														"""simple docstring"""
														if self.trunk is None:
																					SCREAMING_SNAKE_CASE__       :      Dict     =						TrunkConfig()
														elif isinstance(self.trunk,			_UpperCAmelCase						):
																					SCREAMING_SNAKE_CASE__       :      str     =						TrunkConfig(**self.trunk						)






							def  A_     ( self     :					List[str]						)				->			int:





														"""simple docstring"""
														SCREAMING_SNAKE_CASE__       :      str     =						asdict(self						)
														SCREAMING_SNAKE_CASE__       :      int     =						self.trunk.to_dict()
														return output


@dataclass
class 						lowerCamelCase       :







							"""simple docstring"""




							UpperCAmelCase_      						=   48
							UpperCAmelCase_      						=   1024
							UpperCAmelCase_      						=   128
							UpperCAmelCase_      						=   32
							UpperCAmelCase_      						=   32
							UpperCAmelCase_      						=   32
							UpperCAmelCase_      						=   0
							UpperCAmelCase_      						=   0
							UpperCAmelCase_      						=   False
							UpperCAmelCase_      						=   4
							UpperCAmelCase_      						=   128
							UpperCAmelCase_      						=   None






							def  A_     ( self     :					Dict						)				->			Dict:





														"""simple docstring"""
														if self.structure_module is None:
																					SCREAMING_SNAKE_CASE__       :      Dict     =						StructureModuleConfig()
														elif isinstance(self.structure_module,			_UpperCAmelCase						):
																					SCREAMING_SNAKE_CASE__       :      List[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}.'''						)

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





														"""simple docstring"""
														SCREAMING_SNAKE_CASE__       :      str     =						asdict(self						)
														SCREAMING_SNAKE_CASE__       :      List[Any]     =						self.structure_module.to_dict()
														return output


@dataclass
class 						lowerCamelCase       :







							"""simple docstring"""




							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     :					List[Any]						)				->			str:





														"""simple docstring"""
														return asdict(self						)




def _a (  )	->    List[str]:

							'''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>",
							)













import qiskit




def _a (  SCREAMING_SNAKE_CASE__      :  int			,				SCREAMING_SNAKE_CASE__      :  int       )	->    qiskit.result.counts.Counts:

							'''simple docstring'''






							SCREAMING_SNAKE_CASE__       :      Union[str, Any]     =						qiskit.Aer.get_backend("aer_simulator"       )

							# Create a Quantum Circuit acting on the q register
							SCREAMING_SNAKE_CASE__       :      List[Any]     =						qiskit.QuantumCircuit(SCREAMING_SNAKE_CASE__			,				SCREAMING_SNAKE_CASE__       )

							# Apply X (NOT) Gate to Qubits 0 & 1
							circuit.x(0       )
							circuit.x(1       )

							# Map the quantum measurement to the classical bits
							circuit.measure([0, 1]			,				[0, 1]       )

							# Execute the circuit on the qasm simulator
							SCREAMING_SNAKE_CASE__       :      int     =						qiskit.execute(SCREAMING_SNAKE_CASE__			,				SCREAMING_SNAKE_CASE__			,				shots=10_00       )

							# Return the histogram data of the results of the experiment.
							return job.result().get_counts(SCREAMING_SNAKE_CASE__       )


if __name__ == "__main__":
		_lowerCamelCase :    List[str]  							= single_qubit_measure(2, 2)
		print(f"Total count for various states are: {counts}")






