


from ...configuration_utils import PretrainedConfig
from ...utils import logging


UpperCAmelCase     =       logging.get_logger(__name__)

UpperCAmelCase     =       {
    """microsoft/mpnet-base""": """https://huggingface.co/microsoft/mpnet-base/resolve/main/config.json""",
}







class lowerCAmelCase_		(					lowerCamelCase__			):

 '''simple docstring'''

 __snake_case				=    "mpnet"



 def __init__(      self						, _UpperCAmelCase=3_05_27						, _UpperCAmelCase=7_68						, _UpperCAmelCase=12						, _UpperCAmelCase=12						, _UpperCAmelCase=30_72						, _UpperCAmelCase="gelu"						, _UpperCAmelCase=0.1						, _UpperCAmelCase=0.1						, _UpperCAmelCase=5_12						, _UpperCAmelCase=0.02						, _UpperCAmelCase=1E-12						, _UpperCAmelCase=32						, _UpperCAmelCase=1						, _UpperCAmelCase=0						, _UpperCAmelCase=2						, **_UpperCAmelCase						, ):
       super().__init__(pad_token_id=_UpperCAmelCase						, bos_token_id=_UpperCAmelCase						, eos_token_id=_UpperCAmelCase						, **_UpperCAmelCase   )

       snake_case_			= vocab_size
       snake_case_			= hidden_size
       snake_case_			= num_hidden_layers
       snake_case_			= num_attention_heads
       snake_case_			= hidden_act
       snake_case_			= intermediate_size
       snake_case_			= hidden_dropout_prob
       snake_case_			= attention_probs_dropout_prob
       snake_case_			= max_position_embeddings
       snake_case_			= initializer_range
       snake_case_			= layer_norm_eps
       snake_case_			= relative_attention_num_buckets



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 lowerCAmelCase_		(					unittest.TestCase   ,		lowerCamelCase__			):

 '''simple docstring'''

 def 		UpperCamelCase__	(      self   ):
       snake_case_			= load_tool('''image-question-answering'''   )
       self.tool.setup()
       snake_case_			= load_tool('''image-question-answering'''						, remote=_UpperCAmelCase   )



 def 		UpperCamelCase__	(      self   ):
       snake_case_			= Image.open(Path(get_tests_dir('''fixtures/tests_samples/COCO'''   )   ) / '''000000039769.png'''   )
       snake_case_			= self.tool(_UpperCAmelCase						, '''How many cats are sleeping on the couch?'''   )
       self.assertEqual(_UpperCAmelCase						, '''2'''   )



 def 		UpperCamelCase__	(      self   ):
       snake_case_			= Image.open(Path(get_tests_dir('''fixtures/tests_samples/COCO'''   )   ) / '''000000039769.png'''   )
       snake_case_			= self.remote_tool(_UpperCAmelCase						, '''How many cats are sleeping on the couch?'''   )
       self.assertEqual(_UpperCAmelCase						, '''2'''   )



 def 		UpperCamelCase__	(      self   ):
       snake_case_			= Image.open(Path(get_tests_dir('''fixtures/tests_samples/COCO'''   )   ) / '''000000039769.png'''   )
       snake_case_			= self.tool(image=_UpperCAmelCase						, question='''How many cats are sleeping on the couch?'''   )
       self.assertEqual(_UpperCAmelCase						, '''2'''   )





 def 		UpperCamelCase__	(      self   ):
       snake_case_			= Image.open(Path(get_tests_dir('''fixtures/tests_samples/COCO'''   )   ) / '''000000039769.png'''   )
       snake_case_			= self.remote_tool(image=_UpperCAmelCase						, question='''How many cats are sleeping on the couch?'''   )
       self.assertEqual(_UpperCAmelCase						, '''2'''   )