
import unittest

from transformers import load_tool

from .test_tools_common import ToolTesterMixin


_A  =	"\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       _lowerCAmelCase   (      unittest.TestCase   , __a			):




				def 	__a		(   self	)							-> Any:
							lowerCAmelCase_         =      load_tool("text-question-answering"	)
							self.tool.setup()
							lowerCAmelCase_         =      load_tool("text-question-answering"							,							remote=_UpperCamelCase	)




				def 	__a		(   self	)							-> Any:
							lowerCAmelCase_         =      self.tool(_UpperCamelCase							,							"What did Hugging Face do in April 2021?"	)
							self.assertEqual(_UpperCamelCase							,							"launched the BigScience Research Workshop"	)




				def 	__a		(   self	)							-> List[str]:
							lowerCAmelCase_         =      self.remote_tool(_UpperCamelCase							,							"What did Hugging Face do in April 2021?"	)
							self.assertEqual(_UpperCamelCase							,							"launched the BigScience Research Workshop"	)




				def 	__a		(   self	)							-> Dict:
							lowerCAmelCase_         =      self.tool(text=_UpperCamelCase							,							question="What did Hugging Face do in April 2021?"	)
							self.assertEqual(_UpperCamelCase							,							"launched the BigScience Research Workshop"	)




				def 	__a		(   self	)							-> Union[str, Any]:
							lowerCAmelCase_         =      self.remote_tool(text=_UpperCamelCase							,							question="What did Hugging Face do in April 2021?"	)
							self.assertEqual(_UpperCamelCase							,							"launched the BigScience Research Workshop"	)





from collections import OrderedDict
from typing import Mapping

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


_A  =	logging.get_logger(__name__)

_A  =	{
    "kssteven/ibert-roberta-base": "https://huggingface.co/kssteven/ibert-roberta-base/resolve/main/config.json",
    "kssteven/ibert-roberta-large": "https://huggingface.co/kssteven/ibert-roberta-large/resolve/main/config.json",
    "kssteven/ibert-roberta-large-mnli": (
        "https://huggingface.co/kssteven/ibert-roberta-large-mnli/resolve/main/config.json"
    ),
}





class       _lowerCAmelCase   (      __a			):
				_lowercase     						='''ibert'''




				def __init__(   self							,							_UpperCamelCase=30_522							,							_UpperCamelCase=768							,							_UpperCamelCase=12							,							_UpperCamelCase=12							,							_UpperCamelCase=3_072							,							_UpperCamelCase="gelu"							,							_UpperCamelCase=0.1							,							_UpperCamelCase=0.1							,							_UpperCamelCase=512							,							_UpperCamelCase=2							,							_UpperCamelCase=0.02							,							_UpperCamelCase=1e-1_2							,							_UpperCamelCase=1							,							_UpperCamelCase=0							,							_UpperCamelCase=2							,							_UpperCamelCase="absolute"							,							_UpperCamelCase=False							,							_UpperCamelCase="none"							,							**_UpperCamelCase							,							)							-> List[str]:
							super().__init__(pad_token_id=_UpperCamelCase							,							bos_token_id=_UpperCamelCase							,							eos_token_id=_UpperCamelCase							,							**_UpperCamelCase	)

							lowerCAmelCase_         =      vocab_size
							lowerCAmelCase_         =      hidden_size
							lowerCAmelCase_         =      num_hidden_layers
							lowerCAmelCase_         =      num_attention_heads
							lowerCAmelCase_         =      hidden_act
							lowerCAmelCase_         =      intermediate_size
							lowerCAmelCase_         =      hidden_dropout_prob
							lowerCAmelCase_         =      attention_probs_dropout_prob
							lowerCAmelCase_         =      max_position_embeddings
							lowerCAmelCase_         =      type_vocab_size
							lowerCAmelCase_         =      initializer_range
							lowerCAmelCase_         =      layer_norm_eps
							lowerCAmelCase_         =      position_embedding_type
							lowerCAmelCase_         =      quant_mode
							lowerCAmelCase_         =      force_dequant





class       _lowerCAmelCase   (      __a			):




				@property
				def 	__a		(   self	)							-> Mapping[str, Mapping[int, str]]:
							if self.task == "multiple-choice":
										lowerCAmelCase_         =      {0: "batch", 1: "choice", 2: "sequence"}
							else:
										lowerCAmelCase_         =      {0: "batch", 1: "sequence"}
							return OrderedDict(
							    [
							        ("input_ids", dynamic_axis),
							        ("attention_mask", dynamic_axis),
							    ]	)



