




import os
import sys
import unittest


lowercase__				:     int 		=						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,
)


lowercase__				:     Optional[Any] 		=						os.path.join("tests", "models", "bert", "test_modeling_bert.py")
lowercase__				:     Optional[Any] 		=						os.path.join("tests", "models", "blip", "test_modeling_blip.py")
class 		UpperCAmelCase   (				unittest.TestCase			):







						'''simple docstring'''





						def        snake_case__						(						self							:     Any						):






							"""simple docstring"""






							snake_case_		    =     get_test_to_tester_mapping(__lowercase						)
							snake_case_		    =     get_test_to_tester_mapping(__lowercase						)

							snake_case_		    =     {"BertModelTest": "BertModelTester"}

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

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






						def        snake_case__						(						self							:     Optional[Any]						):






							"""simple docstring"""






							snake_case_		    =     get_model_to_test_mapping(__lowercase						)
							snake_case_		    =     get_model_to_test_mapping(__lowercase						)

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

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

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






						def        snake_case__						(						self							:     Tuple						):






							"""simple docstring"""






							snake_case_		    =     get_model_to_tester_mapping(__lowercase						)
							snake_case_		    =     get_model_to_tester_mapping(__lowercase						)

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

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

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






from torch import nn


def 						lowerCamelCase__    (		_A							):







	'''simple docstring'''





	if act_fn in ["swish", "silu"]:
		return nn.SiLU()
	elif act_fn == "mish":
		return nn.Mish()
	elif act_fn == "gelu":
		return nn.GELU()
	else:
		raise ValueError(f"Unsupported activation function: {act_fn}"							)
