


'''simple docstring'''






import unittest

from transformers import load_tool

from .test_tools_common import ToolTesterMixin


lowercase							='''
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  __magic_name__							(		unittest.TestCase ,lowerCamelCase__    ):






       def       lowerCAmelCase		(      self)						->  List[str]:




          '''simple docstring'''
          _UpperCAmelCase       :       Optional[int]							   =load_tool('text-question-answering')
          self.tool.setup()
          _UpperCAmelCase       :       Any							   =load_tool('text-question-answering'  ,							remote=snake_case)






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




          '''simple docstring'''
          _UpperCAmelCase       :       List[Any]							   =self.tool(snake_case  ,							'What did Hugging Face do in April 2021?')
          self.assertEqual(snake_case  ,							'launched the BigScience Research Workshop')






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




          '''simple docstring'''
          _UpperCAmelCase       :       List[str]							   =self.remote_tool(snake_case  ,							'What did Hugging Face do in April 2021?')
          self.assertEqual(snake_case  ,							'launched the BigScience Research Workshop')






       def       lowerCAmelCase		(      self)						->  int:




          '''simple docstring'''
          _UpperCAmelCase       :       Any							   =self.tool(text=snake_case  ,							question='What did Hugging Face do in April 2021?')
          self.assertEqual(snake_case  ,							'launched the BigScience Research Workshop')






       def       lowerCAmelCase		(      self)						->  str:




          '''simple docstring'''
          _UpperCAmelCase       :       Union[str, Any]							   =self.remote_tool(text=snake_case  ,							question='What did Hugging Face do in April 2021?')
          self.assertEqual(snake_case  ,							'launched the BigScience Research Workshop')






'''simple docstring'''






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


lowercase							=logging.get_logger(__name__)

lowercase							={
    '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  __magic_name__							(		lowerCAmelCase    ):
       UpperCAmelCase										="levit"






       def __init__(      self  ,							snake_case=2_2_4  ,							snake_case=3  ,							snake_case=3  ,							snake_case=2  ,							snake_case=1  ,							snake_case=1_6  ,							snake_case=[1_2_8, 2_5_6, 3_8_4]  ,							snake_case=[4, 8, 1_2]  ,							snake_case=[4, 4, 4]  ,							snake_case=[1_6, 1_6, 1_6]  ,							snake_case=0  ,							snake_case=[2, 2, 2]  ,							snake_case=[2, 2, 2]  ,							snake_case=0.02  ,							**snake_case  ,							)						->  Any:




          '''simple docstring'''
          super().__init__(**snake_case)
          _UpperCAmelCase       :       List[str]							   =image_size
          _UpperCAmelCase       :       str							   =num_channels
          _UpperCAmelCase       :       int							   =kernel_size
          _UpperCAmelCase       :       Any							   =stride
          _UpperCAmelCase       :       Tuple							   =padding
          _UpperCAmelCase       :       Optional[int]							   =hidden_sizes
          _UpperCAmelCase       :       List[str]							   =num_attention_heads
          _UpperCAmelCase       :       List[Any]							   =depths
          _UpperCAmelCase       :       Any							   =key_dim
          _UpperCAmelCase       :       List[Any]							   =drop_path_rate
          _UpperCAmelCase       :       int							   =patch_size
          _UpperCAmelCase       :       Tuple							   =attention_ratio
          _UpperCAmelCase       :       Any							   =mlp_ratio
          _UpperCAmelCase       :       Optional[Any]							   =initializer_range
          _UpperCAmelCase       :       str							   =[
              ['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  __magic_name__							(		lowerCAmelCase    ):
       UpperCAmelCase										=version.parse("1.11"    )






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




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






       @property
       def       lowerCAmelCase		(      self)						->  float:




          '''simple docstring'''
          return 1E-4

