



"""simple docstring"""




import unittest

from transformers import load_tool

from .test_tools_common import ToolTesterMixin


_lowerCAmelCase    : List[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      UpperCAmelCase_  (    unittest.TestCase	,      _UpperCamelCase						):



      def 						snake_case_ (					self					:     List[str]						):
           _UpperCAmelCase      :     List[str]        =   load_tool("text-question-answering"						)
           self.tool.setup()
           _UpperCAmelCase      :     Optional[int]        =   load_tool("text-question-answering"					,     remote=A						)



      def 						snake_case_ (					self					:     Dict						):
           _UpperCAmelCase      :     Union[str, Any]        =   self.tool(A					,     "What did Hugging Face do in April 2021?"						)
           self.assertEqual(A					,     "launched the BigScience Research Workshop"						)



      def 						snake_case_ (					self					:     int						):
           _UpperCAmelCase      :     Optional[int]        =   self.remote_tool(A					,     "What did Hugging Face do in April 2021?"						)
           self.assertEqual(A					,     "launched the BigScience Research Workshop"						)



      def 						snake_case_ (					self					:     List[str]						):
           _UpperCAmelCase      :     List[Any]        =   self.tool(text=A					,     question="What did Hugging Face do in April 2021?"						)
           self.assertEqual(A					,     "launched the BigScience Research Workshop"						)



      def 						snake_case_ (					self					:     Dict						):
           _UpperCAmelCase      :     Dict        =   self.remote_tool(text=A					,     question="What did Hugging Face do in April 2021?"						)
           self.assertEqual(A					,     "launched the BigScience Research Workshop"						)





"""simple docstring"""




import inspect
import warnings
from typing import Any, Dict, Optional, Union

from packaging import version

def 						__snake_case						(				*SCREAMING_SNAKE_CASE__     :						List[Any]						,  SCREAMING_SNAKE_CASE__     :						Optional[Union[Dict, Any]] = None						,  SCREAMING_SNAKE_CASE__     :						int=True						,  SCREAMING_SNAKE_CASE__     :						Tuple=2    )  ->       Optional[Any]:





     '''simple docstring'''

     from .. import __version__

     _UpperCAmelCase      :     Tuple        =   take_from
     _UpperCAmelCase      :     Optional[int]        =   ()
     if not isinstance(args[0]						,  SCREAMING_SNAKE_CASE__    ):
          _UpperCAmelCase      :     int        =   (args,)

     for attribute, version_name, message in args:
          if version.parse(version.parse(SCREAMING_SNAKE_CASE__    ).base_version    ) >= version.parse(SCREAMING_SNAKE_CASE__    ):
               raise ValueError(
                   f'The deprecation tuple {(attribute, version_name, message)} should be removed since diffusers\''
                   f' version {__version__} is >= {version_name}'    )

          _UpperCAmelCase      :     Any        =   None
          if isinstance(SCREAMING_SNAKE_CASE__						,  SCREAMING_SNAKE_CASE__    ) and attribute in deprecated_kwargs:
               values += (deprecated_kwargs.pop(SCREAMING_SNAKE_CASE__    ),)
               _UpperCAmelCase      :     Tuple        =   f'The `{attribute}` argument is deprecated and will be removed in version {version_name}.'
          elif hasattr(SCREAMING_SNAKE_CASE__						,  SCREAMING_SNAKE_CASE__    ):
               values += (getattr(SCREAMING_SNAKE_CASE__						,  SCREAMING_SNAKE_CASE__    ),)
               _UpperCAmelCase      :     str        =   f'The `{attribute}` attribute is deprecated and will be removed in version {version_name}.'
          elif deprecated_kwargs is None:
               _UpperCAmelCase      :     Tuple        =   f'`{attribute}` is deprecated and will be removed in version {version_name}.'

          if warning is not None:
               _UpperCAmelCase      :     Optional[int]        =   warning + " " if standard_warn else ""
               warnings.warn(warning + message						,  SCREAMING_SNAKE_CASE__						,  stacklevel=SCREAMING_SNAKE_CASE__    )

     if isinstance(SCREAMING_SNAKE_CASE__						,  SCREAMING_SNAKE_CASE__    ) and len(SCREAMING_SNAKE_CASE__    ) > 0:
          _UpperCAmelCase      :     List[Any]        =   inspect.getouterframes(inspect.currentframe()    )[1]
          _UpperCAmelCase      :     Optional[int]        =   call_frame.filename
          _UpperCAmelCase      :     Dict        =   call_frame.lineno
          _UpperCAmelCase      :     List[Any]        =   call_frame.function
          _UpperCAmelCase    ,	_UpperCAmelCase      :     Optional[int]        =   next(iter(deprecated_kwargs.items()    )    )
          raise TypeError(f'{function} in {filename} line {line_number-1} got an unexpected keyword argument `{key}`'    )

     if len(SCREAMING_SNAKE_CASE__    ) == 0:
          return
     elif len(SCREAMING_SNAKE_CASE__    ) == 1:
          return values[0]
     return values
