





'''simple docstring'''

from dataclasses import asdict, dataclass
from typing import Optional

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


UpperCAmelCase					:		int		=							logging.get_logger(__name__)

# TODO Update this
UpperCAmelCase					:		Optional[int]		=							{
    '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						(snake_case__					):
  _lowercase  :	str       					=				"""esm"""







  def __init__(		self     ,     lowercase__=None     ,     lowercase__=None     ,     lowercase__=None     ,     lowercase__=768     ,     lowercase__=12     ,     lowercase__=12     ,     lowercase__=3_072     ,     lowercase__=0.1     ,     lowercase__=0.1     ,     lowercase__=1_026     ,     lowercase__=0.02     ,     lowercase__=1E-1_2     ,     lowercase__="absolute"     ,     lowercase__=True     ,     lowercase__=None     ,     lowercase__=False     ,     lowercase__=False     ,     lowercase__=None     ,     lowercase__=None     ,     **lowercase__     ,     )		->						Tuple:






        """simple docstring"""





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

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






        """simple docstring"""





        _snake_case		:	List[Any]					     =     super().to_dict()
        if isinstance(self.esmfold_config     ,     lowercase_		):
              _snake_case		:	Tuple					     =     self.esmfold_config.to_dict()
        return output





@dataclass
class lowerCamelCase						:
  _lowercase  :	str       					=				None
  _lowercase  :	Dict       					=				True
  _lowercase  :	List[Any]       					=				False
  _lowercase  :	Dict       					=				False
  _lowercase  :	List[Any]       					=				False
  _lowercase  :	List[Any]       					=				0

  _lowercase  :	str       					=				True
  _lowercase  :	Optional[int]       					=				False

  _lowercase  :	Tuple       					=				128
  _lowercase  :	int       					=				None







  def 				UpperCAmelCase_				(		self		)		->						Any:






        """simple docstring"""





        if self.trunk is None:
              _snake_case		:	List[str]					     =     TrunkConfig()
        elif isinstance(self.trunk     ,     lowercase_		):
              _snake_case		:	str					     =     TrunkConfig(**self.trunk		)







  def 				UpperCAmelCase_				(		self		)		->						Any:






        """simple docstring"""





        _snake_case		:	str					     =     asdict(self		)
        _snake_case		:	Optional[Any]					     =     self.trunk.to_dict()
        return output





@dataclass
class lowerCamelCase						:
  _lowercase  :	Optional[int]       					=				48
  _lowercase  :	Optional[int]       					=				1_024
  _lowercase  :	Optional[Any]       					=				128
  _lowercase  :	Tuple       					=				32
  _lowercase  :	str       					=				32
  _lowercase  :	Tuple       					=				32
  _lowercase  :	str       					=				0
  _lowercase  :	Optional[int]       					=				0
  _lowercase  :	List[Any]       					=				False
  _lowercase  :	Dict       					=				4
  _lowercase  :	List[str]       					=				128
  _lowercase  :	str       					=				None







  def 				UpperCAmelCase_				(		self		)		->						int:






        """simple docstring"""





        if self.structure_module is None:
              _snake_case		:	str					     =     StructureModuleConfig()
        elif isinstance(self.structure_module     ,     lowercase_		):
              _snake_case		:	List[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}.'''		)

        _snake_case		:	str					     =     self.sequence_state_dim // self.sequence_head_width
        _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 				UpperCAmelCase_				(		self		)		->						int:






        """simple docstring"""





        _snake_case		:	str					     =     asdict(self		)
        _snake_case		:	int					     =     self.structure_module.to_dict()
        return output





@dataclass
class lowerCamelCase						:
  _lowercase  :	str       					=				384
  _lowercase  :	Tuple       					=				128
  _lowercase  :	str       					=				16
  _lowercase  :	Optional[Any]       					=				128
  _lowercase  :	int       					=				12
  _lowercase  :	Optional[Any]       					=				4
  _lowercase  :	Tuple       					=				8
  _lowercase  :	Dict       					=				0.1
  _lowercase  :	Tuple       					=				8
  _lowercase  :	Union[str, Any]       					=				1
  _lowercase  :	List[str]       					=				2
  _lowercase  :	Optional[Any]       					=				7
  _lowercase  :	int       					=				10
  _lowercase  :	str       					=				1E-8
  _lowercase  :	Optional[int]       					=				1E5







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






        """simple docstring"""





        return asdict(self		)




def    _a    (							):





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











'''simple docstring'''

from argparse import ArgumentParser

from .add_new_model import AddNewModelCommand
from .add_new_model_like import AddNewModelLikeCommand
from .convert import ConvertCommand
from .download import DownloadCommand
from .env import EnvironmentCommand
from .lfs import LfsCommands
from .pt_to_tf import PTtoTFCommand
from .run import RunCommand
from .serving import ServeCommand
from .user import UserCommands




def    _a    (							):





      """simple docstring"""



      _snake_case		:	List[Any]					     =     ArgumentParser('''Transformers CLI tool'''			,      usage='''transformers-cli <command> [<args>]'''	)
      _snake_case		:	List[str]					     =     parser.add_subparsers(help='''transformers-cli command helpers'''	)

      # Register commands
      ConvertCommand.register_subcommand(lowerCAmelCase_	)
      DownloadCommand.register_subcommand(lowerCAmelCase_	)
      EnvironmentCommand.register_subcommand(lowerCAmelCase_	)
      RunCommand.register_subcommand(lowerCAmelCase_	)
      ServeCommand.register_subcommand(lowerCAmelCase_	)
      UserCommands.register_subcommand(lowerCAmelCase_	)
      AddNewModelCommand.register_subcommand(lowerCAmelCase_	)
      AddNewModelLikeCommand.register_subcommand(lowerCAmelCase_	)
      LfsCommands.register_subcommand(lowerCAmelCase_	)
      PTtoTFCommand.register_subcommand(lowerCAmelCase_	)

      # Let's go
      _snake_case		:	str					     =     parser.parse_args()

      if not hasattr(lowerCAmelCase_			,      '''func'''	):
            parser.print_help()
            exit(1	)

      # Run
      _snake_case		:	Union[str, Any]					     =     args.func(lowerCAmelCase_	)
      service.run()


if __name__ == "__main__":
   main()


