





'''simple docstring'''




import unittest

from transformers import MraConfig, is_torch_available
from transformers.testing_utils import require_torch, slow, torch_device

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask


if is_torch_available():
							import torch

							from transformers import (
							    MraForMaskedLM,
							    MraForMultipleChoice,
							    MraForQuestionAnswering,
							    MraForSequenceClassification,
							    MraForTokenClassification,
							    MraModel,
							)
							from transformers.models.mra.modeling_mra import MRA_PRETRAINED_MODEL_ARCHIVE_LIST




class      UpperCamelCase__					:




					"""simple docstring"""


					def __init__(						self				:			Optional[int]      ,						lowerCamelCase_				:			Union[str, Any]      ,						lowerCamelCase_				:			str=2      ,						lowerCamelCase_				:			str=8      ,						lowerCamelCase_				:			Dict=True      ,						lowerCamelCase_				:			Optional[int]=True      ,						lowerCamelCase_				:			Optional[int]=True      ,						lowerCamelCase_				:			Optional[int]=True      ,						lowerCamelCase_				:			Any=99      ,						lowerCamelCase_				:			Optional[int]=16      ,						lowerCamelCase_				:			Optional[int]=5      ,						lowerCamelCase_				:			List[str]=2      ,						lowerCamelCase_				:			int=36      ,						lowerCamelCase_				:			str="gelu"      ,						lowerCamelCase_				:			Optional[Any]=0.0      ,						lowerCamelCase_				:			Optional[Any]=0.0      ,						lowerCamelCase_				:			List[str]=5_12      ,						lowerCamelCase_				:			str=16      ,						lowerCamelCase_				:			int=2      ,						lowerCamelCase_				:			Tuple=0.02      ,						lowerCamelCase_				:			Tuple=3      ,						lowerCamelCase_				:			Dict=4      ,						lowerCamelCase_				:			Optional[Any]=None      ,						):

							'''simple docstring'''



							SCREAMING_SNAKE_CASE :				Dict		=			parent
							SCREAMING_SNAKE_CASE :				Optional[Any]		=			batch_size
							SCREAMING_SNAKE_CASE :				Union[str, Any]		=			seq_length
							SCREAMING_SNAKE_CASE :				List[Any]		=			is_training
							SCREAMING_SNAKE_CASE :				Dict		=			use_input_mask
							SCREAMING_SNAKE_CASE :				List[str]		=			use_token_type_ids
							SCREAMING_SNAKE_CASE :				Optional[Any]		=			use_labels
							SCREAMING_SNAKE_CASE :				Optional[Any]		=			vocab_size
							SCREAMING_SNAKE_CASE :				List[str]		=			hidden_size
							SCREAMING_SNAKE_CASE :				int		=			num_hidden_layers
							SCREAMING_SNAKE_CASE :				str		=			num_attention_heads
							SCREAMING_SNAKE_CASE :				List[Any]		=			intermediate_size
							SCREAMING_SNAKE_CASE :				List[Any]		=			hidden_act
							SCREAMING_SNAKE_CASE :				Optional[Any]		=			hidden_dropout_prob
							SCREAMING_SNAKE_CASE :				Optional[int]		=			attention_probs_dropout_prob
							SCREAMING_SNAKE_CASE :				Optional[Any]		=			max_position_embeddings
							SCREAMING_SNAKE_CASE :				Optional[int]		=			type_vocab_size
							SCREAMING_SNAKE_CASE :				Optional[Any]		=			type_sequence_label_size
							SCREAMING_SNAKE_CASE :				Any		=			initializer_range
							SCREAMING_SNAKE_CASE :				Optional[Any]		=			num_labels
							SCREAMING_SNAKE_CASE :				List[str]		=			num_choices
							SCREAMING_SNAKE_CASE :				int		=			scope


					def lowerCamelCase_			(						self				:			Tuple						):

							'''simple docstring'''



							SCREAMING_SNAKE_CASE :				List[str]		=			ids_tensor([self.batch_size, self.seq_length]      ,						self.vocab_size						)

							SCREAMING_SNAKE_CASE :				List[str]		=			None
							if self.use_input_mask:
									SCREAMING_SNAKE_CASE :				List[Any]		=			random_attention_mask([self.batch_size, self.seq_length]						)

							SCREAMING_SNAKE_CASE :				List[str]		=			None
							if self.use_token_type_ids:
									SCREAMING_SNAKE_CASE :				Optional[int]		=			ids_tensor([self.batch_size, self.seq_length]      ,						self.type_vocab_size						)

							SCREAMING_SNAKE_CASE :				str		=			None
							SCREAMING_SNAKE_CASE :				Optional[int]		=			None
							SCREAMING_SNAKE_CASE :				List[Any]		=			None
							if self.use_labels:
									SCREAMING_SNAKE_CASE :				int		=			ids_tensor([self.batch_size]      ,						self.type_sequence_label_size						)
									SCREAMING_SNAKE_CASE :				List[str]		=			ids_tensor([self.batch_size, self.seq_length]      ,						self.num_labels						)
									SCREAMING_SNAKE_CASE :				Optional[Any]		=			ids_tensor([self.batch_size]      ,						self.num_choices						)

							SCREAMING_SNAKE_CASE :				int		=			self.get_config()

							return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels


					def lowerCamelCase_			(						self				:			Tuple						):

							'''simple docstring'''



							return MraConfig(
							    vocab_size=self.vocab_size      ,						hidden_size=self.hidden_size      ,						num_hidden_layers=self.num_hidden_layers      ,						num_attention_heads=self.num_attention_heads      ,						intermediate_size=self.intermediate_size      ,						hidden_act=self.hidden_act      ,						hidden_dropout_prob=self.hidden_dropout_prob      ,						attention_probs_dropout_prob=self.attention_probs_dropout_prob      ,						max_position_embeddings=self.max_position_embeddings      ,						type_vocab_size=self.type_vocab_size      ,						is_decoder=__UpperCamelCase      ,						initializer_range=self.initializer_range      ,						)


					def lowerCamelCase_			(						self				:			Optional[Any]						):

							'''simple docstring'''



							SCREAMING_SNAKE_CASE :				List[str]		=			self.get_config()
							SCREAMING_SNAKE_CASE :				Any		=			3_00
							return config


					def lowerCamelCase_			(						self				:			Any						):

							'''simple docstring'''



							(
							    (
							    SCREAMING_SNAKE_CASE 
							),							(
							    SCREAMING_SNAKE_CASE 
							),							(
							    SCREAMING_SNAKE_CASE 
							),							(
							    SCREAMING_SNAKE_CASE 
							),							(
							    SCREAMING_SNAKE_CASE 
							),							(
							    SCREAMING_SNAKE_CASE 
							),							(
							    SCREAMING_SNAKE_CASE 
							),							 
							) :				Optional[Any]		=			self.prepare_config_and_inputs()

							SCREAMING_SNAKE_CASE :				Dict		=			True
							SCREAMING_SNAKE_CASE :				Optional[int]		=			floats_tensor([self.batch_size, self.seq_length, self.hidden_size]						)
							SCREAMING_SNAKE_CASE :				List[str]		=			ids_tensor([self.batch_size, self.seq_length]      ,						vocab_size=2						)

							return (
							    config,
							    input_ids,
							    token_type_ids,
							    input_mask,
							    sequence_labels,
							    token_labels,
							    choice_labels,
							    encoder_hidden_states,
							    encoder_attention_mask,
							)


					def lowerCamelCase_			(						self				:			Optional[int]      ,						lowerCamelCase_				:			Tuple      ,						lowerCamelCase_				:			List[Any]      ,						lowerCamelCase_				:			Tuple      ,						lowerCamelCase_				:			Any      ,						lowerCamelCase_				:			int      ,						lowerCamelCase_				:			Optional[Any]      ,						lowerCamelCase_				:			Union[str, Any]						):

							'''simple docstring'''



							SCREAMING_SNAKE_CASE :				str		=			MraModel(config=__UpperCamelCase						)
							model.to(__UpperCamelCase						)
							model.eval()
							SCREAMING_SNAKE_CASE :				Tuple		=			model(__UpperCamelCase      ,						attention_mask=__UpperCamelCase      ,						token_type_ids=__UpperCamelCase						)
							SCREAMING_SNAKE_CASE :				Optional[int]		=			model(__UpperCamelCase      ,						token_type_ids=__UpperCamelCase						)
							SCREAMING_SNAKE_CASE :				Tuple		=			model(__UpperCamelCase						)
							self.parent.assertEqual(result.last_hidden_state.shape      ,						(self.batch_size, self.seq_length, self.hidden_size)						)


					def lowerCamelCase_			(						self				:			int      ,						lowerCamelCase_				:			List[Any]      ,						lowerCamelCase_				:			Any      ,						lowerCamelCase_				:			str      ,						lowerCamelCase_				:			List[str]      ,						lowerCamelCase_				:			str      ,						lowerCamelCase_				:			Dict      ,						lowerCamelCase_				:			Union[str, Any]      ,						lowerCamelCase_				:			Dict      ,						lowerCamelCase_				:			List[str]      ,						):

							'''simple docstring'''



							SCREAMING_SNAKE_CASE :				str		=			True
							SCREAMING_SNAKE_CASE :				Dict		=			MraModel(__UpperCamelCase						)
							model.to(__UpperCamelCase						)
							model.eval()
							SCREAMING_SNAKE_CASE :				List[Any]		=			model(
							    __UpperCamelCase      ,						attention_mask=__UpperCamelCase      ,						token_type_ids=__UpperCamelCase      ,						encoder_hidden_states=__UpperCamelCase      ,						encoder_attention_mask=__UpperCamelCase      ,						)
							SCREAMING_SNAKE_CASE :				Optional[Any]		=			model(
							    __UpperCamelCase      ,						attention_mask=__UpperCamelCase      ,						token_type_ids=__UpperCamelCase      ,						encoder_hidden_states=__UpperCamelCase      ,						)
							SCREAMING_SNAKE_CASE :				Union[str, Any]		=			model(__UpperCamelCase      ,						attention_mask=__UpperCamelCase      ,						token_type_ids=__UpperCamelCase						)
							self.parent.assertEqual(result.last_hidden_state.shape      ,						(self.batch_size, self.seq_length, self.hidden_size)						)


					def lowerCamelCase_			(						self				:			Dict      ,						lowerCamelCase_				:			Union[str, Any]      ,						lowerCamelCase_				:			Optional[int]      ,						lowerCamelCase_				:			List[Any]      ,						lowerCamelCase_				:			Tuple      ,						lowerCamelCase_				:			Tuple      ,						lowerCamelCase_				:			Optional[Any]      ,						lowerCamelCase_				:			str						):

							'''simple docstring'''



							SCREAMING_SNAKE_CASE :				str		=			MraForMaskedLM(config=__UpperCamelCase						)
							model.to(__UpperCamelCase						)
							model.eval()
							SCREAMING_SNAKE_CASE :				List[str]		=			model(__UpperCamelCase      ,						attention_mask=__UpperCamelCase      ,						token_type_ids=__UpperCamelCase      ,						labels=__UpperCamelCase						)
							self.parent.assertEqual(result.logits.shape      ,						(self.batch_size, self.seq_length, self.vocab_size)						)


					def lowerCamelCase_			(						self				:			Any      ,						lowerCamelCase_				:			List[Any]      ,						lowerCamelCase_				:			Dict      ,						lowerCamelCase_				:			Optional[Any]      ,						lowerCamelCase_				:			int      ,						lowerCamelCase_				:			int      ,						lowerCamelCase_				:			str      ,						lowerCamelCase_				:			List[str]						):

							'''simple docstring'''



							SCREAMING_SNAKE_CASE :				Optional[int]		=			MraForQuestionAnswering(config=__UpperCamelCase						)
							model.to(__UpperCamelCase						)
							model.eval()
							SCREAMING_SNAKE_CASE :				Dict		=			model(
							    __UpperCamelCase      ,						attention_mask=__UpperCamelCase      ,						token_type_ids=__UpperCamelCase      ,						start_positions=__UpperCamelCase      ,						end_positions=__UpperCamelCase      ,						)
							self.parent.assertEqual(result.start_logits.shape      ,						(self.batch_size, self.seq_length)						)
							self.parent.assertEqual(result.end_logits.shape      ,						(self.batch_size, self.seq_length)						)


					def lowerCamelCase_			(						self				:			Dict      ,						lowerCamelCase_				:			Dict      ,						lowerCamelCase_				:			List[str]      ,						lowerCamelCase_				:			List[str]      ,						lowerCamelCase_				:			int      ,						lowerCamelCase_				:			Dict      ,						lowerCamelCase_				:			str      ,						lowerCamelCase_				:			List[Any]						):

							'''simple docstring'''



							SCREAMING_SNAKE_CASE :				Tuple		=			self.num_labels
							SCREAMING_SNAKE_CASE :				List[str]		=			MraForSequenceClassification(__UpperCamelCase						)
							model.to(__UpperCamelCase						)
							model.eval()
							SCREAMING_SNAKE_CASE :				int		=			model(__UpperCamelCase      ,						attention_mask=__UpperCamelCase      ,						token_type_ids=__UpperCamelCase      ,						labels=__UpperCamelCase						)
							self.parent.assertEqual(result.logits.shape      ,						(self.batch_size, self.num_labels)						)


					def lowerCamelCase_			(						self				:			List[Any]      ,						lowerCamelCase_				:			str      ,						lowerCamelCase_				:			str      ,						lowerCamelCase_				:			Union[str, Any]      ,						lowerCamelCase_				:			str      ,						lowerCamelCase_				:			Dict      ,						lowerCamelCase_				:			List[str]      ,						lowerCamelCase_				:			int						):

							'''simple docstring'''



							SCREAMING_SNAKE_CASE :				List[Any]		=			self.num_labels
							SCREAMING_SNAKE_CASE :				List[Any]		=			MraForTokenClassification(config=__UpperCamelCase						)
							model.to(__UpperCamelCase						)
							model.eval()
							SCREAMING_SNAKE_CASE :				Any		=			model(__UpperCamelCase      ,						attention_mask=__UpperCamelCase      ,						token_type_ids=__UpperCamelCase      ,						labels=__UpperCamelCase						)
							self.parent.assertEqual(result.logits.shape      ,						(self.batch_size, self.seq_length, self.num_labels)						)


					def lowerCamelCase_			(						self				:			Any      ,						lowerCamelCase_				:			Optional[Any]      ,						lowerCamelCase_				:			Union[str, Any]      ,						lowerCamelCase_				:			str      ,						lowerCamelCase_				:			Dict      ,						lowerCamelCase_				:			List[Any]      ,						lowerCamelCase_				:			Union[str, Any]      ,						lowerCamelCase_				:			str						):

							'''simple docstring'''



							SCREAMING_SNAKE_CASE :				int		=			self.num_choices
							SCREAMING_SNAKE_CASE :				Optional[Any]		=			MraForMultipleChoice(config=__UpperCamelCase						)
							model.to(__UpperCamelCase						)
							model.eval()
							SCREAMING_SNAKE_CASE :				List[str]		=			input_ids.unsqueeze(1						).expand(-1      ,						self.num_choices      ,						-1						).contiguous()
							SCREAMING_SNAKE_CASE :				List[str]		=			token_type_ids.unsqueeze(1						).expand(-1      ,						self.num_choices      ,						-1						).contiguous()
							SCREAMING_SNAKE_CASE :				Any		=			input_mask.unsqueeze(1						).expand(-1      ,						self.num_choices      ,						-1						).contiguous()
							SCREAMING_SNAKE_CASE :				Dict		=			model(
							    __UpperCamelCase      ,						attention_mask=__UpperCamelCase      ,						token_type_ids=__UpperCamelCase      ,						labels=__UpperCamelCase      ,						)
							self.parent.assertEqual(result.logits.shape      ,						(self.batch_size, self.num_choices)						)



					def lowerCamelCase_			(						self				:			int						):

							'''simple docstring'''



							SCREAMING_SNAKE_CASE :				Union[str, Any]		=			self.prepare_config_and_inputs()
							(
							    (
							    SCREAMING_SNAKE_CASE 
							),							(
							    SCREAMING_SNAKE_CASE 
							),							(
							    SCREAMING_SNAKE_CASE 
							),							(
							    SCREAMING_SNAKE_CASE 
							),							(
							    SCREAMING_SNAKE_CASE 
							),							(
							    SCREAMING_SNAKE_CASE 
							),							(
							    SCREAMING_SNAKE_CASE 
							),							 
							) :				int		=			config_and_inputs
							SCREAMING_SNAKE_CASE :				int		=			{"""input_ids""": input_ids, """token_type_ids""": token_type_ids, """attention_mask""": input_mask}
							return config, inputs_dict







@require_torch
class      UpperCamelCase__					(					lowercase_						,					unittest.TestCase			):




					"""simple docstring"""
					SCREAMING_SNAKE_CASE__				=	(
					    (
					        MraModel,
					        MraForMaskedLM,
					        MraForMultipleChoice,
					        MraForQuestionAnswering,
					        MraForSequenceClassification,
					        MraForTokenClassification,
					    )
					    if is_torch_available()
					    else ()
					)
					SCREAMING_SNAKE_CASE__				=	False
					SCREAMING_SNAKE_CASE__				=	False
					SCREAMING_SNAKE_CASE__				=	False
					SCREAMING_SNAKE_CASE__				=	False

					SCREAMING_SNAKE_CASE__				=	()


					def lowerCamelCase_			(						self				:			Tuple						):

							'''simple docstring'''



							SCREAMING_SNAKE_CASE :				Optional[int]		=			MraModelTester(self						)
							SCREAMING_SNAKE_CASE :				List[str]		=			ConfigTester(self      ,						config_class=__UpperCamelCase      ,						hidden_size=37						)


					def lowerCamelCase_			(						self				:			Optional[Any]						):

							'''simple docstring'''



							self.config_tester.run_common_tests()


					def lowerCamelCase_			(						self				:			int						):

							'''simple docstring'''



							SCREAMING_SNAKE_CASE :				Optional[Any]		=			self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_model(*__UpperCamelCase						)


					def lowerCamelCase_			(						self				:			Any						):

							'''simple docstring'''



							SCREAMING_SNAKE_CASE :				Optional[int]		=			self.model_tester.prepare_config_and_inputs()
							for type in ["absolute", "relative_key", "relative_key_query"]:
									SCREAMING_SNAKE_CASE :				Dict		=			type
									self.model_tester.create_and_check_model(*__UpperCamelCase						)


					def lowerCamelCase_			(						self				:			Optional[int]						):

							'''simple docstring'''



							SCREAMING_SNAKE_CASE :				Any		=			self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_masked_lm(*__UpperCamelCase						)


					def lowerCamelCase_			(						self				:			str						):

							'''simple docstring'''



							SCREAMING_SNAKE_CASE :				Optional[int]		=			self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_multiple_choice(*__UpperCamelCase						)


					def lowerCamelCase_			(						self				:			Tuple						):

							'''simple docstring'''



							SCREAMING_SNAKE_CASE :				Union[str, Any]		=			self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_question_answering(*__UpperCamelCase						)


					def lowerCamelCase_			(						self				:			Optional[int]						):

							'''simple docstring'''



							SCREAMING_SNAKE_CASE :				List[Any]		=			self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_sequence_classification(*__UpperCamelCase						)


					def lowerCamelCase_			(						self				:			Tuple						):

							'''simple docstring'''



							SCREAMING_SNAKE_CASE :				Optional[Any]		=			self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_token_classification(*__UpperCamelCase						)


					@slow
					def lowerCamelCase_			(						self				:			List[str]						):

							'''simple docstring'''



							for model_name in MRA_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
									SCREAMING_SNAKE_CASE :				Dict		=			MraModel.from_pretrained(__UpperCamelCase						)
									self.assertIsNotNone(__UpperCamelCase						)



					@unittest.skip(reason="""MRA does not output attentions"""						)
					def lowerCamelCase_			(						self				:			int						):

							'''simple docstring'''



							return







@require_torch
class      UpperCamelCase__					(					unittest.TestCase			):




					"""simple docstring"""


					@slow
					def lowerCamelCase_			(						self				:			List[str]						):

							'''simple docstring'''



							SCREAMING_SNAKE_CASE :				Any		=			MraModel.from_pretrained("""uw-madison/mra-base-512-4"""						)
							SCREAMING_SNAKE_CASE :				List[Any]		=			torch.arange(2_56						).unsqueeze(0						)

							with torch.no_grad():
									SCREAMING_SNAKE_CASE :				Any		=			model(__UpperCamelCase						)[0]

							SCREAMING_SNAKE_CASE :				str		=			torch.Size((1, 2_56, 7_68)						)
							self.assertEqual(output.shape      ,						__UpperCamelCase						)

							SCREAMING_SNAKE_CASE :				str		=			torch.tensor(
							    [[[-0.0_140, 0.0_830, -0.0_381], [0.1_546, 0.1_402, 0.0_220], [0.1_162, 0.0_851, 0.0_165]]]						)

							self.assertTrue(torch.allclose(output[:, :3, :3]      ,						__UpperCamelCase      ,						atol=1e-4						)						)


					@slow
					def lowerCamelCase_			(						self				:			Optional[Any]						):

							'''simple docstring'''



							SCREAMING_SNAKE_CASE :				Optional[int]		=			MraForMaskedLM.from_pretrained("""uw-madison/mra-base-512-4"""						)
							SCREAMING_SNAKE_CASE :				int		=			torch.arange(2_56						).unsqueeze(0						)

							with torch.no_grad():
									SCREAMING_SNAKE_CASE :				List[Any]		=			model(__UpperCamelCase						)[0]

							SCREAMING_SNAKE_CASE :				int		=			5_02_65

							SCREAMING_SNAKE_CASE :				List[str]		=			torch.Size((1, 2_56, vocab_size)						)
							self.assertEqual(output.shape      ,						__UpperCamelCase						)

							SCREAMING_SNAKE_CASE :				str		=			torch.tensor(
							    [[[9.2_595, -3.6_038, 11.8_819], [9.3_869, -3.2_693, 11.0_956], [11.8_524, -3.4_938, 13.1_210]]]						)

							self.assertTrue(torch.allclose(output[:, :3, :3]      ,						__UpperCamelCase      ,						atol=1e-4						)						)



					@slow
					def lowerCamelCase_			(						self				:			Union[str, Any]						):

							'''simple docstring'''



							SCREAMING_SNAKE_CASE :				Union[str, Any]		=			MraForMaskedLM.from_pretrained("""uw-madison/mra-base-4096-8-d3"""						)
							SCREAMING_SNAKE_CASE :				str		=			torch.arange(40_96						).unsqueeze(0						)

							with torch.no_grad():
									SCREAMING_SNAKE_CASE :				Any		=			model(__UpperCamelCase						)[0]

							SCREAMING_SNAKE_CASE :				Any		=			5_02_65

							SCREAMING_SNAKE_CASE :				Union[str, Any]		=			torch.Size((1, 40_96, vocab_size)						)
							self.assertEqual(output.shape      ,						__UpperCamelCase						)

							SCREAMING_SNAKE_CASE :				Dict		=			torch.tensor(
							    [[[5.4_789, -2.3_564, 7.5_064], [7.9_067, -1.3_369, 9.9_668], [9.0_712, -1.8_106, 7.0_380]]]						)

							self.assertTrue(torch.allclose(output[:, :3, :3]      ,						__UpperCamelCase      ,						atol=1e-4						)						)





from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_tf_available,
    is_torch_available,
    is_vision_available,
)


lowercase   =	{
    '''configuration_blip''': [
        '''BLIP_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''BlipConfig''',
        '''BlipTextConfig''',
        '''BlipVisionConfig''',
    ],
    '''processing_blip''': ['''BlipProcessor'''],
}

try:
		if not is_vision_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		lowercase   =	['''BlipImageProcessor''']


try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		lowercase   =	[
		    '''BLIP_PRETRAINED_MODEL_ARCHIVE_LIST''',
		    '''BlipModel''',
		    '''BlipPreTrainedModel''',
		    '''BlipForConditionalGeneration''',
		    '''BlipForQuestionAnswering''',
		    '''BlipVisionModel''',
		    '''BlipTextModel''',
		    '''BlipForImageTextRetrieval''',
		]

try:
		if not is_tf_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		lowercase   =	[
		    '''TF_BLIP_PRETRAINED_MODEL_ARCHIVE_LIST''',
		    '''TFBlipModel''',
		    '''TFBlipPreTrainedModel''',
		    '''TFBlipForConditionalGeneration''',
		    '''TFBlipForQuestionAnswering''',
		    '''TFBlipVisionModel''',
		    '''TFBlipTextModel''',
		    '''TFBlipForImageTextRetrieval''',
		]

if TYPE_CHECKING:
		from .configuration_blip import BLIP_PRETRAINED_CONFIG_ARCHIVE_MAP, BlipConfig, BlipTextConfig, BlipVisionConfig
		from .processing_blip import BlipProcessor

		try:
				if not is_vision_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .image_processing_blip import BlipImageProcessor

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_blip import (
				    BLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
				    BlipForConditionalGeneration,
				    BlipForImageTextRetrieval,
				    BlipForQuestionAnswering,
				    BlipModel,
				    BlipPreTrainedModel,
				    BlipTextModel,
				    BlipVisionModel,
				)

		try:
				if not is_tf_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_tf_blip import (
				    TF_BLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
				    TFBlipForConditionalGeneration,
				    TFBlipForImageTextRetrieval,
				    TFBlipForQuestionAnswering,
				    TFBlipModel,
				    TFBlipPreTrainedModel,
				    TFBlipTextModel,
				    TFBlipVisionModel,
				)

else:
		import sys

		lowercase   =	_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)





