






"""simple docstring"""





from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


_SCREAMING_SNAKE_CASE					:				List[str]					    =						{
    '''configuration_mobilebert''': [
        '''MOBILEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''MobileBertConfig''',
        '''MobileBertOnnxConfig''',
    ],
    '''tokenization_mobilebert''': ['''MobileBertTokenizer'''],
}

try:
  if not is_tokenizers_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  _SCREAMING_SNAKE_CASE					:				Optional[int]					    =						['''MobileBertTokenizerFast''']

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  _SCREAMING_SNAKE_CASE					:				Optional[int]					    =						[
      '''MOBILEBERT_PRETRAINED_MODEL_ARCHIVE_LIST''',
      '''MobileBertForMaskedLM''',
      '''MobileBertForMultipleChoice''',
      '''MobileBertForNextSentencePrediction''',
      '''MobileBertForPreTraining''',
      '''MobileBertForQuestionAnswering''',
      '''MobileBertForSequenceClassification''',
      '''MobileBertForTokenClassification''',
      '''MobileBertLayer''',
      '''MobileBertModel''',
      '''MobileBertPreTrainedModel''',
      '''load_tf_weights_in_mobilebert''',
  ]

try:
  if not is_tf_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  _SCREAMING_SNAKE_CASE					:				str					    =						[
      '''TF_MOBILEBERT_PRETRAINED_MODEL_ARCHIVE_LIST''',
      '''TFMobileBertForMaskedLM''',
      '''TFMobileBertForMultipleChoice''',
      '''TFMobileBertForNextSentencePrediction''',
      '''TFMobileBertForPreTraining''',
      '''TFMobileBertForQuestionAnswering''',
      '''TFMobileBertForSequenceClassification''',
      '''TFMobileBertForTokenClassification''',
      '''TFMobileBertMainLayer''',
      '''TFMobileBertModel''',
      '''TFMobileBertPreTrainedModel''',
  ]


if TYPE_CHECKING:
  from .configuration_mobilebert import (
      MOBILEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
      MobileBertConfig,
      MobileBertOnnxConfig,
  )
  from .tokenization_mobilebert import MobileBertTokenizer

  try:
    if not is_tokenizers_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .tokenization_mobilebert_fast import MobileBertTokenizerFast

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_mobilebert import (
        MOBILEBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
        MobileBertForMaskedLM,
        MobileBertForMultipleChoice,
        MobileBertForNextSentencePrediction,
        MobileBertForPreTraining,
        MobileBertForQuestionAnswering,
        MobileBertForSequenceClassification,
        MobileBertForTokenClassification,
        MobileBertLayer,
        MobileBertModel,
        MobileBertPreTrainedModel,
        load_tf_weights_in_mobilebert,
    )

  try:
    if not is_tf_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_tf_mobilebert import (
        TF_MOBILEBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
        TFMobileBertForMaskedLM,
        TFMobileBertForMultipleChoice,
        TFMobileBertForNextSentencePrediction,
        TFMobileBertForPreTraining,
        TFMobileBertForQuestionAnswering,
        TFMobileBertForSequenceClassification,
        TFMobileBertForTokenClassification,
        TFMobileBertMainLayer,
        TFMobileBertModel,
        TFMobileBertPreTrainedModel,
    )

else:
  import sys

  _SCREAMING_SNAKE_CASE					:				Union[str, Any]					    =						_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)












"""simple docstring"""





import unittest

from transformers import load_tool

from .test_tools_common import ToolTesterMixin


_SCREAMING_SNAKE_CASE					:				Optional[int]					    =						'''
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      a						(					unittest.TestCase  ,      __snake_case		):






    def    UpperCamelCase       (       self     :							int					)     ->		Optional[int]:
      lowerCamelCase_         =						load_tool('text-question-answering'					)
      self.tool.setup()
      lowerCamelCase_         =						load_tool('text-question-answering'       ,						remote=__SCREAMING_SNAKE_CASE					)






    def    UpperCamelCase       (       self     :							Dict					)     ->		Tuple:
      lowerCamelCase_         =						self.tool(__SCREAMING_SNAKE_CASE       ,						'What did Hugging Face do in April 2021?'					)
      self.assertEqual(__SCREAMING_SNAKE_CASE       ,						'launched the BigScience Research Workshop'					)






    def    UpperCamelCase       (       self     :							List[Any]					)     ->		Optional[int]:
      lowerCamelCase_         =						self.remote_tool(__SCREAMING_SNAKE_CASE       ,						'What did Hugging Face do in April 2021?'					)
      self.assertEqual(__SCREAMING_SNAKE_CASE       ,						'launched the BigScience Research Workshop'					)






    def    UpperCamelCase       (       self     :							List[str]					)     ->		Optional[int]:
      lowerCamelCase_         =						self.tool(text=__SCREAMING_SNAKE_CASE       ,						question='What did Hugging Face do in April 2021?'					)
      self.assertEqual(__SCREAMING_SNAKE_CASE       ,						'launched the BigScience Research Workshop'					)






    def    UpperCamelCase       (       self     :							Union[str, Any]					)     ->		int:
      lowerCamelCase_         =						self.remote_tool(text=__SCREAMING_SNAKE_CASE       ,						question='What did Hugging Face do in April 2021?'					)
      self.assertEqual(__SCREAMING_SNAKE_CASE       ,						'launched the BigScience Research Workshop'					)




