




'''simple docstring'''


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


_snake_case   :   List[Any]     							=	'sshleifer/bart-tiny-random'
_snake_case   :   Dict     							=	'patrickvonplaten/t5-tiny-random'

@require_torch
class     A					(	unittest.TestCase					):







							@cached_property
							def      __lowerCAmelCase    (						self :						Any      )    ->							str:


														"""simple docstring"""


														return AutoConfig.from_pretrained(lowerCAmelCase_      )







							def      __lowerCAmelCase    (						self :						List[str]      )    ->							Tuple:


														"""simple docstring"""


														_a  ,							*_a			  =       create_student_by_copying_alternating_layers(lowerCAmelCase_							,    tempfile.mkdtemp()							,    e=1							,    d=1      )
														self.assertEqual(student.config.num_hidden_layers							,    1      )







							def      __lowerCAmelCase    (						self :						List[Any]      )    ->							Any:


														"""simple docstring"""


														_a  ,							*_a			  =       create_student_by_copying_alternating_layers(lowerCAmelCase_							,    tempfile.mkdtemp()							,    e=1							,    d=lowerCAmelCase_      )







							def      __lowerCAmelCase    (						self :						Dict      )    ->							Any:


														"""simple docstring"""


														_a  ,							*_a			  =       create_student_by_copying_alternating_layers(lowerCAmelCase_							,    tempfile.mkdtemp()							,    e=1							,    d=lowerCAmelCase_      )
														self.assertEqual(student.config.encoder_layers							,    1      )
														self.assertEqual(student.config.decoder_layers							,    self.teacher_config.encoder_layers      )







							def      __lowerCAmelCase    (						self :						Dict      )    ->							Optional[Any]:


														"""simple docstring"""


														_a  ,							*_a			  =       create_student_by_copying_alternating_layers(lowerCAmelCase_							,    tempfile.mkdtemp()							,    e=1							,    d=1      )
														self.assertEqual(student.config.encoder_layers							,    1      )
														self.assertEqual(student.config.decoder_layers							,    1      )







							def      __lowerCAmelCase    (						self :						List[Any]      )    ->							Optional[Any]:


														"""simple docstring"""


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







'''simple docstring'''


import unittest

from transformers import load_tool

from .test_tools_common import ToolTesterMixin


_snake_case   :   str     							=	'\nHugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf originally as a company that developed a chatbot app targeted at teenagers.[2] After open-sourcing the model behind the chatbot, the company pivoted to focus on being a platform for machine learning.\n\nIn March 2021, Hugging Face raised $40 million in a Series B funding round.[3]\n\nOn April 28, 2021, the company launched the BigScience Research Workshop in collaboration with several other research groups to release an open large language model.[4] In 2022, the workshop concluded with the announcement of BLOOM, a multilingual large language model with 176 billion parameters.[5]\n'

class     A					(	unittest.TestCase  ,_a					):







							def      __lowerCAmelCase    (						self :						Any      )    ->							Dict:


														"""simple docstring"""


														_a			  =       load_tool('''text-question-answering'''      )
														self.tool.setup()
														_a			  =       load_tool('''text-question-answering'''							,    remote=lowerCAmelCase_      )







							def      __lowerCAmelCase    (						self :						List[Any]      )    ->							Optional[int]:


														"""simple docstring"""


														_a			  =       self.tool(lowerCAmelCase_							,    '''What did Hugging Face do in April 2021?'''      )
														self.assertEqual(lowerCAmelCase_							,    '''launched the BigScience Research Workshop'''      )







							def      __lowerCAmelCase    (						self :						Union[str, Any]      )    ->							Dict:


														"""simple docstring"""


														_a			  =       self.remote_tool(lowerCAmelCase_							,    '''What did Hugging Face do in April 2021?'''      )
														self.assertEqual(lowerCAmelCase_							,    '''launched the BigScience Research Workshop'''      )







							def      __lowerCAmelCase    (						self :						List[Any]      )    ->							List[str]:


														"""simple docstring"""


														_a			  =       self.tool(text=lowerCAmelCase_							,    question='''What did Hugging Face do in April 2021?'''      )
														self.assertEqual(lowerCAmelCase_							,    '''launched the BigScience Research Workshop'''      )







							def      __lowerCAmelCase    (						self :						int      )    ->							List[Any]:


														"""simple docstring"""


														_a			  =       self.remote_tool(text=lowerCAmelCase_							,    question='''What did Hugging Face do in April 2021?'''      )
														self.assertEqual(lowerCAmelCase_							,    '''launched the BigScience Research Workshop'''      )

