




import unittest

from transformers import load_tool

from .test_tools_common import ToolTesterMixin


lowerCamelCase       :	Optional[int]									=     """
Hugging 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.

In March 2021, Hugging Face raised $40 million in a Series B funding round.[3]

On 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]
"""







class 						A(		unittest.TestCase							,   lowercase_     ):



 '''simple docstring'''


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

       """simple docstring"""






       lowerCamelCase_	  =					load_tool('text-question-answering'						)
       self.tool.setup()
       lowerCamelCase_	  =					load_tool('text-question-answering'		,							remote=A_						)

 def        a__				(       self      :						Tuple						)     ->			int:

       """simple docstring"""






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

 def        a__				(       self      :						Optional[int]						)     ->			str:

       """simple docstring"""






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

 def        a__				(       self      :						Optional[Any]						)     ->			Optional[Any]:

       """simple docstring"""






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





 def        a__				(       self      :						Optional[int]						)     ->			Union[str, Any]:

       """simple docstring"""






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






import platform
from argparse import ArgumentParser

import huggingface_hub

from .. import __version__ as version
from ..utils import is_accelerate_available, is_torch_available, is_transformers_available, is_xformers_available
from . import BaseDiffusersCLICommand

def     _SCREAMING_SNAKE_CASE    (							lowercase			: Optional[Any]  ):


      '''simple docstring'''



      return EnvironmentCommand()







class 						A(		UpperCamelCase     ):



 '''simple docstring'''


 @staticmethod
 def        a__				(       A_      :						ArgumentParser						)     ->			str:

       """simple docstring"""






       lowerCamelCase_	  =					parser.add_parser('env'						)
       download_parser.set_defaults(func=A_						)

 def        a__				(       self      :						Optional[Any]						)     ->			Any:

       """simple docstring"""






       lowerCamelCase_	  =					huggingface_hub.__version__

       lowerCamelCase_	  =					'not installed'
       lowerCamelCase_	  =					'NA'
       if is_torch_available():
             import torch

             lowerCamelCase_	  =					torch.__version__
             lowerCamelCase_	  =					torch.cuda.is_available()

       lowerCamelCase_	  =					'not installed'
       if is_transformers_available():
             import transformers

             lowerCamelCase_	  =					transformers.__version__

       lowerCamelCase_	  =					'not installed'
       if is_accelerate_available():
             import accelerate

             lowerCamelCase_	  =					accelerate.__version__

       lowerCamelCase_	  =					'not installed'
       if is_xformers_available():
             import xformers

             lowerCamelCase_	  =					xformers.__version__

       lowerCamelCase_	  =					{
           '`diffusers` version': version,
           'Platform': platform.platform(),
           'Python version': platform.python_version(),
           'PyTorch version (GPU?)': f"""{pt_version} ({pt_cuda_available})""",
           'Huggingface_hub version': hub_version,
           'Transformers version': transformers_version,
           'Accelerate version': accelerate_version,
           'xFormers version': xformers_version,
           'Using GPU in script?': '<fill in>',
           'Using distributed or parallel set-up in script?': '<fill in>',
       }

       print('\nCopy-and-paste the text below in your GitHub issue and FILL OUT the two last points.\n'						)
       print(self.format_dict(A_						)						)

       return info





 @staticmethod
 def        a__				(       A_      :						Dict						)     ->			Any:

       """simple docstring"""






       return "\n".join([f"""- {prop}: {val}""" for prop, val in d.items()]						) + "\n"



