



"""simple docstring"""







import unittest

from transformers import load_tool

from .test_tools_common import ToolTesterMixin


__snake_case	:				Optional[int]  					=			'\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      , a				):





     """simple docstring"""






     def 						A__  (					self :							List[Any] ):
          A__				=   load_tool('''summarization''' )
          self.tool.setup()
          A__				=   load_tool('''summarization'''	,      remote=_lowerCamelCase )





     def 						A__  (					self :							str ):
          A__				=   self.tool(_lowerCamelCase )
          self.assertEqual(
              _lowerCamelCase	,      '''Hugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf. In March 2021, Hugging Face raised $40 million in a Series B funding round. 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. In 2022, the workshop concluded with the announcement of BLOOM.'''	,      )





     def 						A__  (					self :							Dict ):
          A__				=   self.remote_tool(_lowerCamelCase )
          self.assertEqual(
              _lowerCamelCase	,      '''Hugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf. In March 2021, Hugging Face raised $40 million in a Series B funding round. 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. In 2022, the workshop concluded with the announcement of BLOOM.'''	,      )





     def 						A__  (					self :							str ):
          A__				=   self.tool(text=_lowerCamelCase )
          self.assertEqual(
              _lowerCamelCase	,      '''Hugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf. In March 2021, Hugging Face raised $40 million in a Series B funding round. 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. In 2022, the workshop concluded with the announcement of BLOOM.'''	,      )





     def 						A__  (					self :							Optional[Any] ):
          A__				=   self.remote_tool(text=_lowerCamelCase )
          self.assertEqual(
              _lowerCamelCase	,      '''Hugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf. In March 2021, Hugging Face raised $40 million in a Series B funding round. 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. In 2022, the workshop concluded with the announcement of BLOOM.'''	,      )








"""simple docstring"""







import json
import os
import tempfile

import datasets
from utils import generate_example_dataset, get_duration


__snake_case	:				Optional[Any]  					=			500_000

__snake_case					,  __snake_case	:				Any  					=			os.path.split(__file__)
__snake_case	:				Optional[Any]  					=			os.path.join(RESULTS_BASEPATH, 'results', RESULTS_FILENAME.replace('.py', '.json'))



@get_duration
def   a_	(			__a      ):
     A__				=   dataset.select(range(0		,							len(__a      )		,							2      )      )



@get_duration
def   a_	(			__a      ):
     A__				=   dataset.sort('''numbers'''      )



@get_duration
def   a_	(			__a      ):
     A__				=   dataset.shuffle()



@get_duration
def   a_	(			__a      ):
     A__				=   dataset.train_test_split(0.1      )



@get_duration
def   a_	(			__a		,							__a=10      ):
     for shard_id in range(__a      ):
          A__				=   dataset.shard(__a		,							__a      )



def   a_	(			):
     A__				=   {'''num examples''': SPEED_TEST_N_EXAMPLES}
     A__				=   (select, sort, shuffle, train_test_split, shard)
     with tempfile.TemporaryDirectory() as tmp_dir:
          print('''generating dataset'''      )
          A__				=   datasets.Features({'''text''': datasets.Value('''string'''      ), '''numbers''': datasets.Value('''float32'''      )}      )
          A__				=   generate_example_dataset(
              os.path.join(__a		,							'''dataset.arrow'''      )		,							__a		,							num_examples=__a      )
          print('''Functions'''      )
          for func in functions:
               print(func.__name__      )
               A__				=   func(__a      )

     with open(__a		,							'''wb'''      ) as f:
          f.write(json.dumps(__a      ).encode('''utf-8'''      )      )


if __name__ == "__main__":  # useful to run the profiler
 benchmark_indices_mapping()



