






from typing import Optional, Tuple

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_openai import OpenAIGPTTokenizer


_a				     =  logging.get_logger(__name__)

_a				     =  {'''vocab_file''': '''vocab.json''', '''merges_file''': '''merges.txt''', '''tokenizer_file''': '''tokenizer.json'''}

_a				     =  {
    '''vocab_file''': {'''openai-gpt''': '''https://huggingface.co/openai-gpt/resolve/main/vocab.json'''},
    '''merges_file''': {'''openai-gpt''': '''https://huggingface.co/openai-gpt/resolve/main/merges.txt'''},
    '''tokenizer_file''': {'''openai-gpt''': '''https://huggingface.co/openai-gpt/resolve/main/tokenizer.json'''},
}

_a				     =  {
    '''openai-gpt''': 512,
}





class __lowerCamelCase			(				snake_case__):
	UpperCamelCase__								=				VOCAB_FILES_NAMES
	UpperCamelCase__								=				PRETRAINED_VOCAB_FILES_MAP
	UpperCamelCase__								=				PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
	UpperCamelCase__								=				["input_ids", "attention_mask"]
	UpperCamelCase__								=				OpenAIGPTTokenizer

	def __init__(							self	,   UpperCAmelCase=None	,   UpperCAmelCase=None	,   UpperCAmelCase=None	,   UpperCAmelCase="<unk>"	,   **UpperCAmelCase   ):
							"""simple docstring"""







							super().__init__(UpperCAmelCase	,   UpperCAmelCase	,   tokenizer_file=UpperCAmelCase	,   unk_token=UpperCAmelCase	,   **UpperCAmelCase   )

	@property
	def 	UpperCamelCase   (							self   ):
							"""simple docstring"""







							return True

	def 	UpperCamelCase   (							self	,   UpperCAmelCase	,   UpperCAmelCase = None   ):
							"""simple docstring"""







							_UpperCAmelCase     =      self._tokenizer.model.save(UpperCAmelCase	,   name=UpperCAmelCase   )
							return tuple(UpperCAmelCase   )








import unittest

from transformers import load_tool

from .test_tools_common import ToolTesterMixin


_a				     =  '''
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 __lowerCamelCase			(				unittest.TestCase					,	snake_case__):





	"""simple docstring"""






	def 	UpperCamelCase   (							self   ):
							"""simple docstring"""







							_UpperCAmelCase     =      load_tool('summarization'   )
							self.tool.setup()
							_UpperCAmelCase     =      load_tool('summarization'	,   remote=UpperCAmelCase   )

	def 	UpperCamelCase   (							self   ):
							"""simple docstring"""







							_UpperCAmelCase     =      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 	UpperCamelCase   (							self   ):
							"""simple docstring"""







							_UpperCAmelCase     =      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 	UpperCamelCase   (							self   ):
							"""simple docstring"""







							_UpperCAmelCase     =      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 	UpperCamelCase   (							self   ):
							"""simple docstring"""







							_UpperCAmelCase     =      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.'	,   )
