"""simple docstring"""


import unittest
from pathlib import Path

from transformers import is_vision_available, load_tool
from transformers.testing_utils import get_tests_dir

from .test_tools_common import ToolTesterMixin


if is_vision_available():
 from PIL import Image






class 					a					(				unittest.TestCase   ,		A_							):



  def        lowerCAmelCase_				(		self   :    Tuple     )      -> Dict:
      __a			      =						load_tool("""image-captioning"""     )
      self.tool.setup()
      __a			      =						load_tool("""image-captioning"""						,  remote=lowerCamelCase_     )



  def        lowerCAmelCase_				(		self   :    Dict     )      -> Optional[Any]:
      __a			      =						Image.open(Path(get_tests_dir("""fixtures/tests_samples/COCO"""     )     ) / """000000039769.png"""     )
      __a			      =						self.tool(lowerCamelCase_     )
      self.assertEqual(lowerCamelCase_						,  """two cats sleeping on a couch"""     )



  def        lowerCAmelCase_				(		self   :    Tuple     )      -> List[str]:
      __a			      =						Image.open(Path(get_tests_dir("""fixtures/tests_samples/COCO"""     )     ) / """000000039769.png"""     )
      __a			      =						self.remote_tool(lowerCamelCase_     )
      self.assertEqual(lowerCamelCase_						,  """two cats sleeping on a couch"""     )



  def        lowerCAmelCase_				(		self   :    List[str]     )      -> List[Any]:
      __a			      =						Image.open(Path(get_tests_dir("""fixtures/tests_samples/COCO"""     )     ) / """000000039769.png"""     )
      __a			      =						self.tool(image=lowerCamelCase_     )
      self.assertEqual(lowerCamelCase_						,  """two cats sleeping on a couch"""     )



  def        lowerCAmelCase_				(		self   :    Dict     )      -> List[Any]:
      __a			      =						Image.open(Path(get_tests_dir("""fixtures/tests_samples/COCO"""     )     ) / """000000039769.png"""     )
      __a			      =						self.remote_tool(image=lowerCamelCase_     )
      self.assertEqual(lowerCamelCase_						,  """two cats sleeping on a couch"""     )

"""simple docstring"""


from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available


__A       			=      {
    """configuration_realm""": ["""REALM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """RealmConfig"""],
    """tokenization_realm""": ["""RealmTokenizer"""],
}

try:
 if not is_tokenizers_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 __A       			=      ["""RealmTokenizerFast"""]

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 __A       			=      [
     """REALM_PRETRAINED_MODEL_ARCHIVE_LIST""",
     """RealmEmbedder""",
     """RealmForOpenQA""",
     """RealmKnowledgeAugEncoder""",
     """RealmPreTrainedModel""",
     """RealmReader""",
     """RealmScorer""",
     """load_tf_weights_in_realm""",
 ]
 __A       			=      ["""RealmRetriever"""]


if TYPE_CHECKING:
 from .configuration_realm import REALM_PRETRAINED_CONFIG_ARCHIVE_MAP, RealmConfig
 from .tokenization_realm import RealmTokenizer

 try:
  if not is_tokenizers_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .tokenization_realm import RealmTokenizerFast

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_realm import (
      REALM_PRETRAINED_MODEL_ARCHIVE_LIST,
      RealmEmbedder,
      RealmForOpenQA,
      RealmKnowledgeAugEncoder,
      RealmPreTrainedModel,
      RealmReader,
      RealmScorer,
      load_tf_weights_in_realm,
  )
  from .retrieval_realm import RealmRetriever


else:
 import sys

 __A       			=      _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)
