

from dataclasses import asdict, dataclass
from typing import Optional

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


snake_case__				= logging.get_logger(__name__)

# TODO Update this
snake_case__				= {
    '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  UpperCamelCase				( snake_case__ ):

     '''simple docstring'''

     A_										=  'esm'



     def __init__(					self				,				A_=None				,				A_=None				,				A_=None				,				A_=7_68				,				A_=12				,				A_=12				,				A_=30_72				,				A_=0.1				,				A_=0.1				,				A_=10_26				,				A_=0.02				,				A_=1E-1_2				,				A_="absolute"				,				A_=True				,				A_=None				,				A_=False				,				A_=False				,				A_=None				,				A_=None				,				**A_				,				) ->				Union[str, Any]:






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

           _lowerCamelCase			    =				vocab_size
           _lowerCamelCase			    =				hidden_size
           _lowerCamelCase			    =				num_hidden_layers
           _lowerCamelCase			    =				num_attention_heads
           _lowerCamelCase			    =				intermediate_size
           _lowerCamelCase			    =				hidden_dropout_prob
           _lowerCamelCase			    =				attention_probs_dropout_prob
           _lowerCamelCase			    =				max_position_embeddings
           _lowerCamelCase			    =				initializer_range
           _lowerCamelCase			    =				layer_norm_eps
           _lowerCamelCase			    =				position_embedding_type
           _lowerCamelCase			    =				use_cache
           _lowerCamelCase			    =				emb_layer_norm_before
           _lowerCamelCase			    =				token_dropout
           _lowerCamelCase			    =				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			    =				EsmFoldConfig()
                 elif isinstance(lowercase_				,				lowercase_						):
                       _lowerCamelCase			    =				EsmFoldConfig(**lowercase_						)
                 _lowerCamelCase			    =				esmfold_config
                 if vocab_list is None:
                       logger.warning('''No vocab_list supplied for folding model, assuming the ESM-2 vocabulary!'''						)
                       _lowerCamelCase			    =				get_default_vocab_list()
                 else:
                       _lowerCamelCase			    =				vocab_list
           else:
                 _lowerCamelCase			    =				None
                 _lowerCamelCase			    =				None
           if self.esmfold_config is not None and getattr(self.esmfold_config				,				'''use_esm_attn_map'''				,				lowercase_						):
                 raise ValueError('''The HuggingFace port of ESMFold does not support use_esm_attn_map at this time!'''						)





     def 		UpperCamelCase_						(					self						) ->				int:






           """simple docstring"""
           _lowerCamelCase			    =				super().to_dict()
           if isinstance(self.esmfold_config				,				lowercase_						):
                 _lowerCamelCase			    =				self.esmfold_config.to_dict()
           return output





@dataclass
class  UpperCamelCase				:

     '''simple docstring'''

     A_										=  None
     A_										=  True
     A_										=  False
     A_										=  False
     A_										=  False
     A_										=  0

     A_										=  True
     A_										=  False

     A_										=  128
     A_										=  None



     def 		UpperCamelCase_						(					self						) ->				int:






           """simple docstring"""
           if self.trunk is None:
                 _lowerCamelCase			    =				TrunkConfig()
           elif isinstance(self.trunk				,				lowercase_						):
                 _lowerCamelCase			    =				TrunkConfig(**self.trunk						)





     def 		UpperCamelCase_						(					self						) ->				List[str]:






           """simple docstring"""
           _lowerCamelCase			    =				asdict(self						)
           _lowerCamelCase			    =				self.trunk.to_dict()
           return output





@dataclass
class  UpperCamelCase				:

     '''simple docstring'''

     A_										=  48
     A_										=  1_024
     A_										=  128
     A_										=  32
     A_										=  32
     A_										=  32
     A_										=  0
     A_										=  0
     A_										=  False
     A_										=  4
     A_										=  128
     A_										=  None



     def 		UpperCamelCase_						(					self						) ->				Optional[Any]:






           """simple docstring"""
           if self.structure_module is None:
                 _lowerCamelCase			    =				StructureModuleConfig()
           elif isinstance(self.structure_module				,				lowercase_						):
                 _lowerCamelCase			    =				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			    =				self.sequence_state_dim // self.sequence_head_width
           _lowerCamelCase			    =				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 		UpperCamelCase_						(					self						) ->				int:






           """simple docstring"""
           _lowerCamelCase			    =				asdict(self						)
           _lowerCamelCase			    =				self.structure_module.to_dict()
           return output





@dataclass
class  UpperCamelCase				:

     '''simple docstring'''

     A_										=  384
     A_										=  128
     A_										=  16
     A_										=  128
     A_										=  12
     A_										=  4
     A_										=  8
     A_										=  0.1
     A_										=  8
     A_										=  1
     A_										=  2
     A_										=  7
     A_										=  10
     A_										=  1E-8
     A_										=  1E5



     def 		UpperCamelCase_						(					self						) ->				Any:






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





def       __magic_name__(  )						->    Optional[Any]:



      '''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 typing import TYPE_CHECKING

from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


snake_case__				= {
    'configuration_trajectory_transformer': [
        'TRAJECTORY_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'TrajectoryTransformerConfig',
    ],
}

try:
     if not is_torch_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     snake_case__				= [
         'TRAJECTORY_TRANSFORMER_PRETRAINED_MODEL_ARCHIVE_LIST',
         'TrajectoryTransformerModel',
         'TrajectoryTransformerPreTrainedModel',
         'load_tf_weights_in_trajectory_transformer',
     ]


if TYPE_CHECKING:
     from .configuration_trajectory_transformer import (
         TRAJECTORY_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP,
         TrajectoryTransformerConfig,
     )

     try:
          if not is_torch_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_trajectory_transformer import (
              TRAJECTORY_TRANSFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
              TrajectoryTransformerModel,
              TrajectoryTransformerPreTrainedModel,
              load_tf_weights_in_trajectory_transformer,
          )


else:
     import sys

     snake_case__				= _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)