

"""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       _UpperCAmelCase     (						unittest.TestCase      ,       _a):
			def 							__snake_case	(						self       )      ->      Dict:






				'''simple docstring'''







				_UpperCAmelCase      :							List[str]       =   load_tool("""image-captioning"""       )
				self.tool.setup()
				_UpperCAmelCase      :							Any       =   load_tool("""image-captioning""" ,						remote=snake_case_       )
			def 							__snake_case	(						self       )      ->      Dict:






				'''simple docstring'''







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






				'''simple docstring'''







				_UpperCAmelCase      :							str       =   Image.open(Path(get_tests_dir("""fixtures/tests_samples/COCO"""       )       ) / """000000039769.png"""       )
				_UpperCAmelCase      :							str       =   self.remote_tool(snake_case_       )
				self.assertEqual(snake_case_ ,						"""two cats sleeping on a couch"""       )
			def 							__snake_case	(						self       )      ->      int:






				'''simple docstring'''







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






				'''simple docstring'''







				_UpperCAmelCase      :							Union[str, Any]       =   Image.open(Path(get_tests_dir("""fixtures/tests_samples/COCO"""       )       ) / """000000039769.png"""       )
				_UpperCAmelCase      :							int       =   self.remote_tool(image=snake_case_       )
				self.assertEqual(snake_case_ ,						"""two cats sleeping on a couch"""       )








"""simple docstring"""






from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


lowerCamelCase__			:					int							  =					{'''configuration_qdqbert''': ['''QDQBERT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''QDQBertConfig''']}

try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						lowerCamelCase__			:					Optional[int]							  =					[
						    '''QDQBERT_PRETRAINED_MODEL_ARCHIVE_LIST''',
						    '''QDQBertForMaskedLM''',
						    '''QDQBertForMultipleChoice''',
						    '''QDQBertForNextSentencePrediction''',
						    '''QDQBertForQuestionAnswering''',
						    '''QDQBertForSequenceClassification''',
						    '''QDQBertForTokenClassification''',
						    '''QDQBertLayer''',
						    '''QDQBertLMHeadModel''',
						    '''QDQBertModel''',
						    '''QDQBertPreTrainedModel''',
						    '''load_tf_weights_in_qdqbert''',
						]


if TYPE_CHECKING:
						from .configuration_qdqbert import QDQBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, QDQBertConfig

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_qdqbert import (
												    QDQBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
												    QDQBertForMaskedLM,
												    QDQBertForMultipleChoice,
												    QDQBertForNextSentencePrediction,
												    QDQBertForQuestionAnswering,
												    QDQBertForSequenceClassification,
												    QDQBertForTokenClassification,
												    QDQBertLayer,
												    QDQBertLMHeadModel,
												    QDQBertModel,
												    QDQBertPreTrainedModel,
												    load_tf_weights_in_qdqbert,
												)


else:
						import sys

						lowerCamelCase__			:					Optional[Any]							  =					_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)





