

"""simple docstring"""




from __future__ import annotations

import unittest

import numpy as np

from transformers import OPTConfig, is_tf_available
from transformers.testing_utils import require_sentencepiece, require_tf, slow

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
						import tensorflow as tf

						from transformers import GPTaTokenizer, TFOPTForCausalLM, TFOPTModel

def 		A				(   snake_case__						, snake_case__						, snake_case__=None						, snake_case__=None			):




			'''simple docstring'''


			if attention_mask is None:
						SCREAMING_SNAKE_CASE__									=					tf.cast(tf.math.not_equal(lowercase_						, config.pad_token_id			)						, tf.inta			)
			return {"input_ids": input_ids, "attention_mask": attention_mask}





@require_tf
class       lowerCamelCase  :
			lowerCamelCase__      :						str    						=							OPTConfig
			lowerCamelCase__      :						Optional[Any]    						=							{}
			lowerCamelCase__      :						Tuple    						=							'gelu'

			def __init__(    self :  Tuple			, __UpperCAmelCase :  Optional[int]			, __UpperCAmelCase :  Dict=1_3			, __UpperCAmelCase :  List[str]=7			, __UpperCAmelCase :  Dict=True			, __UpperCAmelCase :  Any=False			, __UpperCAmelCase :  Optional[int]=9_9			, __UpperCAmelCase :  Dict=1_6			, __UpperCAmelCase :  Dict=2			, __UpperCAmelCase :  Tuple=4			, __UpperCAmelCase :  Tuple=4			, __UpperCAmelCase :  int="gelu"			, __UpperCAmelCase :  List[str]=0.1			, __UpperCAmelCase :  Optional[Any]=0.1			, __UpperCAmelCase :  Dict=2_0			, __UpperCAmelCase :  Any=2			, __UpperCAmelCase :  Tuple=1			, __UpperCAmelCase :  str=0			, __UpperCAmelCase :  int=1_6			, __UpperCAmelCase :  List[Any]=1_6			, )      ->			Optional[int]:
						SCREAMING_SNAKE_CASE__									=					parent
						SCREAMING_SNAKE_CASE__									=					batch_size
						SCREAMING_SNAKE_CASE__									=					seq_length
						SCREAMING_SNAKE_CASE__									=					is_training
						SCREAMING_SNAKE_CASE__									=					use_labels
						SCREAMING_SNAKE_CASE__									=					vocab_size
						SCREAMING_SNAKE_CASE__									=					hidden_size
						SCREAMING_SNAKE_CASE__									=					num_hidden_layers
						SCREAMING_SNAKE_CASE__									=					num_attention_heads
						SCREAMING_SNAKE_CASE__									=					intermediate_size
						SCREAMING_SNAKE_CASE__									=					hidden_act
						SCREAMING_SNAKE_CASE__									=					hidden_dropout_prob
						SCREAMING_SNAKE_CASE__									=					attention_probs_dropout_prob
						SCREAMING_SNAKE_CASE__									=					max_position_embeddings
						SCREAMING_SNAKE_CASE__									=					eos_token_id
						SCREAMING_SNAKE_CASE__									=					pad_token_id
						SCREAMING_SNAKE_CASE__									=					bos_token_id
						SCREAMING_SNAKE_CASE__									=					embed_dim
						SCREAMING_SNAKE_CASE__									=					word_embed_proj_dim
						SCREAMING_SNAKE_CASE__									=					False

			def     SCREAMING_SNAKE_CASE (    self :  Tuple				)      ->			List[Any]:
						SCREAMING_SNAKE_CASE__									=					ids_tensor([self.batch_size, self.seq_length - 1]			, self.vocab_size				)
						SCREAMING_SNAKE_CASE__									=					tf.expand_dims(tf.constant([self.eos_token_id] * self.batch_size				)			, 1				)
						SCREAMING_SNAKE_CASE__									=					tf.concat([input_ids, eos_tensor]			, axis=1				)

						SCREAMING_SNAKE_CASE__									=					self.config_cls(
						    vocab_size=self.vocab_size			, hidden_size=self.hidden_size			, num_hidden_layers=self.num_hidden_layers			, num_attention_heads=self.num_attention_heads			, ffn_dim=self.intermediate_size			, dropout=self.hidden_dropout_prob			, attention_dropout=self.attention_probs_dropout_prob			, max_position_embeddings=self.max_position_embeddings			, eos_token_id=self.eos_token_id			, bos_token_id=self.bos_token_id			, pad_token_id=self.pad_token_id			, embed_dim=self.embed_dim			, word_embed_proj_dim=self.word_embed_proj_dim			, is_encoder_decoder=UpperCAmelCase__			, **self.config_updates			, )
						SCREAMING_SNAKE_CASE__									=					prepare_opt_inputs_dict(UpperCAmelCase__			, UpperCAmelCase__				)
						return config, inputs_dict





			def     SCREAMING_SNAKE_CASE (    self :  List[str]			, __UpperCAmelCase :  List[str]			, __UpperCAmelCase :  int				)      ->			Optional[Any]:
						SCREAMING_SNAKE_CASE__									=					TFOPTModel(config=UpperCAmelCase__				)
						SCREAMING_SNAKE_CASE__									=					inputs_dict["""input_ids"""]

						SCREAMING_SNAKE_CASE__									=					input_ids[:1, :]
						SCREAMING_SNAKE_CASE__									=					inputs_dict["""attention_mask"""][:1, :]
						SCREAMING_SNAKE_CASE__									=					1

						# first forward pass
						SCREAMING_SNAKE_CASE__									=					model(UpperCAmelCase__			, attention_mask=UpperCAmelCase__			, use_cache=UpperCAmelCase__				)

						SCREAMING_SNAKE_CASE__							,						SCREAMING_SNAKE_CASE__									=					outputs.to_tuple()

						# create hypothetical next token and extent to next_input_ids
						SCREAMING_SNAKE_CASE__									=					ids_tensor((self.batch_size, 3)			, config.vocab_size				)
						SCREAMING_SNAKE_CASE__									=					tf.cast(ids_tensor((self.batch_size, 3)			, 2				)			, tf.inta				)

						# append to next input_ids and
						SCREAMING_SNAKE_CASE__									=					tf.concat([input_ids, next_tokens]			, axis=-1				)
						SCREAMING_SNAKE_CASE__									=					tf.concat([attention_mask, next_attn_mask]			, axis=-1				)

						SCREAMING_SNAKE_CASE__									=					model(UpperCAmelCase__			, attention_mask=UpperCAmelCase__				)[0]
						SCREAMING_SNAKE_CASE__									=					model(UpperCAmelCase__			, attention_mask=UpperCAmelCase__			, past_key_values=UpperCAmelCase__				)[0]

						self.parent.assertEqual(next_tokens.shape[1]			, output_from_past.shape[1]				)

						# select random slice
						SCREAMING_SNAKE_CASE__									=					int(ids_tensor((1,)			, output_from_past.shape[-1]				)				)
						SCREAMING_SNAKE_CASE__									=					output_from_no_past[:, -3:, random_slice_idx]
						SCREAMING_SNAKE_CASE__									=					output_from_past[:, :, random_slice_idx]

						# test that outputs are equal for slice
						tf.debugging.assert_near(UpperCAmelCase__			, UpperCAmelCase__			, rtol=1e-3				)





@require_tf
class       lowerCamelCase  (UpperCAmelCase__	,UpperCAmelCase__	,unittest.TestCase	):
			lowerCamelCase__      :						Tuple    						=							(TFOPTModel, TFOPTForCausalLM) if is_tf_available() else ()
			lowerCamelCase__      :						Tuple    						=							(TFOPTForCausalLM,) if is_tf_available() else ()
			lowerCamelCase__      :						Optional[int]    						=							(
			    {'feature-extraction': TFOPTModel, 'text-generation': TFOPTForCausalLM} if is_tf_available() else {}
			)
			lowerCamelCase__      :						str    						=							False
			lowerCamelCase__      :						Union[str, Any]    						=							False
			lowerCamelCase__      :						Any    						=							False
			lowerCamelCase__      :						Dict    						=							1_0

			def     SCREAMING_SNAKE_CASE (    self :  str				)      ->			Any:
						SCREAMING_SNAKE_CASE__									=					TFOPTModelTester(self				)
						SCREAMING_SNAKE_CASE__									=					ConfigTester(self			, config_class=UpperCAmelCase__				)

			def     SCREAMING_SNAKE_CASE (    self :  Union[str, Any]				)      ->			List[Any]:
						self.config_tester.run_common_tests()

			def     SCREAMING_SNAKE_CASE (    self :  List[Any]				)      ->			Dict:
						SCREAMING_SNAKE_CASE__									=					self.model_tester.prepare_config_and_inputs_for_common()
						self.model_tester.check_decoder_model_past_large_inputs(*UpperCAmelCase__				)





			def     SCREAMING_SNAKE_CASE (    self :  Optional[Any]				)      ->			Any:
						SCREAMING_SNAKE_CASE__							,						SCREAMING_SNAKE_CASE__									=					self.model_tester.prepare_config_and_inputs_for_common()

						def _get_word_embedding_weight(__UpperCAmelCase :  List[str]			, __UpperCAmelCase :  Optional[Any]				):
									if hasattr(UpperCAmelCase__			, """weight"""				):
												return embedding_layer.weight
									else:
												# Here we build the word embeddings weights if not exists.
												# And then we retry to get the attribute once built.
												model.build()
												if hasattr(UpperCAmelCase__			, """weight"""				):
															return embedding_layer.weight
												else:
															return None

						for model_class in self.all_model_classes:
									for size in [config.vocab_size - 1_0, config.vocab_size + 1_0]:
												# build the embeddings
												SCREAMING_SNAKE_CASE__									=					model_class(config=UpperCAmelCase__				)
												SCREAMING_SNAKE_CASE__									=					_get_word_embedding_weight(UpperCAmelCase__			, model.get_input_embeddings()				)
												SCREAMING_SNAKE_CASE__									=					_get_word_embedding_weight(UpperCAmelCase__			, model.get_output_embeddings()				)

												# reshape the embeddings
												model.resize_token_embeddings(UpperCAmelCase__				)
												SCREAMING_SNAKE_CASE__									=					_get_word_embedding_weight(UpperCAmelCase__			, model.get_input_embeddings()				)
												SCREAMING_SNAKE_CASE__									=					_get_word_embedding_weight(UpperCAmelCase__			, model.get_output_embeddings()				)

												# check that the resized embeddings size matches the desired size.
												SCREAMING_SNAKE_CASE__									=					size if size is not None else config.vocab_size

												self.assertEqual(new_input_embeddings.shape[0]			, UpperCAmelCase__				)

												# check that weights remain the same after resizing
												SCREAMING_SNAKE_CASE__									=					True
												for pa, pa in zip(old_input_embeddings.value()			, new_input_embeddings.value()				):
															if tf.math.reduce_sum(tf.math.abs(pa - pa				)				) > 0:
																		SCREAMING_SNAKE_CASE__									=					False
												self.assertTrue(UpperCAmelCase__				)

												if old_output_embeddings is not None and new_output_embeddings is not None:
															self.assertEqual(new_output_embeddings.shape[0]			, UpperCAmelCase__				)

															SCREAMING_SNAKE_CASE__									=					True
															for pa, pa in zip(old_output_embeddings.value()			, new_output_embeddings.value()				):
																		if tf.math.reduce_sum(tf.math.abs(pa - pa				)				) > 0:
																					SCREAMING_SNAKE_CASE__									=					False
															self.assertTrue(UpperCAmelCase__				)

def 		A				(   snake_case__			):




			'''simple docstring'''


			return tf.constant(lowercase_						, dtype=tf.intaa			)





@require_tf
class       lowerCamelCase  (unittest.TestCase	):
			lowerCamelCase__      :						Tuple    						=							9_9

			def     SCREAMING_SNAKE_CASE (    self :  Any				)      ->			Optional[Any]:
						SCREAMING_SNAKE_CASE__									=					tf.ones((4, 1)			, dtype=tf.intaa				) * 2
						SCREAMING_SNAKE_CASE__									=					tf.concat([ids_tensor((4, 6)			, self.vocab_size - 3				) + 3, eos_column_vector]			, axis=1				)
						SCREAMING_SNAKE_CASE__									=					input_ids.shape[0]
						SCREAMING_SNAKE_CASE__									=					OPTConfig(
						    vocab_size=self.vocab_size			, hidden_size=2_4			, num_hidden_layers=2			, num_attention_heads=2			, ffn_dim=3_2			, max_position_embeddings=4_8			, eos_token_id=2			, pad_token_id=1			, bos_token_id=0			, )
						return config, input_ids, batch_size





@require_sentencepiece
@require_tf
class       lowerCamelCase  (unittest.TestCase	):

			@slow
			def     SCREAMING_SNAKE_CASE (    self :  Any				)      ->			Dict:
						SCREAMING_SNAKE_CASE__									=					TFOPTModel.from_pretrained("""facebook/opt-350m"""				)
						SCREAMING_SNAKE_CASE__									=					_long_tensor([[0, 3_1_4_1_4, 2_3_2, 3_2_8, 7_4_0, 1_1_4_0, 1_2_6_9_5, 6_9, 4_6_0_7_8, 1_5_8_8, 2]]				)
						SCREAMING_SNAKE_CASE__									=					tf.not_equal(UpperCAmelCase__			, model.config.pad_token_id				)
						with tf.GradientTape():
									SCREAMING_SNAKE_CASE__									=					model(input_ids=UpperCAmelCase__			, attention_mask=UpperCAmelCase__				).last_hidden_state
						SCREAMING_SNAKE_CASE__									=					(1, 1_1, 5_1_2)
						self.assertEqual(output.shape			, UpperCAmelCase__				)
						SCREAMING_SNAKE_CASE__									=					tf.constant(
						    [[-0.2_873, -1.9_218, -0.3_033], [-1.2_710, -0.1_338, -0.1_902], [0.4_095, 0.1_214, -1.3_121]]				)
						self.assertTrue(np.allclose(output[:, :3, :3]			, UpperCAmelCase__			, atol=4e-3				)				)

						SCREAMING_SNAKE_CASE__									=					tf.function(UpperCAmelCase__			, jit_compile=UpperCAmelCase__				)
						SCREAMING_SNAKE_CASE__									=					xla_generate(UpperCAmelCase__			, UpperCAmelCase__				)[0]
						self.assertTrue(np.allclose(output[:, :3, :3]			, UpperCAmelCase__			, atol=4e-2				)				)





@require_tf
@slow
class       lowerCamelCase  (unittest.TestCase	):

			def     SCREAMING_SNAKE_CASE (    self :  Union[str, Any]				)      ->			str:
						super().setUp()
						SCREAMING_SNAKE_CASE__									=					"""facebook/opt-350m"""





			def     SCREAMING_SNAKE_CASE (    self :  Optional[int]				)      ->			Optional[int]:
						SCREAMING_SNAKE_CASE__									=					TFOPTForCausalLM.from_pretrained(self.path_model				)
						SCREAMING_SNAKE_CASE__									=					GPTaTokenizer.from_pretrained(self.path_model				)

						SCREAMING_SNAKE_CASE__									=					[
						    """Today is a beautiful day and I want to""",
						    """In the city of""",
						    """Paris is the capital of France and""",
						    """Computers and mobile phones have taken""",
						]
						# verify that prompt without BOS token is identical to Metaseq -> add_special_tokens=False
						SCREAMING_SNAKE_CASE__									=					tokenizer(UpperCAmelCase__			, return_tensors="""tf"""			, padding=UpperCAmelCase__			, add_special_tokens=UpperCAmelCase__				)
						SCREAMING_SNAKE_CASE__									=					tf.math.reduce_mean(model(inputs.input_ids			, attention_mask=inputs.attention_mask				)[0]			, axis=-1				)
						SCREAMING_SNAKE_CASE__									=					tf.constant(
						    [
						        [1.3_851, -13.8_923, -10.5_229, -10.7_533, -0.2_309, -10.2_384, -0.5_365, -9.0_947, -5.1_670],
						        [-4.7_073, -10.6_276, -3.9_415, -21.5_242, -0.2_822, -0.2_822, -0.2_822, -0.2_822, -0.2_822],
						        [0.6_247, -3.4_229, -8.9_179, -1.4_297, -14.1_650, 1.4_146, -9.0_218, -0.2_703, -0.2_703],
						        [6.4_783, -1.9_913, -10.7_926, -2.3_336, 1.5_092, -0.9_974, -6.8_213, 1.3_477, 1.3_477],
						    ]				)
						self.assertTrue(np.allclose(UpperCAmelCase__			, UpperCAmelCase__			, atol=1e-4				)				)

						SCREAMING_SNAKE_CASE__									=					tf.function(UpperCAmelCase__			, jit_compile=UpperCAmelCase__				)
						SCREAMING_SNAKE_CASE__									=					tf.math.reduce_mean(xla_generate(inputs.input_ids			, attention_mask=inputs.attention_mask				)[0]			, axis=-1				)
						self.assertTrue(np.allclose(UpperCAmelCase__			, UpperCAmelCase__			, atol=1e-4				)				)





@require_tf
@slow
class       lowerCamelCase  (unittest.TestCase	):

			@property
			def     SCREAMING_SNAKE_CASE (    self :  Tuple				)      ->			int:
						return [
						    "Today is a beautiful day and I want",
						    "In the city of",
						    "Paris is the capital of France and",
						    "Computers and mobile phones have taken",
						]

			def     SCREAMING_SNAKE_CASE (    self :  List[Any]				)      ->			Dict:
						SCREAMING_SNAKE_CASE__									=					"""facebook/opt-125m"""

						SCREAMING_SNAKE_CASE__									=					[
						    """Today is a beautiful day and I want to""",
						    """In the city of New York, the city""",
						    """Paris is the capital of France and the capital""",
						    """Computers and mobile phones have taken over the""",
						]

						SCREAMING_SNAKE_CASE__									=					[]
						SCREAMING_SNAKE_CASE__									=					GPTaTokenizer.from_pretrained(UpperCAmelCase__				)
						SCREAMING_SNAKE_CASE__									=					TFOPTForCausalLM.from_pretrained(UpperCAmelCase__				)

						for prompt in self.prompts:
									SCREAMING_SNAKE_CASE__									=					tokenizer(UpperCAmelCase__			, return_tensors="""tf"""				).input_ids

									SCREAMING_SNAKE_CASE__									=					model.generate(UpperCAmelCase__			, max_length=1_0				)

									SCREAMING_SNAKE_CASE__									=					tokenizer.batch_decode(UpperCAmelCase__			, skip_special_tokens=UpperCAmelCase__				)
									predicted_outputs += generated_string

						self.assertListEqual(UpperCAmelCase__			, UpperCAmelCase__				)

			def     SCREAMING_SNAKE_CASE (    self :  List[str]				)      ->			Optional[Any]:
						SCREAMING_SNAKE_CASE__									=					"""facebook/opt-350m"""

						SCREAMING_SNAKE_CASE__									=					GPTaTokenizer.from_pretrained(UpperCAmelCase__				)
						SCREAMING_SNAKE_CASE__									=					TFOPTForCausalLM.from_pretrained(UpperCAmelCase__				)

						SCREAMING_SNAKE_CASE__									=					"""left"""

						# use different length sentences to test batching
						SCREAMING_SNAKE_CASE__									=					[
						    """Hello, my dog is a little""",
						    """Today, I""",
						]

						SCREAMING_SNAKE_CASE__									=					tokenizer(UpperCAmelCase__			, return_tensors="""tf"""			, padding=UpperCAmelCase__				)
						SCREAMING_SNAKE_CASE__									=					inputs["""input_ids"""]

						SCREAMING_SNAKE_CASE__									=					model.generate(input_ids=UpperCAmelCase__			, attention_mask=inputs["""attention_mask"""]				)

						SCREAMING_SNAKE_CASE__									=					tokenizer(sentences[0]			, return_tensors="""tf"""				).input_ids
						SCREAMING_SNAKE_CASE__									=					model.generate(input_ids=UpperCAmelCase__				)

						SCREAMING_SNAKE_CASE__									=					inputs_non_padded.shape[-1] - tf.math.reduce_sum(
						    tf.cast(inputs["""attention_mask"""][-1]			, tf.intaa				)				)
						SCREAMING_SNAKE_CASE__									=					tokenizer(sentences[1]			, return_tensors="""tf"""				).input_ids
						SCREAMING_SNAKE_CASE__									=					model.generate(input_ids=UpperCAmelCase__			, max_length=model.config.max_length - num_paddings				)

						SCREAMING_SNAKE_CASE__									=					tokenizer.batch_decode(UpperCAmelCase__			, skip_special_tokens=UpperCAmelCase__				)
						SCREAMING_SNAKE_CASE__									=					tokenizer.decode(output_non_padded[0]			, skip_special_tokens=UpperCAmelCase__				)
						SCREAMING_SNAKE_CASE__									=					tokenizer.decode(output_padded[0]			, skip_special_tokens=UpperCAmelCase__				)

						SCREAMING_SNAKE_CASE__									=					[
						    """Hello, my dog is a little bit of a dork.\nI\'m a little bit""",
						    """Today, I was in the middle of a conversation with a friend about the""",
						]
						self.assertListEqual(UpperCAmelCase__			, UpperCAmelCase__				)
						self.assertListEqual(UpperCAmelCase__			, [non_padded_sentence, padded_sentence]				)





			def     SCREAMING_SNAKE_CASE (    self :  Union[str, Any]				)      ->			Dict:
						SCREAMING_SNAKE_CASE__									=					"""facebook/opt-350m"""

						SCREAMING_SNAKE_CASE__									=					[
						    """Today is a beautiful day and I want to""",
						    """In the city of San Francisco, the city""",
						    """Paris is the capital of France and the capital""",
						    """Computers and mobile phones have taken over the""",
						]

						SCREAMING_SNAKE_CASE__									=					[]
						SCREAMING_SNAKE_CASE__									=					GPTaTokenizer.from_pretrained(UpperCAmelCase__				)
						SCREAMING_SNAKE_CASE__									=					TFOPTForCausalLM.from_pretrained(UpperCAmelCase__				)

						for prompt in self.prompts:
									SCREAMING_SNAKE_CASE__									=					tokenizer(UpperCAmelCase__			, return_tensors="""tf"""				).input_ids

									SCREAMING_SNAKE_CASE__									=					model.generate(UpperCAmelCase__			, max_length=1_0				)

									SCREAMING_SNAKE_CASE__									=					tokenizer.batch_decode(UpperCAmelCase__			, skip_special_tokens=UpperCAmelCase__				)
									predicted_outputs += generated_string

						self.assertListEqual(UpperCAmelCase__			, UpperCAmelCase__				)








import os
import sys
import unittest


_lowerCamelCase	:		Optional[Any]							       =   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,
)


_lowerCamelCase	:		Any							       =   os.path.join("""tests""", """models""", """bert""", """test_modeling_bert.py""")
_lowerCamelCase	:		str							       =   os.path.join("""tests""", """models""", """blip""", """test_modeling_blip.py""")


class 				UpperCamelCase_    ( unittest.TestCase     ):

    '''simple docstring'''






    def        SCREAMING_SNAKE_CASE							(			self      :	Tuple)						->Tuple:





           '''simple docstring'''

           A__       =    get_test_to_tester_mapping(UpperCAmelCase__)
           A__       =    get_test_to_tester_mapping(UpperCAmelCase__)

           A__       =    {'''BertModelTest''': '''BertModelTester'''}

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

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


    def        SCREAMING_SNAKE_CASE							(			self      :	Tuple)						->List[Any]:





           '''simple docstring'''

           A__       =    get_model_to_test_mapping(UpperCAmelCase__)
           A__       =    get_model_to_test_mapping(UpperCAmelCase__)

           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(UpperCAmelCase__)					, UpperCAmelCase__)
           self.assertEqual(get_test_info.to_json(UpperCAmelCase__)					, UpperCAmelCase__)





    def        SCREAMING_SNAKE_CASE							(			self      :	Optional[Any])						->str:





           '''simple docstring'''

           A__       =    get_model_to_tester_mapping(UpperCAmelCase__)
           A__       =    get_model_to_tester_mapping(UpperCAmelCase__)

           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(UpperCAmelCase__)					, UpperCAmelCase__)
           self.assertEqual(get_test_info.to_json(UpperCAmelCase__)					, UpperCAmelCase__)


