
import unittest

from transformers import load_tool

from .test_tools_common import ToolTesterMixin


A     :	Tuple    = '\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 			__A( unittest.TestCase  ,   a			):




				def 				SCREAMING_SNAKE_CASE_		(     self				)    ->      int:


								'''simple docstring'''




								__a										=    load_tool('''text-question-answering'''				)
								self.tool.setup()
								__a										=    load_tool('''text-question-answering'''		,     remote=_snake_case				)




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


								'''simple docstring'''




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




				def 				SCREAMING_SNAKE_CASE_		(     self				)    ->      Dict:


								'''simple docstring'''




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




				def 				SCREAMING_SNAKE_CASE_		(     self				)    ->      Dict:


								'''simple docstring'''




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




				def 				SCREAMING_SNAKE_CASE_		(     self				)    ->      Union[str, Any]:


								'''simple docstring'''




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

from collections import OrderedDict
from typing import Mapping

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


A     :	List[str]    = logging.get_logger(__name__)

A     :	Optional[int]    = {
    'facebook/levit-128S': 'https://huggingface.co/facebook/levit-128S/resolve/main/config.json',
    # See all LeViT models at https://huggingface.co/models?filter=levit
}







class 			__A( a			):
				snake_case_						   =    '''levit'''




				def __init__(     self		,     _snake_case=224		,     _snake_case=3		,     _snake_case=3		,     _snake_case=2		,     _snake_case=1		,     _snake_case=16		,     _snake_case=[128, 256, 384]		,     _snake_case=[4, 8, 12]		,     _snake_case=[4, 4, 4]		,     _snake_case=[16, 16, 16]		,     _snake_case=0		,     _snake_case=[2, 2, 2]		,     _snake_case=[2, 2, 2]		,     _snake_case=0.02		,     **_snake_case		,     )    ->      Optional[Any]:


								'''simple docstring'''




								super().__init__(**_snake_case				)
								__a										=    image_size
								__a										=    num_channels
								__a										=    kernel_size
								__a										=    stride
								__a										=    padding
								__a										=    hidden_sizes
								__a										=    num_attention_heads
								__a										=    depths
								__a										=    key_dim
								__a										=    drop_path_rate
								__a										=    patch_size
								__a										=    attention_ratio
								__a										=    mlp_ratio
								__a										=    initializer_range
								__a										=    [
								    ['''Subsample''', key_dim[0], hidden_sizes[0] // key_dim[0], 4, 2, 2],
								    ['''Subsample''', key_dim[0], hidden_sizes[1] // key_dim[0], 4, 2, 2],
								]







class 			__A( a			):
				snake_case_						   =    version.parse('''1.11'''			)




				@property
				def 				SCREAMING_SNAKE_CASE_		(     self				)    ->      Mapping[str, Mapping[int, str]]:


								'''simple docstring'''




								return OrderedDict(
								    [
								        ('''pixel_values''', {0: '''batch''', 1: '''num_channels''', 2: '''height''', 3: '''width'''}),
								    ]				)




				@property
				def 				SCREAMING_SNAKE_CASE_		(     self				)    ->      float:


								'''simple docstring'''




								return 1E-4