"""simple docstring"""
import unittest

from transformers import EsmConfig, is_torch_available
from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
 import torch

 from transformers.models.esm.modeling_esmfold import EsmForProteinFolding




class        __snake_case	:



      def __init__(						self   ,      lowercase   ,      lowercase=13   ,      lowercase=7   ,      lowercase=False   ,      lowercase=True   ,      lowercase=False   ,      lowercase=False   ,      lowercase=19   ,      lowercase=32   ,      lowercase=5   ,      lowercase=4   ,      lowercase=37   ,      lowercase="gelu"   ,      lowercase=0.1   ,      lowercase=0.1   ,      lowercase=5_12   ,      lowercase=16   ,      lowercase=2   ,      lowercase=0.02   ,      lowercase=3   ,      lowercase=4   ,      lowercase=None   ,      )     ->      Optional[Any]:





        '''simple docstring'''





        a__:					List[str]      							=     parent
        a__:					str      							=     batch_size
        a__:					Dict      							=     seq_length
        a__:					Any      							=     is_training
        a__:					str      							=     use_input_mask
        a__:					List[str]      							=     use_token_type_ids
        a__:					List[str]      							=     use_labels
        a__:					Any      							=     vocab_size
        a__:					List[str]      							=     hidden_size
        a__:					Tuple      							=     num_hidden_layers
        a__:					Optional[Any]      							=     num_attention_heads
        a__:					Any      							=     intermediate_size
        a__:					List[str]      							=     hidden_act
        a__:					Union[str, Any]      							=     hidden_dropout_prob
        a__:					Any      							=     attention_probs_dropout_prob
        a__:					Any      							=     max_position_embeddings
        a__:					Optional[int]      							=     type_vocab_size
        a__:					List[Any]      							=     type_sequence_label_size
        a__:					List[Any]      							=     initializer_range
        a__:					Tuple      							=     num_labels
        a__:					Optional[Any]      							=     num_choices
        a__:					Any      							=     scope



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





        '''simple docstring'''





        a__:					Optional[Any]      							=     ids_tensor([self.batch_size, self.seq_length]   ,      self.vocab_size)

        a__:					int      							=     None
        if self.use_input_mask:
          a__:					int      							=     random_attention_mask([self.batch_size, self.seq_length])

        a__:					Optional[int]      							=     None
        a__:					List[str]      							=     None
        a__:					Tuple      							=     None
        if self.use_labels:
          a__:					str      							=     ids_tensor([self.batch_size]   ,      self.type_sequence_label_size)
          a__:					List[str]      							=     ids_tensor([self.batch_size, self.seq_length]   ,      self.num_labels)
          a__:					int      							=     ids_tensor([self.batch_size]   ,      self.num_choices)

        a__:					List[str]      							=     self.get_config()

        return config, input_ids, input_mask, sequence_labels, token_labels, choice_labels



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





        '''simple docstring'''





        a__:					int      							=     EsmConfig(
            vocab_size=33   ,      hidden_size=self.hidden_size   ,      pad_token_id=1   ,      num_hidden_layers=self.num_hidden_layers   ,      num_attention_heads=self.num_attention_heads   ,      intermediate_size=self.intermediate_size   ,      hidden_act=self.hidden_act   ,      hidden_dropout_prob=self.hidden_dropout_prob   ,      attention_probs_dropout_prob=self.attention_probs_dropout_prob   ,      max_position_embeddings=self.max_position_embeddings   ,      type_vocab_size=self.type_vocab_size   ,      initializer_range=self.initializer_range   ,      is_folding_model=lowercase   ,      esmfold_config={'trunk': {'num_blocks': 2}, 'fp16_esm': False}   ,      )
        return config



      def   lowerCamelCase_       (						self   ,      lowercase   ,      lowercase   ,      lowercase   ,      lowercase   ,      lowercase   ,      lowercase)     ->      str:





        '''simple docstring'''





        a__:					List[Any]      							=     EsmForProteinFolding(config=lowercase).float()
        model.to(lowercase)
        model.eval()
        a__:					List[str]      							=     model(lowercase   ,      attention_mask=lowercase)
        a__:					Any      							=     model(lowercase)
        a__:					Optional[int]      							=     model(lowercase)

        self.parent.assertEqual(result.positions.shape   ,      (8, self.batch_size, self.seq_length, 14, 3))
        self.parent.assertEqual(result.angles.shape   ,      (8, self.batch_size, self.seq_length, 7, 2))



      def   lowerCamelCase_       (						self)     ->      Optional[int]:





        '''simple docstring'''





        a__:					Union[str, Any]      							=     self.prepare_config_and_inputs()
        (
            (
            a__
        )							,   (
            a__
        )							,   (
            a__
        )							,   (
            a__
        )							,   (
            a__
        )							,   (
            a__
        )							,   
        ):					int      							=     config_and_inputs
        a__:					str      							=     {'input_ids': input_ids, 'attention_mask': input_mask}
        return config, inputs_dict







@require_torch
class        __snake_case	(					__lowerCAmelCase	,				__lowerCAmelCase	,				unittest.TestCase    ):
      a__				=		False

      a__				=		(EsmForProteinFolding,) if is_torch_available() else ()
      a__				=		()
      a__				=		{} if is_torch_available() else {}
      a__				=		False



      def   lowerCamelCase_       (						self)     ->      Dict:





        '''simple docstring'''





        a__:					List[Any]      							=     EsmFoldModelTester(self)
        a__:					str      							=     ConfigTester(self   ,      config_class=lowercase   ,      hidden_size=37)



      def   lowerCamelCase_       (						self)     ->      str:





        '''simple docstring'''





        self.config_tester.run_common_tests()



      def   lowerCamelCase_       (						self)     ->      int:





        '''simple docstring'''





        a__:					Tuple      							=     self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_model(*lowercase)



      @unittest.skip('Does not support attention outputs')
      def   lowerCamelCase_       (						self)     ->      Tuple:





        '''simple docstring'''





        pass



      @unittest.skip
      def   lowerCamelCase_       (						self)     ->      Tuple:





        '''simple docstring'''





        pass



      @unittest.skip('Esm does not support embedding resizing')
      def   lowerCamelCase_       (						self)     ->      Tuple:





        '''simple docstring'''





        pass



      @unittest.skip('Esm does not support embedding resizing')
      def   lowerCamelCase_       (						self)     ->      Any:





        '''simple docstring'''





        pass



      @unittest.skip('ESMFold does not support passing input embeds!')
      def   lowerCamelCase_       (						self)     ->      Optional[Any]:





        '''simple docstring'''





        pass



      @unittest.skip('ESMFold does not support head pruning.')
      def   lowerCamelCase_       (						self)     ->      Optional[Any]:





        '''simple docstring'''





        pass



      @unittest.skip('ESMFold does not support head pruning.')
      def   lowerCamelCase_       (						self)     ->      List[Any]:





        '''simple docstring'''





        pass



      @unittest.skip('ESMFold does not support head pruning.')
      def   lowerCamelCase_       (						self)     ->      str:





        '''simple docstring'''





        pass



      @unittest.skip('ESMFold does not support head pruning.')
      def   lowerCamelCase_       (						self)     ->      List[str]:





        '''simple docstring'''





        pass



      @unittest.skip('ESMFold does not support head pruning.')
      def   lowerCamelCase_       (						self)     ->      int:





        '''simple docstring'''





        pass



      @unittest.skip('ESMFold does not output hidden states in the normal way.')
      def   lowerCamelCase_       (						self)     ->      str:





        '''simple docstring'''





        pass



      @unittest.skip('ESMfold does not output hidden states in the normal way.')
      def   lowerCamelCase_       (						self)     ->      int:





        '''simple docstring'''





        pass



      @unittest.skip('ESMFold only has one output format.')
      def   lowerCamelCase_       (						self)     ->      Union[str, Any]:





        '''simple docstring'''





        pass



      @unittest.skip('This test doesn\'t work for ESMFold and doesn\'t test core functionality')
      def   lowerCamelCase_       (						self)     ->      List[Any]:





        '''simple docstring'''





        pass



      @unittest.skip('ESMFold does not support input chunking.')
      def   lowerCamelCase_       (						self)     ->      List[str]:





        '''simple docstring'''





        pass



      @unittest.skip('ESMFold doesn\'t respect you and it certainly doesn\'t respect your initialization arguments.')
      def   lowerCamelCase_       (						self)     ->      List[Any]:





        '''simple docstring'''





        pass



      @unittest.skip('ESMFold doesn\'t support torchscript compilation.')
      def   lowerCamelCase_       (						self)     ->      List[str]:





        '''simple docstring'''





        pass



      @unittest.skip('ESMFold doesn\'t support torchscript compilation.')
      def   lowerCamelCase_       (						self)     ->      Union[str, Any]:





        '''simple docstring'''





        pass



      @unittest.skip('ESMFold doesn\'t support torchscript compilation.')
      def   lowerCamelCase_       (						self)     ->      List[Any]:





        '''simple docstring'''





        pass



      @unittest.skip('ESMFold doesn\'t support data parallel.')
      def   lowerCamelCase_       (						self)     ->      List[Any]:





        '''simple docstring'''





        pass



      @unittest.skip('Will be fixed soon by reducing the size of the model used for common tests.')
      def   lowerCamelCase_       (						self)     ->      Union[str, Any]:





        '''simple docstring'''





        pass







@require_torch
class        __snake_case	(					__lowerCAmelCase    ):



      @slow
      def   lowerCamelCase_       (						self)     ->      Tuple:





        '''simple docstring'''





        a__:					Dict      							=     EsmForProteinFolding.from_pretrained('facebook/esmfold_v1').float()
        model.eval()
        a__:					List[str]      							=     torch.tensor([[0, 6, 4, 13, 5, 4, 16, 12, 11, 7, 2]])
        a__:					Optional[Any]      							=     model(lowercase)['positions']
        a__:					List[Any]      							=     torch.tensor([2.5828, 0.7993, -10.9334]   ,      dtype=torch.floataa)
        self.assertTrue(torch.allclose(position_outputs[0, 0, 0, 0]   ,      lowercase   ,      atol=1e-4))



"""simple docstring"""
from __future__ import annotations




class        __snake_case	:



      def __init__(						self   ,      lowercase=None)     ->      Optional[Any]:





        '''simple docstring'''





        a__:					int      							=     data
        a__:					str      							=     None



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





        '''simple docstring'''





        a__:					Optional[Any]      							=     []
        a__:					Union[str, Any]      							=     self
        while temp:
          string_rep.append(f'{temp.data}')
          a__:					Tuple      							=     temp.next
        return "->".join(lowercase)







def 						__a       (     _SCREAMING_SNAKE_CASE       )     ->str:
  if not elements_list:
    raise Exception('The Elements List is empty'       )

  a__:					Any      							=     Node(elements_list[0]       )
  for i in range(1		,					len(_SCREAMING_SNAKE_CASE       )       ):
    a__:					Optional[Any]      							=     Node(elements_list[i]       )
    a__:					Tuple      							=     current.next
  return head







def 						__a       (     _SCREAMING_SNAKE_CASE       )     ->None:
  if head_node is not None and isinstance(_SCREAMING_SNAKE_CASE		,					_SCREAMING_SNAKE_CASE       ):
    print_reverse(head_node.next       )
    print(head_node.data       )







def 						__a       (     )     ->Optional[Any]:
  from doctest import testmod

  testmod()

  a__:					Tuple      							=     make_linked_list([14, 52, 14, 12, 43]       )
  print('Linked List:'       )
  print(_SCREAMING_SNAKE_CASE       )
  print('Elements in Reverse:'       )
  print_reverse(_SCREAMING_SNAKE_CASE       )


if __name__ == "__main__":
 main()


