


'''simple docstring'''







import math
import os
import unittest

from transformers import MegatronBertConfig, is_torch_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
   import torch

   from transformers import (
       MODEL_FOR_PRETRAINING_MAPPING,
       MegatronBertForCausalLM,
       MegatronBertForMaskedLM,
       MegatronBertForMultipleChoice,
       MegatronBertForNextSentencePrediction,
       MegatronBertForPreTraining,
       MegatronBertForQuestionAnswering,
       MegatronBertForSequenceClassification,
       MegatronBertForTokenClassification,
       MegatronBertModel,
   )


class 			__lowerCamelCase			:
    """simple docstring"""


    def __init__(  self      :							Dict				,							SCREAMING_SNAKE_CASE      :							Union[str, Any]				,							SCREAMING_SNAKE_CASE      :							Dict=13				,							SCREAMING_SNAKE_CASE      :							List[Any]=7				,							SCREAMING_SNAKE_CASE      :							int=True				,							SCREAMING_SNAKE_CASE      :							Optional[int]=True				,							SCREAMING_SNAKE_CASE      :							Optional[Any]=True				,							SCREAMING_SNAKE_CASE      :							Union[str, Any]=True				,							SCREAMING_SNAKE_CASE      :							int=99				,							SCREAMING_SNAKE_CASE      :							str=64				,							SCREAMING_SNAKE_CASE      :							int=32				,							SCREAMING_SNAKE_CASE      :							List[Any]=5				,							SCREAMING_SNAKE_CASE      :							Optional[Any]=4				,							SCREAMING_SNAKE_CASE      :							int=37				,							SCREAMING_SNAKE_CASE      :							List[str]="gelu"				,							SCREAMING_SNAKE_CASE      :							Union[str, Any]=0.1				,							SCREAMING_SNAKE_CASE      :							Optional[int]=0.1				,							SCREAMING_SNAKE_CASE      :							Any=512				,							SCREAMING_SNAKE_CASE      :							List[str]=16				,							SCREAMING_SNAKE_CASE      :							Union[str, Any]=2				,							SCREAMING_SNAKE_CASE      :							Optional[int]=0.02				,							SCREAMING_SNAKE_CASE      :							Optional[Any]=3				,							SCREAMING_SNAKE_CASE      :							Union[str, Any]=4				,							SCREAMING_SNAKE_CASE      :							Union[str, Any]=None				,							):
           _A					:     Tuple     = parent
           _A					:     str     = batch_size
           _A					:     List[Any]     = seq_length
           _A					:     List[Any]     = is_training
           _A					:     Tuple     = use_input_mask
           _A					:     Optional[Any]     = use_token_type_ids
           _A					:     Optional[int]     = use_labels
           _A					:     Optional[Any]     = vocab_size
           _A					:     Union[str, Any]     = hidden_size
           _A					:     Any     = embedding_size
           _A					:     List[Any]     = num_hidden_layers
           _A					:     Union[str, Any]     = num_attention_heads
           _A					:     List[str]     = intermediate_size
           _A					:     Any     = hidden_act
           _A					:     Dict     = hidden_dropout_prob
           _A					:     Any     = attention_probs_dropout_prob
           _A					:     Tuple     = max_position_embeddings
           _A					:     Union[str, Any]     = type_vocab_size
           _A					:     Optional[int]     = type_sequence_label_size
           _A					:     Any     = initializer_range
           _A					:     List[str]     = num_labels
           _A					:     Tuple     = num_choices
           _A					:     Union[str, Any]     = scope


    def        A   (  self      :							Union[str, Any]):
           _A					:     List[Any]     = ids_tensor([self.batch_size, self.seq_length]				,							self.vocab_size)

           _A					:     Dict     = None
           if self.use_input_mask:
                  _A					:     Dict     = random_attention_mask([self.batch_size, self.seq_length])

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

           _A					:     Optional[int]     = None
           _A					:     Dict     = None
           _A					:     Union[str, Any]     = None
           if self.use_labels:
                  _A					:     Any     = ids_tensor([self.batch_size]				,							self.type_sequence_label_size)
                  _A					:     Union[str, Any]     = ids_tensor([self.batch_size, self.seq_length]				,							self.num_labels)
                  _A					:     Tuple     = ids_tensor([self.batch_size]				,							self.num_choices)

           _A					:     Optional[Any]     = self.get_config()

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


    def        A   (  self      :							Tuple):
           return MegatronBertConfig(
               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				,							embedding_size=self.embedding_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=SCREAMING_SNAKE_CASE				,							initializer_range=self.initializer_range				,							)


    def        A   (  self      :							Dict				,							SCREAMING_SNAKE_CASE      :							Any				,							SCREAMING_SNAKE_CASE      :							str				,							SCREAMING_SNAKE_CASE      :							Union[str, Any]				,							SCREAMING_SNAKE_CASE      :							Tuple				,							SCREAMING_SNAKE_CASE      :							Union[str, Any]				,							SCREAMING_SNAKE_CASE      :							Dict				,							SCREAMING_SNAKE_CASE      :							str):
           _A					:     int     = MegatronBertModel(config=SCREAMING_SNAKE_CASE)
           model.to(SCREAMING_SNAKE_CASE)
           model.eval()
           _A					:     Optional[int]     = model(SCREAMING_SNAKE_CASE				,							attention_mask=SCREAMING_SNAKE_CASE				,							token_type_ids=SCREAMING_SNAKE_CASE)
           _A					:     str     = model(SCREAMING_SNAKE_CASE				,							token_type_ids=SCREAMING_SNAKE_CASE)
           _A					:     Optional[Any]     = model(SCREAMING_SNAKE_CASE)

           self.parent.assertEqual(result.last_hidden_state.shape				,							(self.batch_size, self.seq_length, self.hidden_size))
           self.parent.assertEqual(result.pooler_output.shape				,							(self.batch_size, self.hidden_size))


    def        A   (  self      :							Tuple				,							SCREAMING_SNAKE_CASE      :							Any				,							SCREAMING_SNAKE_CASE      :							Tuple				,							SCREAMING_SNAKE_CASE      :							List[Any]				,							SCREAMING_SNAKE_CASE      :							List[str]				,							SCREAMING_SNAKE_CASE      :							Optional[int]				,							SCREAMING_SNAKE_CASE      :							Dict				,							SCREAMING_SNAKE_CASE      :							Union[str, Any]):
           _A					:     Optional[int]     = MegatronBertForMaskedLM(config=SCREAMING_SNAKE_CASE)
           model.to(SCREAMING_SNAKE_CASE)
           model.eval()
           _A					:     Dict     = model(SCREAMING_SNAKE_CASE				,							attention_mask=SCREAMING_SNAKE_CASE				,							token_type_ids=SCREAMING_SNAKE_CASE				,							labels=SCREAMING_SNAKE_CASE)
           self.parent.assertEqual(result.logits.shape				,							(self.batch_size, self.seq_length, self.vocab_size))


    def        A   (  self      :							str				,							SCREAMING_SNAKE_CASE      :							int				,							SCREAMING_SNAKE_CASE      :							Tuple				,							SCREAMING_SNAKE_CASE      :							Any				,							SCREAMING_SNAKE_CASE      :							Dict				,							SCREAMING_SNAKE_CASE      :							Tuple				,							SCREAMING_SNAKE_CASE      :							Optional[Any]				,							SCREAMING_SNAKE_CASE      :							Optional[Any]):
           _A					:     int     = MegatronBertForCausalLM(config=SCREAMING_SNAKE_CASE)
           model.to(SCREAMING_SNAKE_CASE)
           model.eval()
           _A					:     Tuple     = model(SCREAMING_SNAKE_CASE				,							attention_mask=SCREAMING_SNAKE_CASE				,							token_type_ids=SCREAMING_SNAKE_CASE				,							labels=SCREAMING_SNAKE_CASE)
           self.parent.assertEqual(result.logits.shape				,							(self.batch_size, self.seq_length, self.vocab_size))


    def        A   (  self      :							Optional[Any]				,							SCREAMING_SNAKE_CASE      :							Any				,							SCREAMING_SNAKE_CASE      :							Optional[int]				,							SCREAMING_SNAKE_CASE      :							Dict				,							SCREAMING_SNAKE_CASE      :							int				,							SCREAMING_SNAKE_CASE      :							Tuple				,							SCREAMING_SNAKE_CASE      :							List[Any]				,							SCREAMING_SNAKE_CASE      :							Optional[int]):
           _A					:     Tuple     = MegatronBertForNextSentencePrediction(config=SCREAMING_SNAKE_CASE)
           model.to(SCREAMING_SNAKE_CASE)
           model.eval()
           _A					:     List[Any]     = model(
               SCREAMING_SNAKE_CASE				,							attention_mask=SCREAMING_SNAKE_CASE				,							token_type_ids=SCREAMING_SNAKE_CASE				,							labels=SCREAMING_SNAKE_CASE				,							)
           self.parent.assertEqual(result.logits.shape				,							(self.batch_size, 2))


    def        A   (  self      :							Tuple				,							SCREAMING_SNAKE_CASE      :							Optional[int]				,							SCREAMING_SNAKE_CASE      :							Tuple				,							SCREAMING_SNAKE_CASE      :							Dict				,							SCREAMING_SNAKE_CASE      :							str				,							SCREAMING_SNAKE_CASE      :							Dict				,							SCREAMING_SNAKE_CASE      :							Optional[int]				,							SCREAMING_SNAKE_CASE      :							str):
           _A					:     Tuple     = MegatronBertForPreTraining(config=SCREAMING_SNAKE_CASE)
           model.to(SCREAMING_SNAKE_CASE)
           model.eval()
           _A					:     int     = model(
               SCREAMING_SNAKE_CASE				,							attention_mask=SCREAMING_SNAKE_CASE				,							token_type_ids=SCREAMING_SNAKE_CASE				,							labels=SCREAMING_SNAKE_CASE				,							next_sentence_label=SCREAMING_SNAKE_CASE				,							)
           self.parent.assertEqual(result.prediction_logits.shape				,							(self.batch_size, self.seq_length, self.vocab_size))
           self.parent.assertEqual(result.seq_relationship_logits.shape				,							(self.batch_size, 2))


    def        A   (  self      :							Optional[int]				,							SCREAMING_SNAKE_CASE      :							Optional[int]				,							SCREAMING_SNAKE_CASE      :							List[str]				,							SCREAMING_SNAKE_CASE      :							List[str]				,							SCREAMING_SNAKE_CASE      :							Union[str, Any]				,							SCREAMING_SNAKE_CASE      :							int				,							SCREAMING_SNAKE_CASE      :							Dict				,							SCREAMING_SNAKE_CASE      :							Any):
           _A					:     int     = MegatronBertForQuestionAnswering(config=SCREAMING_SNAKE_CASE)
           model.to(SCREAMING_SNAKE_CASE)
           model.eval()
           _A					:     Union[str, Any]     = model(
               SCREAMING_SNAKE_CASE				,							attention_mask=SCREAMING_SNAKE_CASE				,							token_type_ids=SCREAMING_SNAKE_CASE				,							start_positions=SCREAMING_SNAKE_CASE				,							end_positions=SCREAMING_SNAKE_CASE				,							)
           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        A   (  self      :							int				,							SCREAMING_SNAKE_CASE      :							Optional[Any]				,							SCREAMING_SNAKE_CASE      :							Optional[int]				,							SCREAMING_SNAKE_CASE      :							List[Any]				,							SCREAMING_SNAKE_CASE      :							Union[str, Any]				,							SCREAMING_SNAKE_CASE      :							int				,							SCREAMING_SNAKE_CASE      :							List[str]				,							SCREAMING_SNAKE_CASE      :							List[Any]):
           _A					:     str     = self.num_labels
           _A					:     List[Any]     = MegatronBertForSequenceClassification(SCREAMING_SNAKE_CASE)
           model.to(SCREAMING_SNAKE_CASE)
           model.eval()
           _A					:     Optional[Any]     = model(SCREAMING_SNAKE_CASE				,							attention_mask=SCREAMING_SNAKE_CASE				,							token_type_ids=SCREAMING_SNAKE_CASE				,							labels=SCREAMING_SNAKE_CASE)
           self.parent.assertEqual(result.logits.shape				,							(self.batch_size, self.num_labels))


    def        A   (  self      :							Dict				,							SCREAMING_SNAKE_CASE      :							Dict				,							SCREAMING_SNAKE_CASE      :							Optional[int]				,							SCREAMING_SNAKE_CASE      :							Any				,							SCREAMING_SNAKE_CASE      :							Tuple				,							SCREAMING_SNAKE_CASE      :							Optional[Any]				,							SCREAMING_SNAKE_CASE      :							Any				,							SCREAMING_SNAKE_CASE      :							List[str]):
           _A					:     Any     = self.num_labels
           _A					:     Union[str, Any]     = MegatronBertForTokenClassification(config=SCREAMING_SNAKE_CASE)
           model.to(SCREAMING_SNAKE_CASE)
           model.eval()
           _A					:     Dict     = model(SCREAMING_SNAKE_CASE				,							attention_mask=SCREAMING_SNAKE_CASE				,							token_type_ids=SCREAMING_SNAKE_CASE				,							labels=SCREAMING_SNAKE_CASE)
           self.parent.assertEqual(result.logits.shape				,							(self.batch_size, self.seq_length, self.num_labels))


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


    def        A   (  self      :							Optional[Any]):
           _A					:     str     = self.prepare_config_and_inputs()
           (
               (
               _A
           )  ,			(
               _A
           )  ,			(
               _A
           )  ,			(
               _A
           )  ,			(
               _A
           )  ,			(
               _A
           )  ,			(
               _A
           )  ,			
           )					:     List[Any]     = config_and_inputs
           _A					:     Tuple     = {'input_ids': input_ids, 'token_type_ids': token_type_ids, 'attention_mask': input_mask}
           return config, inputs_dict




@require_torch
class 			__lowerCamelCase			(	a_    , a_    , unittest.TestCase	):
    """simple docstring"""
    a													=   (
        (
            MegatronBertModel,
            MegatronBertForMaskedLM,
            MegatronBertForCausalLM,
            MegatronBertForMultipleChoice,
            MegatronBertForNextSentencePrediction,
            MegatronBertForPreTraining,
            MegatronBertForQuestionAnswering,
            MegatronBertForSequenceClassification,
            MegatronBertForTokenClassification,
        )
        if is_torch_available()
        else ()
    )
    a													=   (
        {
            "feature-extraction": MegatronBertModel,
            "fill-mask": MegatronBertForMaskedLM,
            "question-answering": MegatronBertForQuestionAnswering,
            "text-classification": MegatronBertForSequenceClassification,
            "text-generation": MegatronBertForCausalLM,
            "token-classification": MegatronBertForTokenClassification,
            "zero-shot": MegatronBertForSequenceClassification,
        }
        if is_torch_available()
        else {}
    )
    a													=   True
    # test_resize_embeddings = False
    a													=   False


    def        A   (  self      :							Dict				,							SCREAMING_SNAKE_CASE      :							List[str]				,							SCREAMING_SNAKE_CASE      :							str				,							SCREAMING_SNAKE_CASE      :							Any=False):
           _A					:     int     = super()._prepare_for_class(SCREAMING_SNAKE_CASE				,							SCREAMING_SNAKE_CASE				,							return_labels=SCREAMING_SNAKE_CASE)

           if return_labels:
                  if model_class in get_values(SCREAMING_SNAKE_CASE):
                         _A					:     Optional[Any]     = torch.zeros(
                             (self.model_tester.batch_size, self.model_tester.seq_length)				,							dtype=torch.long				,							device=SCREAMING_SNAKE_CASE)
                         _A					:     Tuple     = torch.zeros(
                             self.model_tester.batch_size				,							dtype=torch.long				,							device=SCREAMING_SNAKE_CASE)
           return inputs_dict


    def        A   (  self      :							str):
           _A					:     str     = MegatronBertModelTester(self)
           _A					:     Dict     = ConfigTester(self				,							config_class=SCREAMING_SNAKE_CASE				,							hidden_size=37)


    def        A   (  self      :							int):
           self.config_tester.run_common_tests()


    def        A   (  self      :							List[str]):
           _A					:     List[str]     = self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_megatron_bert_model(*SCREAMING_SNAKE_CASE)


    def        A   (  self      :							Tuple):
           _A					:     Union[str, Any]     = self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_megatron_bert_for_masked_lm(*SCREAMING_SNAKE_CASE)


    def        A   (  self      :							str):
           _A					:     str     = self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_megatron_bert_for_multiple_choice(*SCREAMING_SNAKE_CASE)


    def        A   (  self      :							int):
           _A					:     str     = self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_megatron_bert_for_next_sequence_prediction(*SCREAMING_SNAKE_CASE)


    def        A   (  self      :							Any):
           _A					:     Any     = self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_megatron_bert_for_pretraining(*SCREAMING_SNAKE_CASE)


    def        A   (  self      :							Optional[int]):
           _A					:     Tuple     = self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_megatron_bert_for_question_answering(*SCREAMING_SNAKE_CASE)


    def        A   (  self      :							int):
           _A					:     List[Any]     = self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_megatron_bert_for_sequence_classification(*SCREAMING_SNAKE_CASE)


    def        A   (  self      :							Any):
           _A					:     Union[str, Any]     = self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_megatron_bert_for_token_classification(*SCREAMING_SNAKE_CASE)






def 				lowerCAmelCase__	(    lowerCamelCase					:      List[str]       ):
       return torch.tensor(
           lowerCamelCase  ,dtype=torch.long  ,device=lowerCamelCase  ,)


A				:					Dict    						=			1e-4


@require_torch
@require_sentencepiece
@require_tokenizers
class 			__lowerCamelCase			(	unittest.TestCase	):
    """simple docstring"""


    @slow
    @unittest.skip('Model is not available.')
    def        A   (  self      :							List[str]):
           _A					:     Optional[int]     = 'nvidia/megatron-bert-uncased-345m'
           if "MYDIR" in os.environ:
                  _A					:     Any     = os.path.join(os.environ['MYDIR']				,							SCREAMING_SNAKE_CASE)
           _A					:     Dict     = MegatronBertModel.from_pretrained(SCREAMING_SNAKE_CASE)
           model.to(SCREAMING_SNAKE_CASE)
           model.half()
           _A					:     int     = _long_tensor([[101, 7110, 1005, 1056, 2023, 11333, 17413, 1029, 102]])
           with torch.no_grad():
                  _A					:     Tuple     = model(SCREAMING_SNAKE_CASE)[0]
           _A					:     List[Any]     = torch.Size((1, 9, 1024))
           self.assertEqual(output.shape				,							SCREAMING_SNAKE_CASE)

           _A					:     Union[str, Any]     = [-0.6040, -0.2517, -0.1025, 0.3420, -0.6758, -0.0017, -0.1089, -0.1990, 0.5728]
           for ii in range(3):
                  for jj in range(3):
                         _A					:     Optional[int]     = output[0, ii, jj]
                         _A					:     Union[str, Any]     = expected[3 * ii + jj]
                         _A					:     Tuple     = 'ii={} jj={} a={} b={}'.format(SCREAMING_SNAKE_CASE				,							SCREAMING_SNAKE_CASE				,							SCREAMING_SNAKE_CASE				,							SCREAMING_SNAKE_CASE)
                         self.assertTrue(math.isclose(SCREAMING_SNAKE_CASE				,							SCREAMING_SNAKE_CASE				,							rel_tol=SCREAMING_SNAKE_CASE				,							abs_tol=SCREAMING_SNAKE_CASE)				,							msg=SCREAMING_SNAKE_CASE)










'''simple docstring'''







from typing import TYPE_CHECKING

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


A				:					str    						=			{
    '''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:
   A				:					Optional[Any]    						=			['''BlipImageProcessor''']


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

try:
   if not is_tf_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   A				:					Union[str, Any]    						=			[
       '''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

   A				:					Optional[int]    						=			_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)






