
import tempfile
import unittest

from make_student import create_student_by_copying_alternating_layers

from transformers import AutoConfig
from transformers.file_utils import cached_property
from transformers.testing_utils import require_torch


lowerCamelCase__    :		Any          =   """sshleifer/bart-tiny-random"""
lowerCamelCase__    :		int          =   """patrickvonplaten/t5-tiny-random"""



@require_torch
class       _snake_case   (	unittest.TestCase							):


 @cached_property
 def      lowercase__     (					self):


   '''simple docstring'''




   return AutoConfig.from_pretrained(SCREAMING_SNAKE_CASE_)


 def      lowercase__     (					self):


   '''simple docstring'''




   lowercase__		,    *lowercase__  :   Union[str, Any]    		=      create_student_by_copying_alternating_layers(SCREAMING_SNAKE_CASE_					,  tempfile.mkdtemp()					,  e=1					,  d=1)
   self.assertEqual(student.config.num_hidden_layers					,  1)


 def      lowercase__     (					self):


   '''simple docstring'''




   lowercase__		,    *lowercase__  :   str    		=      create_student_by_copying_alternating_layers(SCREAMING_SNAKE_CASE_					,  tempfile.mkdtemp()					,  e=1					,  d=SCREAMING_SNAKE_CASE_)


 def      lowercase__     (					self):


   '''simple docstring'''




   lowercase__		,    *lowercase__  :   List[str]    		=      create_student_by_copying_alternating_layers(SCREAMING_SNAKE_CASE_					,  tempfile.mkdtemp()					,  e=1					,  d=SCREAMING_SNAKE_CASE_)
   self.assertEqual(student.config.encoder_layers					,  1)
   self.assertEqual(student.config.decoder_layers					,  self.teacher_config.encoder_layers)


 def      lowercase__     (					self):


   '''simple docstring'''




   lowercase__		,    *lowercase__  :   Union[str, Any]    		=      create_student_by_copying_alternating_layers(SCREAMING_SNAKE_CASE_					,  tempfile.mkdtemp()					,  e=1					,  d=1)
   self.assertEqual(student.config.encoder_layers					,  1)
   self.assertEqual(student.config.decoder_layers					,  1)



 def      lowercase__     (					self):


   '''simple docstring'''




   with self.assertRaises(SCREAMING_SNAKE_CASE_):
     create_student_by_copying_alternating_layers(SCREAMING_SNAKE_CASE_					,  tempfile.mkdtemp()					,  e=SCREAMING_SNAKE_CASE_					,  d=SCREAMING_SNAKE_CASE_)








from ..utils import DummyObject, requires_backends



class       _snake_case   (	metaclass=UpperCAmelCase_							):
 __lowerCAmelCase  :     int        =			['torch', 'transformers', 'onnx']


 def __init__(					self					,  *SCREAMING_SNAKE_CASE_					,  **SCREAMING_SNAKE_CASE_):


   '''simple docstring'''




   requires_backends(self					,  ["""torch""", """transformers""", """onnx"""])


 @classmethod
 def      lowercase__     (					cls					,  *SCREAMING_SNAKE_CASE_					,  **SCREAMING_SNAKE_CASE_):


   '''simple docstring'''




   requires_backends(cls					,  ["""torch""", """transformers""", """onnx"""])



 @classmethod
 def      lowercase__     (					cls					,  *SCREAMING_SNAKE_CASE_					,  **SCREAMING_SNAKE_CASE_):


   '''simple docstring'''




   requires_backends(cls					,  ["""torch""", """transformers""", """onnx"""])



class       _snake_case   (	metaclass=UpperCAmelCase_							):
 __lowerCAmelCase  :     Any        =			['torch', 'transformers', 'onnx']


 def __init__(					self					,  *SCREAMING_SNAKE_CASE_					,  **SCREAMING_SNAKE_CASE_):


   '''simple docstring'''




   requires_backends(self					,  ["""torch""", """transformers""", """onnx"""])


 @classmethod
 def      lowercase__     (					cls					,  *SCREAMING_SNAKE_CASE_					,  **SCREAMING_SNAKE_CASE_):


   '''simple docstring'''




   requires_backends(cls					,  ["""torch""", """transformers""", """onnx"""])



 @classmethod
 def      lowercase__     (					cls					,  *SCREAMING_SNAKE_CASE_					,  **SCREAMING_SNAKE_CASE_):


   '''simple docstring'''




   requires_backends(cls					,  ["""torch""", """transformers""", """onnx"""])



class       _snake_case   (	metaclass=UpperCAmelCase_							):
 __lowerCAmelCase  :     Union[str, Any]        =			['torch', 'transformers', 'onnx']


 def __init__(					self					,  *SCREAMING_SNAKE_CASE_					,  **SCREAMING_SNAKE_CASE_):


   '''simple docstring'''




   requires_backends(self					,  ["""torch""", """transformers""", """onnx"""])


 @classmethod
 def      lowercase__     (					cls					,  *SCREAMING_SNAKE_CASE_					,  **SCREAMING_SNAKE_CASE_):


   '''simple docstring'''




   requires_backends(cls					,  ["""torch""", """transformers""", """onnx"""])



 @classmethod
 def      lowercase__     (					cls					,  *SCREAMING_SNAKE_CASE_					,  **SCREAMING_SNAKE_CASE_):


   '''simple docstring'''




   requires_backends(cls					,  ["""torch""", """transformers""", """onnx"""])



class       _snake_case   (	metaclass=UpperCAmelCase_							):
 __lowerCAmelCase  :     List[Any]        =			['torch', 'transformers', 'onnx']


 def __init__(					self					,  *SCREAMING_SNAKE_CASE_					,  **SCREAMING_SNAKE_CASE_):


   '''simple docstring'''




   requires_backends(self					,  ["""torch""", """transformers""", """onnx"""])


 @classmethod
 def      lowercase__     (					cls					,  *SCREAMING_SNAKE_CASE_					,  **SCREAMING_SNAKE_CASE_):


   '''simple docstring'''




   requires_backends(cls					,  ["""torch""", """transformers""", """onnx"""])



 @classmethod
 def      lowercase__     (					cls					,  *SCREAMING_SNAKE_CASE_					,  **SCREAMING_SNAKE_CASE_):


   '''simple docstring'''




   requires_backends(cls					,  ["""torch""", """transformers""", """onnx"""])



class       _snake_case   (	metaclass=UpperCAmelCase_							):
 __lowerCAmelCase  :     Dict        =			['torch', 'transformers', 'onnx']


 def __init__(					self					,  *SCREAMING_SNAKE_CASE_					,  **SCREAMING_SNAKE_CASE_):


   '''simple docstring'''




   requires_backends(self					,  ["""torch""", """transformers""", """onnx"""])


 @classmethod
 def      lowercase__     (					cls					,  *SCREAMING_SNAKE_CASE_					,  **SCREAMING_SNAKE_CASE_):


   '''simple docstring'''




   requires_backends(cls					,  ["""torch""", """transformers""", """onnx"""])



 @classmethod
 def      lowercase__     (					cls					,  *SCREAMING_SNAKE_CASE_					,  **SCREAMING_SNAKE_CASE_):


   '''simple docstring'''




   requires_backends(cls					,  ["""torch""", """transformers""", """onnx"""])



class       _snake_case   (	metaclass=UpperCAmelCase_							):
 __lowerCAmelCase  :     List[str]        =			['torch', 'transformers', 'onnx']


 def __init__(					self					,  *SCREAMING_SNAKE_CASE_					,  **SCREAMING_SNAKE_CASE_):


   '''simple docstring'''




   requires_backends(self					,  ["""torch""", """transformers""", """onnx"""])


 @classmethod
 def      lowercase__     (					cls					,  *SCREAMING_SNAKE_CASE_					,  **SCREAMING_SNAKE_CASE_):


   '''simple docstring'''




   requires_backends(cls					,  ["""torch""", """transformers""", """onnx"""])



 @classmethod
 def      lowercase__     (					cls					,  *SCREAMING_SNAKE_CASE_					,  **SCREAMING_SNAKE_CASE_):


   '''simple docstring'''




   requires_backends(cls					,  ["""torch""", """transformers""", """onnx"""])






