






"""simple docstring"""




import unittest

from transformers import load_tool

from .test_tools_common import ToolTesterMixin


_snake_case					   =     '\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_   ):


	def _lowercase			(  self	:		int							)      -> Optional[Any]:
			_a						: int    =			load_tool("""summarization"""							)
			self.tool.setup()
			_a						: Optional[Any]    =			load_tool("""summarization"""							,		remote=UpperCAmelCase__							)


	def _lowercase			(  self	:		str							)      -> int:
			_a						: Union[str, Any]    =			self.tool(UpperCAmelCase__							)
			self.assertEqual(
			    UpperCAmelCase__							,		"""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 _lowercase			(  self	:		List[Any]							)      -> Dict:
			_a						: Optional[int]    =			self.remote_tool(UpperCAmelCase__							)
			self.assertEqual(
			    UpperCAmelCase__							,		"""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 _lowercase			(  self	:		Tuple							)      -> List[str]:
			_a						: Union[str, Any]    =			self.tool(text=UpperCAmelCase__							)
			self.assertEqual(
			    UpperCAmelCase__							,		"""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 _lowercase			(  self	:		Optional[int]							)      -> Optional[int]:
			_a						: Optional[Any]    =			self.remote_tool(text=UpperCAmelCase__							)
			self.assertEqual(
			    UpperCAmelCase__							,		"""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 os
import unittest

from transformers.models.bertweet.tokenization_bertweet import VOCAB_FILES_NAMES, BertweetTokenizer

from ...test_tokenization_common import TokenizerTesterMixin






class  UpperCamelCase    (			snake_case_	,  unittest.TestCase   ):
 UpperCamelCase      : Union[str, Any]    =      BertweetTokenizer
 UpperCamelCase      : Optional[Any]    =      False


 def _lowercase			(  self	:		Dict							)      -> List[Any]:
   super().setUp()

   # Adapted from Sennrich et al. 2015 and https://github.com/rsennrich/subword-nmt
   _a						: Tuple    =			["""I""", """m""", """V@@""", """R@@""", """r""", """e@@"""]
   _a						: str    =			dict(zip(UpperCAmelCase__							,		range(len(UpperCAmelCase__							)							)							)							)
   _a						: Dict    =			["""#version: 0.2""", """a m</w>"""]
   _a						: int    =			{"""unk_token""": """<unk>"""}

   _a						: Union[str, Any]    =			os.path.join(self.tmpdirname							,		VOCAB_FILES_NAMES["""vocab_file"""]							)
   _a						: List[Any]    =			os.path.join(self.tmpdirname							,		VOCAB_FILES_NAMES["""merges_file"""]							)
   with open(self.vocab_file							,		"""w"""							,		encoding="""utf-8"""							) as fp:
     for token in vocab_tokens:
       fp.write(f"""{token} {vocab_tokens[token]}\n"""							)
   with open(self.merges_file							,		"""w"""							,		encoding="""utf-8"""							) as fp:
     fp.write("""\n""".join(UpperCAmelCase__							)							)


 def _lowercase			(  self	:		Any							,		**UpperCAmelCase__	:		Optional[Any]							)      -> Dict:
   kwargs.update(self.special_tokens_map							)
   return BertweetTokenizer.from_pretrained(self.tmpdirname							,		**UpperCAmelCase__							)


 def _lowercase			(  self	:		Dict							,		UpperCAmelCase__	:		Optional[int]							)      -> Dict:
   _a						: List[str]    =			"""I am VinAI Research"""
   _a						: Optional[int]    =			"""I <unk> m V<unk> <unk> <unk> I Re<unk> e<unk> <unk> <unk> <unk>"""
   return input_text, output_text







 def _lowercase			(  self	:		Tuple							)      -> Optional[int]:
   _a						: Optional[int]    =			BertweetTokenizer(self.vocab_file							,		self.merges_file							,		**self.special_tokens_map							)
   _a						: Tuple    =			"""I am VinAI Research"""
   _a						: Dict    =			"""I a@@ m V@@ i@@ n@@ A@@ I R@@ e@@ s@@ e@@ a@@ r@@ c@@ h""".split()
   _a						: str    =			tokenizer.tokenize(UpperCAmelCase__							)
   self.assertListEqual(UpperCAmelCase__							,		UpperCAmelCase__							)

   _a						: Tuple    =			tokens + [tokenizer.unk_token]

   _a						: Tuple    =			[4, 3, 5, 6, 3, 3, 3, 4, 7, 9, 3, 9, 3, 3, 3, 3, 3]
   self.assertListEqual(tokenizer.convert_tokens_to_ids(UpperCAmelCase__							)							,		UpperCAmelCase__							)

