




"""simple docstring"""

import os
import sys
import unittest


a					=			os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
sys.path.append(os.path.join(git_repo_path, '''utils'''))

import get_test_info  # noqa: E402
from get_test_info import (  # noqa: E402
    get_model_to_test_mapping,
    get_model_to_tester_mapping,
    get_test_to_tester_mapping,
)


a					=			os.path.join('''tests''', '''models''', '''bert''', '''test_modeling_bert.py''')
a					=			os.path.join('''tests''', '''models''', '''blip''', '''test_modeling_blip.py''')





class 				lowercase_       (     unittest.TestCase							):



 '''simple docstring'''

 def 			lowerCAmelCase_							( self       :       int		):
       _A					   =   get_test_to_tester_mapping(_a		)
       _A					   =   get_test_to_tester_mapping(_a		)

       _A					   =   {'''BertModelTest''': '''BertModelTester'''}

       _A					   =   {
           '''BlipModelTest''': '''BlipModelTester''',
           '''BlipTextImageModelTest''': '''BlipTextImageModelsModelTester''',
           '''BlipTextModelTest''': '''BlipTextModelTester''',
           '''BlipTextRetrievalModelTest''': '''BlipTextRetrievalModelTester''',
           '''BlipVQAModelTest''': '''BlipVQAModelTester''',
           '''BlipVisionModelTest''': '''BlipVisionModelTester''',
       }

       self.assertEqual(get_test_info.to_json(_a		)    ,							_a		)
       self.assertEqual(get_test_info.to_json(_a		)    ,							_a		)

 def 			lowerCAmelCase_							( self       :       List[Any]		):
       _A					   =   get_model_to_test_mapping(_a		)
       _A					   =   get_model_to_test_mapping(_a		)

       _A					   =   {
           '''BertForMaskedLM''': ['''BertModelTest'''],
           '''BertForMultipleChoice''': ['''BertModelTest'''],
           '''BertForNextSentencePrediction''': ['''BertModelTest'''],
           '''BertForPreTraining''': ['''BertModelTest'''],
           '''BertForQuestionAnswering''': ['''BertModelTest'''],
           '''BertForSequenceClassification''': ['''BertModelTest'''],
           '''BertForTokenClassification''': ['''BertModelTest'''],
           '''BertLMHeadModel''': ['''BertModelTest'''],
           '''BertModel''': ['''BertModelTest'''],
       }

       _A					   =   {
           '''BlipForConditionalGeneration''': ['''BlipTextImageModelTest'''],
           '''BlipForImageTextRetrieval''': ['''BlipTextRetrievalModelTest'''],
           '''BlipForQuestionAnswering''': ['''BlipVQAModelTest'''],
           '''BlipModel''': ['''BlipModelTest'''],
           '''BlipTextModel''': ['''BlipTextModelTest'''],
           '''BlipVisionModel''': ['''BlipVisionModelTest'''],
       }

       self.assertEqual(get_test_info.to_json(_a		)    ,							_a		)
       self.assertEqual(get_test_info.to_json(_a		)    ,							_a		)



 def 			lowerCAmelCase_							( self       :       Optional[int]		):
       _A					   =   get_model_to_tester_mapping(_a		)
       _A					   =   get_model_to_tester_mapping(_a		)

       _A					   =   {
           '''BertForMaskedLM''': ['''BertModelTester'''],
           '''BertForMultipleChoice''': ['''BertModelTester'''],
           '''BertForNextSentencePrediction''': ['''BertModelTester'''],
           '''BertForPreTraining''': ['''BertModelTester'''],
           '''BertForQuestionAnswering''': ['''BertModelTester'''],
           '''BertForSequenceClassification''': ['''BertModelTester'''],
           '''BertForTokenClassification''': ['''BertModelTester'''],
           '''BertLMHeadModel''': ['''BertModelTester'''],
           '''BertModel''': ['''BertModelTester'''],
       }

       _A					   =   {
           '''BlipForConditionalGeneration''': ['''BlipTextImageModelsModelTester'''],
           '''BlipForImageTextRetrieval''': ['''BlipTextRetrievalModelTester'''],
           '''BlipForQuestionAnswering''': ['''BlipVQAModelTester'''],
           '''BlipModel''': ['''BlipModelTester'''],
           '''BlipTextModel''': ['''BlipTextModelTester'''],
           '''BlipVisionModel''': ['''BlipVisionModelTester'''],
       }

       self.assertEqual(get_test_info.to_json(_a		)    ,							_a		)
       self.assertEqual(get_test_info.to_json(_a		)    ,							_a		)




from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


a__				=		logging.get_logger(__name__)

a__				=		{
    '''google/bit-50''': '''https://huggingface.co/google/bit-50/resolve/main/config.json''',
}

class 				UpperCAmelCase_		(			__lowercase				,       __lowercase   ):
							"""simple docstring"""







							UpperCAmelCase__       :						Any	    =    "bit"
							UpperCAmelCase__       :						Optional[int]	    =    ["preactivation", "bottleneck"]
							UpperCAmelCase__       :						Optional[Any]	    =    ["SAME", "VALID"]


							def __init__(			self       ,							_a=3       ,							_a=6_4       ,							_a=[2_5_6, 5_1_2, 1_0_2_4, 2_0_4_8]       ,							_a=[3, 4, 6, 3]       ,							_a="preactivation"       ,							_a="relu"       ,							_a=None       ,							_a=3_2       ,							_a=0.0       ,							_a=False       ,							_a=3_2       ,							_a=1       ,							_a=None       ,							_a=None       ,							**_a       ,							)    ->    Union[str, Any]:
												super().__init__(**_a       )
												if layer_type not in self.layer_types:
																	raise ValueError(F"""layer_type={layer_type} is not one of {','.join(self.layer_types       )}"""       )
												if global_padding is not None:
																	if global_padding.upper() in self.supported_padding:
																						_a	:    Any         =		global_padding.upper()
																	else:
																						raise ValueError(F"""Padding strategy {global_padding} not supported"""       )
												_a	:    Optional[int]         =		num_channels
												_a	:    List[Any]         =		embedding_size
												_a	:    Any         =		hidden_sizes
												_a	:    int         =		depths
												_a	:    Dict         =		layer_type
												_a	:    int         =		hidden_act
												_a	:    Optional[Any]         =		global_padding
												_a	:    Optional[Any]         =		num_groups
												_a	:    Union[str, Any]         =		drop_path_rate
												_a	:    Tuple         =		embedding_dynamic_padding
												_a	:    Union[str, Any]         =		output_stride
												_a	:    Any         =		width_factor

												_a	:    Any         =		['''stem'''] + [F"""stage{idx}""" for idx in range(1       ,							len(_a       ) + 1       )]
												_a      ,					_a	:    List[str]         =		get_aligned_output_features_output_indices(
												    out_features=_a       ,							out_indices=_a       ,							stage_names=self.stage_names       )



